Skip to content

QM Job Queue API

qm.jobs.job_queue.QmQueue

count: int property

Get the number of jobs currently on the queue

RETURNS DESCRIPTION
int

The number of jobs in the queue

Example
qm.queue.count

pending_jobs: List[QmPendingJob] property

Returns all currently pending jobs

RETURNS DESCRIPTION
List[QmPendingJob]

A list of all of the currently pending jobs

add

Adds a QmJob to the queue. Programs in the queue will play as soon as possible.

PARAMETER DESCRIPTION
program

A QUA program

TYPE: Program

compiler_options

Optional arguments for compilation

TYPE: Optional[CompilerOptionArguments] DEFAULT: None

Example
qm.queue.add(program)  # adds at the end of the queue
qm.queue.insert(program, position)  # adds at position

add_compiled

Adds a compiled QUA program to the end of the queue, optionally overriding the values of analog waveforms defined in the program. Programs in the queue will play as soon as possible. For a detailed explanation see Precompile Jobs.

PARAMETER DESCRIPTION
program_id

A QUA program ID returned from the compile function

TYPE: str

overrides

Object containing Waveforms to run the program with

TYPE: Optional[ExecutionOverridesType] DEFAULT: None

Example
program_id = qm.compile(...)
pending_job = qm.queue.add_compiled(program_id, overrides={
    'waveforms': {
        'my_arbitrary_waveform': [0.1, 0.2, 0.3],
        'my_constant_waveform': 0.2
    }
})
job = pending_job.wait_for_execution()

add_to_start

Adds a QMJob to the start of the queue. Programs in the queue will play as soon as possible.

PARAMETER DESCRIPTION
program

A QUA program

TYPE: Program

compiler_options

Optional arguments for compilation

TYPE: Optional[CompilerOptionArguments] DEFAULT: None

clear

Empties the queue from all pending jobs

RETURNS DESCRIPTION
int

The number of jobs removed

get

Get a pending job object by job_id

PARAMETER DESCRIPTION
job_id

a QMJob id

TYPE: str

RETURNS DESCRIPTION
QmPendingJob

The pending job

Example
qm.queue.get(job_id)

get_at

Gets the pending job object at the given position in the queue

PARAMETER DESCRIPTION
position

An integer position in queue

TYPE: int

RETURNS DESCRIPTION
QmPendingJob

The pending job

Example
qm.queue.get(job_id)

remove_by_id

Removes the pending job object with a specific job id

PARAMETER DESCRIPTION
job_id

a QMJob id

TYPE: str

RETURNS DESCRIPTION
int

The number of jobs removed

Example
qm.queue.remove_by_id(job_id)

remove_by_position

Remove the PendingQmJob object by position in queue

PARAMETER DESCRIPTION
position

position in queue

TYPE: int

RETURNS DESCRIPTION
int

The number of jobs removed

Example

python qm.queue.remove_by_position(position)python