general_superstaq.job

Represents a job created via the Superstaq API.

Classes

Job

A job created on the Superstaq API.

Module Contents

class general_superstaq.job.Job(client: general_superstaq.superstaq_client._SuperstaqClientV3, job_id: uuid.UUID | str)

A job created on the Superstaq API.

Note that this is mutable, when calls to get status or results are made the job updates itself If a job is canceled or deleted, only the job id and the status remain valid.

cancel(**kwargs: object) None

Cancel the current job if it is not in a terminal state.

Parameters:
  • index – An optional index of the specific sub-job to cancel.

  • kwargs – Extra options needed to fetch jobs.

Raises:
  • SuperstaqServerException – If unable to get the status of the job from the API or

  • cancellations were unsuccessful.

job_id() uuid.UUID

Gets the job id of this job.

This is the unique identifier used for identifying the job by the API.

Returns:

This job’s id (a string).

target() str

Gets the Superstaq target associated with this job.

Returns:

The target to which this job was submitted.

Raises:

SuperstaqServerException – If unable to get the job from the API.

to_dict() dict[str, general_superstaq.typing.Job]

Refreshes and returns job information.

Note

The contents of this dictionary are not guaranteed to be consistent over time. Whenever possible, users should use the specific Job methods to retrieve the desired job information instead of relying on particular entries in the output of this method.

Returns:

A dictionary containing updated job information.

wait_until_complete(index: int | None = None, timeout_seconds: float | None = None, polling_seconds: float = 5) None

Waits until either the job is done or some error in the job occurs.

Parameters:
  • index – An optional index of the specific circuit to wait for (otherwise waits for all circuits to complete).

  • timeout_seconds – The total number of seconds to poll for.

  • polling_seconds – The interval with which to poll.

STATUS_PRIORITY_ORDER
property job_data: general_superstaq.models.JobData
property metadata: dict[str, object]

Any metadata passed when creating this job.

property tags: list[str]

All tags associated with this job.