mqt.qudits.simulation.jobs.job¶

Module Contents¶

class Job(backend: Backend | None, job_id: str = 'auto', **kwargs)[source]¶

Class to handle jobs

This first version of the Backend abstract class is written to be mostly backwards compatible with the legacy providers interface. This was done to ease the transition for users and provider maintainers to the new versioned providers. Expect future versions of this abstract class to change the data model and interface.

version = 1¶
job_id() str[source]¶

Return a unique id identifying the job.

backend() Backend[source]¶

Return the backend where this job was executed.

done() bool[source]¶

Return whether the job has successfully run.

running() bool[source]¶

Return whether the job is actively running.

cancelled() bool[source]¶

Return whether the job has been cancelled.

in_final_state() bool[source]¶

Return whether the job is in a final job state such as DONE or ERROR.

wait_for_final_state(timeout: float | None = None, wait: float = 5, callback: Callable | None = None) None[source]¶

Poll the job status until it progresses to a final state such as DONE or ERROR.

Parameters:
  • timeout – Seconds to wait for the job. If None, wait indefinitely.

  • wait – Seconds between queries.

  • callback – Callback function invoked after each query.

Raises:

JobTimeoutError – If the job does not reach a final state before the specified timeout.

abstract submit() NoReturn[source]¶

Submit the job to the backend for execution.

result()[source]¶

Return the results of the job.

set_result(result) None[source]¶
abstract cancel() NoReturn[source]¶

Attempt to cancel the job.

abstract status() str[source]¶

Return the status of the job, among the values of BackendStatus.