sf.api.Job

class Job(id_, status, connection, meta=None)[source]

Bases: object

Represents a remote job that can be queried for its status or result.

This object should typically not be instantiated directly, but returned by an strawberryfields.RemoteEngine or strawberryfields.api.Connection when a job is run.

Parameters
  • id_ (str) – the job ID

  • status (strawberryfields.api.JobStatus) – the job status

  • connection (strawberryfields.api.Connection) – the connection over which the job is managed

  • meta (dict[str, str]) – metadata related to job execution

id

The job ID.

meta

Returns a dictionary of metadata on job execution, such as error details.

result

Returns the Result of a completed job.

status

Returns the current job status, with possible values including "open", "queued", "cancelled", "complete", and "failed".

id

The job ID.

Return type

str

Returns

str

meta

Returns a dictionary of metadata on job execution, such as error details.

Return type

dict

Returns

dict[str, str]

result

Returns the Result of a completed job.

This is only defined for completed jobs, and raises an exception for any other status.

Return type

Result

Returns

strawberryfields.api.Result

status

Returns the current job status, with possible values including "open", "queued", "cancelled", "complete", and "failed".

Return type

str

Returns

str

cancel()

Cancels an open or queued job.

refresh()

Refreshes the status and metadata of an open or queued job, along with the job result if the job is newly completed.

cancel()[source]

Cancels an open or queued job.

Only an open or queued job can be cancelled; an exception is raised otherwise.

refresh()[source]

Refreshes the status and metadata of an open or queued job, along with the job result if the job is newly completed.