IQMServerClientJob#

Module: iqm.iqm_server_client.iqm_server_client

class iqm.iqm_server_client.iqm_server_client.IQMServerClientJob(data: JobData)#

Bases: ABC

ABC for classes representing an IQMServerClient job.

Attributes

job_id

Unique ID of the job.

status

Last queried status of the job.

data

Light job-related data.

Methods

cancel

Cancel the job.

find_timeline_entry

Search the timeline for an entry matching the given criteria.

update

Update the job data by querying the server.

wait_for_completion

Poll the server updating the job status, until the job reaches a terminal state, or until we hit a timeout.

Parameters:

data (JobData)

data: JobData#

Light job-related data.

Experimental, should be considered private for now.

property job_id: UUID#

Unique ID of the job.

property status: JobStatus#

Last queried status of the job.

Note that this is not necessarily the same as the current status of the job, unless the status is terminal.

To get the current status, use update().

update() JobStatus#

Update the job data by querying the server.

Modifies self.

Returns:

Current status of the job.

Return type:

JobStatus

cancel() None#

Cancel the job.

See _IQMServerClient.cancel_job().

Return type:

None

wait_for_completion(*, timeout_secs: float = 10800.0) JobStatus#

Poll the server updating the job status, until the job reaches a terminal state, or until we hit a timeout.

The terminal states are “completed”, “failed”, and “cancelled”.

Will stop the polling (but does not cancel the job) upon receiving a KeyboardInterrupt (Ctrl-C). If you want to cancel the job, call cancel().

Modifies self.

Parameters:

timeout_secs (float) – If nonzero, stop polling after this many seconds and return the non-terminal status.

Returns:

Last seen job status.

Raises:

KeyboardInterrupt – Received Ctrl-C while waiting for the job to finish.

Return type:

JobStatus

find_timeline_entry(status: str, source: Literal['iqm-server', 'iqm-station-control'] | str | None = None) TimelineEntry | None#

Search the timeline for an entry matching the given criteria.

Parameters:
  • status (str) – Status of the searched timeline entry.

  • source (Literal['iqm-server', 'iqm-station-control'] | str | None) – Source of the searched timeline entry. If None, accepts any source.

Returns:

The first matching entry or None if the job timeline does not have any matching entries.

Return type:

TimelineEntry | None

Inheritance

Inheritance diagram of iqm.iqm_server_client.iqm_server_client.IQMServerClientJob