Job Class

Azure Quantum Job that is submitted to a given Workspace.

Constructor

Job(workspace: Workspace, job_details: JobDetails, **kwargs)

Parameters

Name Description
workspace
Required

Workspace instance to submit job to

job_details
Required

Job details model, contains Job ID, name and other details

Methods

get_results

Get job results by downloading the results blob from the storage container linked via the workspace.

Raises RuntimeError if job execution fails.

Raises ValueError if job output is malformed or output format is not compatible.

Raises JobFailedWithResultsError if job execution fails, but failure results could still be retrieved.

get_results_histogram

Get job results histogram by downloading the results blob from the storage container linked via the workspace.

Raises RuntimeError if job execution fails.

Raises ValueError if job output is malformed or output format is not compatible.

Raises JobFailedWithResultsError if job execution fails, but failure results could still be retrieved (e.g. for jobs submitted against "microsoft.dft" target).

get_results_shots

Get job results per shot data by downloading the results blob from the storage container linked via the workspace.

Raises RuntimeError if job execution fails.

Raises ValueError if job output is malformed or output format is not compatible.

Raises JobFailedWithResultsError if job execution fails, but failure results could still be retrieved.

has_completed

Check if the job has completed.

has_succeeded

Check if the job has succeeded.

refresh

Refreshes the Job's details by querying the workspace.

submit

Submit a job to Azure Quantum.

wait_until_completed

Keeps refreshing the Job's details until it reaches a finished status.

get_results

Get job results by downloading the results blob from the storage container linked via the workspace.

Raises RuntimeError if job execution fails.

Raises ValueError if job output is malformed or output format is not compatible.

Raises JobFailedWithResultsError if job execution fails, but failure results could still be retrieved.

get_results(timeout_secs: float = 300)

Parameters

Name Description
timeout_secs

Timeout in seconds, defaults to 300

Default value: 300

Returns

Type Description
Any

Results dictionary with histogram shots, or raw results if not a json object.

get_results_histogram

Get job results histogram by downloading the results blob from the storage container linked via the workspace.

Raises RuntimeError if job execution fails.

Raises ValueError if job output is malformed or output format is not compatible.

Raises JobFailedWithResultsError if job execution fails, but failure results could still be retrieved (e.g. for jobs submitted against "microsoft.dft" target).

get_results_histogram(timeout_secs: float = 300)

Parameters

Name Description
timeout_secs

Timeout in seconds, defaults to 300

Default value: 300

Returns

Type Description
Any

Results dictionary with histogram shots, or raw results if not a json object.

get_results_shots

Get job results per shot data by downloading the results blob from the storage container linked via the workspace.

Raises RuntimeError if job execution fails.

Raises ValueError if job output is malformed or output format is not compatible.

Raises JobFailedWithResultsError if job execution fails, but failure results could still be retrieved.

get_results_shots(timeout_secs: float = 300)

Parameters

Name Description
timeout_secs

Timeout in seconds, defaults to 300

Default value: 300

Returns

Type Description
Any

Results dictionary with histogram shots, or raw results if not a json object.

has_completed

Check if the job has completed.

has_completed() -> bool

has_succeeded

Check if the job has succeeded.

has_succeeded() -> bool

refresh

Refreshes the Job's details by querying the workspace.

refresh()

submit

Submit a job to Azure Quantum.

submit()

wait_until_completed

Keeps refreshing the Job's details until it reaches a finished status.

wait_until_completed(max_poll_wait_secs=30, timeout_secs=None, print_progress=True) -> None

Parameters

Name Description
max_poll_wait_secs
int

Maximum poll wait time, defaults to 30

Default value: 30
timeout_secs
int

Timeout in seconds, defaults to None

Default value: None
print_progress

Print "." to stdout to display progress

Default value: True

Exceptions

Type Description

If the total poll time exceeds timeout, raise.