strangeworks_azure package¶
Submodules¶
strangeworks_azure.backend module¶
provider.py.
- class StrangeworksBackend(name: str, status: str | None = None, slug: str | None = None, **kwargs)¶
Bases:
object
The Strangeworks Provider allows access to Strangeworks backends for the Microsoft Azure services
- static get_backends(arns: list[str] | None = None, names: list[str] | None = None, statuses: list[str] | None = None)¶
Get a list of devices. :param arns: Filter by list of device ARNs. Defaults to None. :type arns: Optional[list[str] :param names: Filter by list of device names. Defaults to None. :type names: Optional[list[str]] :param statuses: Filter by list of device statuses. Defaults to None. :type statuses: Optional[list[str]]
- Returns:
devices – List of devices that match the provided filters.
- Return type:
list[SwDevice]
- properties()¶
Return properties of backend.
- run(task_specification: Dict | str, shots: int | None, *args, **kwargs) StrangeworksQuantumJob ¶
Run a task on the device. :param task_specification: The task specification. :type task_specification: Union[QuantumCircuit, str] :param shots: The number of shots to run the task for. Defaults to 1000. :type shots: Optional[int]
- Returns:
task – The task that was run.
- Return type:
Job (StrangeworksQuantumJob)
strangeworks_azure.job module¶
- class StrangeworksQuantumJob(job: Job, *args, **kwargs)¶
Bases:
object
- cancel() None ¶
Cancel the task.
- Raises:
- StrangeworksError
If the task has not been submitted yet.
- static from_strangeworks_slug(id: str) StrangeworksQuantumJob ¶
Get a task from a strangeworks id.
- Parameters:
- id: str
The strangeworks id of the task.
- Returns:
- task: StrangeworksQuantumTask
The task.
- Raises:
- StrangeworksError
If no task is found for the id. Or if multiple tasks are found for the id.
- property id: str¶
The id of the task.
- Returns:
- id: str
The id of the task. This is the id of the job in Strangeworks.
- result() Dict ¶
Get the result of the task.
- Returns:
- result: Union[GateModelQuantumTaskResult, AnnealingQuantumTaskResult]
The result of the task.
- Raises:
- StrangeworksError
If the task has not been submitted yet. Or if the task did not complete successfully. Or unable to fetch the results for the task.
- status() str ¶
Get the state of the task.
- Returns:
- state: str
The state of the task.
- Raises:
- StrangeworksError
If the task has not been submitted yet. Or if we find are not able to find the status.
- static submit(device_name: str, task_specification: QuantumCircuit | str, shots: int, backend_parameters: Dict[str, Any] | None = None, tags: Dict[str, str] | None = None, *args, **kwargs) StrangeworksQuantumJob ¶
Create a task.
- Parameters:
- device_arn: str
The name of the device to run the task on.
- task_specification: Union[Circuit, Problem, OpenQasmProgram]
The task specification.
- shots: int
The number of shots to run the task for.
- device_parameters: Optional[Dict[str, Any]]
The device parameters.
- tags: Optional[Dict[str, str]]
The tags to add to the strangeworks job.
- Returns:
- task: StrangeworksQuantumTask
The task.
- Raises:
- StrangeworksError
If the task specification is not a circuit, or openqasm program.
Module contents¶
Strangeworks Qiskit SDK