Skip to main content

Quantum Clusters

pydantic model covalent.executor.QCluster

#

A cluster of quantum executors.

Parameters

executors- A sequence of quantum executors.

selector- A callable that selects an executor, or one of the strings "cyclic" or "random". The "cyclic" selector (default) cycles through executors and returns the next executor for each circuit. The "random" selector chooses an executor from executors at random for each circuit. Any user-defined selector must be callable with two positional arguments, a circuit and a list of executors. A selector must also return exactly one executor.

Show JSON Schema
{
"title": "QCluster",
"description": "A cluster of quantum executors.\n\nArgs:\n executors: A sequence of quantum executors.\n selector: A callable that selects an executor, or one of the strings \"cyclic\"\n or \"random\". The \"cyclic\" selector (default) cycles through `executors`\n and returns the next executor for each circuit. The \"random\" selector\n chooses an executor from `executors` at random for each circuit. Any\n user-defined selector must be callable with two positional arguments,\n a circuit and a list of executors. A selector must also return exactly\n one executor.",
"type": "object",
"properties": {
"persist_data": {
"title": "Persist Data",
"default": true,
"type": "boolean"
},
"qnode_device_import_path": {
"title": "Qnode Device Import Path",
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": [
{
"type": "string"
},
{
"type": "string"
}
]
},
"qnode_device_shots": {
"title": "Qnode Device Shots",
"type": "integer"
},
"qnode_device_wires": {
"title": "Qnode Device Wires",
"type": "integer"
},
"pennylane_active_return": {
"title": "Pennylane Active Return",
"type": "boolean"
},
"device": {
"title": "Device",
"default": "default.qubit",
"type": "string"
},
"executors": {
"title": "Executors",
"type": "array",
"items": {
"$ref": "#/definitions/BaseQExecutor"
}
}
},
"required": [
"executors"
],
"definitions": {
"BaseQExecutor": {
"title": "BaseQExecutor",
"description": "Helper class that provides a standard way to create an ABC using\ninheritance.",
"type": "object",
"properties": {
"persist_data": {
"title": "Persist Data",
"default": true,
"type": "boolean"
},
"qnode_device_import_path": {
"title": "Qnode Device Import Path",
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": [
{
"type": "string"
},
{
"type": "string"
}
]
},
"qnode_device_shots": {
"title": "Qnode Device Shots",
"type": "integer"
},
"qnode_device_wires": {
"title": "Qnode Device Wires",
"type": "integer"
},
"pennylane_active_return": {
"title": "Pennylane Active Return",
"type": "boolean"
}
}
}
}
}

CONFIG

extra: EXTRA = allow

field device: str = 'default.qubit'

#

Validated by

set_name

field executors: Sequence[BaseQExecutor] [Required]

#

Validated by

set_name

field pennylane_active_return: bool = None

#

Validated by

set_name

field persist_data: bool = True

#

Validated by

set_name

field qnode_device_import_path: Tuple[str, str] = None

#

Validated by

set_name

field qnode_device_shots: Optional[int] = None

#

Validated by

set_name

field qnode_device_wires: int = None

#

Validated by

set_name

field selector: Union[str, Callable] = 'cyclic'

#

Validated by

set_name

batch_submit

#

deserialize_selector

#

Deserializes the cluster’s selector function.

Return Type

Union[str, Callable]

dict

#

Custom dict method to create a hashable executors attribute.

Return Type

dict

get_selector

#

Wraps self.selector to return defaults corresponding to string values.

This method is called inside batch_submit.

Return Type

callable

serialize_selector

#

Serializes the cluster’s selector function.

Return Type

None