Sdílet prostřednictvím


Job Class

Azure Quantum Job that is submitted to a given Workspace.

Inheritance
azure.quantum.job.base_job.BaseJob
Job
azure.quantum.job.filtered_job.FilteredJob
Job

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 JobFailedWithResultsError if job execution fails, but failure results could still be retrieved (e.g. for jobs submitted against "microsoft.dft" target).

has_completed

Check if the job has completed.

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 JobFailedWithResultsError if job execution fails, but failure results could still be retrieved (e.g. for jobs submitted against "microsoft.dft" target).

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.

has_completed

Check if the job has completed.

has_completed() -> 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.