Tasks and Services#

class GenericTaskResult(*, schema_name='qca_generic_task_result', id, results=None, stdout=None, stderr=None, success, provenance, extras={}, error=None)[source]#

Bases: ProtoModel

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Parameters:
  • schema_name (Literal['qca_generic_task_result'])

  • id (int)

  • results (Any)

  • stdout (str | None)

  • stderr (str | None)

  • success (bool)

  • provenance (Provenance)

  • extras (Dict[str, Any])

  • error (ComputeError | None)

schema_name: Literal['qca_generic_task_result']#
id: int#
results: Any#
stdout: str | None#
stderr: str | None#
success: bool#
provenance: Provenance#
extras: Dict[str, Any]#
error: ComputeError | None#
class Config#

Bases: object

allow_mutation: bool = False#
extra: str = 'forbid'#
force_skip_defaults: bool = False#
json_encoders: Dict[str, Any] = {<class 'numpy.ndarray'>: <function ProtoModel.Config.<lambda>>}#
serialize_default_excludes: Set = {}#
serialize_skip_defaults: bool = False#
compare(other, **kwargs)#

Compares the current object to the provided object recursively.

Parameters:
  • other (ProtoModel | BaseModel) – The model to compare to.

  • **kwargs – Additional kwargs to pass to compare_recursive().

Returns:

True if the objects match.

Return type:

bool

dict(**kwargs)#

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

Return type:

Dict[str, Any]

json(**kwargs)#

Generate a JSON representation of the model, include and exclude arguments as per dict().

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().

classmethod parse_file(path, *, encoding=None)#

Parses a file into a Model object.

Parameters:
  • path (str | Path) – The path to the file.

  • encoding (str | None) – The type of the files, available types are: {‘json’, ‘msgpack’, ‘pickle’}. Attempts to automatically infer the file type from the file extension if None.

Returns:

The requested model from a serialized format.

Return type:

Model

classmethod parse_raw(data, *, encoding=None)#

Parses raw string or bytes into a Model object.

Parameters:
  • data (bytes | str) – A serialized data blob to be deserialized into a Model.

  • encoding (str | None) – The type of the serialized array, available types are: {‘json’, ‘json-ext’, ‘msgpack-ext’, ‘pickle’}

Returns:

The requested model from a serialized format.

Return type:

Model

serialize(encoding, *, include=None, exclude=None, exclude_unset=None, exclude_defaults=None, exclude_none=None)#

Generates a serialized representation of the model

Parameters:
  • encoding (str) – The serialization type, available types are: {‘json’, ‘json-ext’, ‘msgpack-ext’}

  • include (Set[str] | None) – Fields to be included in the serialization.

  • exclude (Set[str] | None) – Fields to be excluded in the serialization.

  • exclude_unset (bool | None) – If True, skips fields that have default values provided.

  • exclude_defaults (bool | None) – If True, skips fields that have set or defaulted values equal to the default.

  • exclude_none (bool | None) – If True, skips fields that have value None.

Returns:

The serialized model.

Return type:

Union[bytes, str]