Job lifecycle
This page follows a job from submit to result: its statuses, how to poll it, what its result looks like, how cancel works and how long the result is kept.
One job, one task
One router job is one vendor task with one hold on your balance and one charge. For a qubit circuit, eigenkit runs a 2-D
batch of weights or inputs as one router job per row and stacks the results. On Amazon Braket and IBM Quantum devices the router accepts only 1-D weights and inputs; a 2-D array answers 422 batch_not_supported. A photonic job may carry 2-D inputs: see Photonic jobs.
Submit a job
circuit(weights, inputs) sends a job and blocks until it finishes. To come back to a job later,
submit it and keep the handle. Over HTTP, POST /v1/jobs needs an Idempotency-Key header (see
Errors, retries and idempotency) and answers 202 with the new job.
The job ID is also on the Jobs page of the router web app.
The HTTP samples below read the job's ID from $JOB_ID. Set it to the id of the submit's
answer, for example JOB_ID=01a0d3c5-6d70-7894-b00c-bf5998ca19fa.
Statuses
| Status | Meaning | Terminal |
|---|---|---|
queued | Accepted; not yet running at the vendor. | no |
running | The vendor is running the task. | no |
completed | The vendor finished and the result is ready. | yes |
failed | The vendor or the router could not produce a result. error says why. | yes |
cancelled | The job was cancelled, before it reached the vendor or by the vendor. | yes |
rejected | Refused when it was submitted, before any vendor task. error says why. | yes |
billing says what happened to the funds: held, settled or released, or null when nothing was
ever held. See Balance, holds and charges. error is {code, message, category} for a
failed or rejected job and null otherwise; see Errors, retries and idempotency.
Poll a job
Poll the job until its status is terminal. There is no push channel. Back off between polls, for
example 1 second, then 5, then 30, and stay at that cap. With handle from the submit script:
handle.result() waits for the job by itself. Over HTTP, a completed job looks like this:
Code
Read the result
The result is ready as soon as the status is completed, even while the job's funds are still
held. Asking for it earlier answers 409 job_not_completed with details = {status}. With
handle from the submit script:
eigenkit returns the same shape, dtype and bit order as the same code run with your own vendor
credentials. Over HTTP the answer carries the job ID, the method, the bit order and the result,
and also execution, described below. This example omits execution:
Code
result has one of three kinds:
{"kind": "array", "dtype": "float64", "shape": [...], "data": ...}: a float64 array.datais nested as deep asshapeis long, and is a bare number whenshapeis[]. In numpy:np.asarray(data, dtype=np.float64).reshape(shape).{"kind": "counts", "n_qubits": ..., "data": {"<bitstring>": count}}: measurement counts. Every key is a string ofn_qubitszeros and ones.{"kind": "fock_counts", "n_modes": ..., "data": [{"<fock state>": count}, ...]}: the sampled Fock states of a photonic job, one object per input row. See Photonic jobs.
| Method | Result |
|---|---|
run | array of shape [n_observables]: one expectation value per observable, in request order |
zero_state_probability | array of shape []: the probability of the all-zeros state |
probabilities | array of shape [2**n_qubits], indexed in qubit0_msb order |
sample | counts |
photonic_sample | Fock-state counts |
bit_order is always qubit0_msb: in every bitstring and every basis-state index, qubit 0 is the
leftmost bit, the same order eigenkit uses locally. A sample result on two qubits:
Code
bit_order describes bitstring results: a fock_counts result has no bitstrings, and its keys list the modes from mode 0.
What the router ran
execution says what the router ran on the vendor. eigenkit returns it from
handle.execution(), from the same request as handle.result().
vendor_job_idis the IBM job ID, the Amazon Braket task ID or the Quandela Cloud job ID.- For an IBM job: the physical qubits (
initial_layout,final_layout,active_qubits), the transpiled circuit as OpenQASM 3 (transpiled_qasm3),seed_transpiler,optimization_leveland the Qiskit versions. - For a Braket job: on IQM and AQT devices also the compiled OpenQASM 3 program
(
transpiled_qasm3), on Rigetti devices the compiled Quil program (compiled_quil), and on all three the qubits the program touches (active_qubits) and the physical qubit each classical bit was measured on (final_layout). - For a photonic job every other field is null.
Every field except vendor_job_id may be null. execution itself is null for results stored
before the router recorded it.
Photonic jobs
A job on a Quandela Cloud device uses the method photonic_sample. These devices are in limited
preview (see Devices and prices). With eigenkit, a photonic circuit
runs through the router with RouterPhotonicBackend from eigenorbit-router-client 0.4.0 or
later.
circuit_speccarries a linear-optical circuit as eigenkit encodes it, andobservablesis[]. An angle expression in the circuit may nest at most 32 levels and may not exceed 1e15 in magnitude; otherwise the job answers422 circuit_invalid.inputsmay be 2-D: one row per run, all in one router job and one vendor job.weightsstays 1-D. Each device takes a limited number of rows (500 onquandela/sim_slos, 16 on the others); more answer422 batch_not_supportedwithdetails = {max_rows}.shotsis, for each run, both the number of samples asked for and the shot limit. A device that loses photons returns fewer samples than shots.- The router charges nothing for the job:
billingstays null,estimate_usd_microis 0 and the cost fields stay null. - A job that Quandela stops at its own time limit reads
failed, notcancelled.
The result has the kind fock_counts:
Code
data has one object per input row, in request order; a job with 1-D inputs has one. A key is
the photon count of every mode, mode 0 first, joined by commas. A value is the number of samples
that showed that state. A row can be {}: no shot passed the photon filter. eigenkit
normalizes the counts of each row to a distribution.
Cancel a job
With handle from the submit script:
A cancel answers 202 with the job as it is right after the request. 202 means the cancel was
requested, not that the job is or will be cancelled:
- A job that has not reached the vendor is cancelled at once. The answer already says
cancelled, and the whole hold is returned. No vendor task is created. - A job at the vendor keeps its status in the answer. The router asks the vendor to cancel the
task, and the job ends as the vendor reports. If the vendor cancels it, the job ends
cancelledand is charged what the vendor billed for it, often nothing. If the vendor finishes the task first, or does not stop a task that already runs, the job endscompletedwith its result and is charged like any completed job. The Amazon Braket simulators run a started task to the end. - A job whose hold or vendor submission is still in progress is cancelled as soon as the router knows whether a vendor task exists, then handled as one of the two cases above.
There is no cancel fee. A second cancel answers 202 again. A completed, failed or rejected
job answers 409 job_not_cancellable with details = {status}. Keep polling after a cancel: only
the terminal status says how the job ended.
Retention
A job's result and the request it was submitted with are deleted a retention period after the job
reached a terminal status, together with the vendor output the router stored for it.
result_expires_at on the job says when: today that is completed_at plus 90 days. It is null
while the job is in flight and stays set after the deletion.
- The job itself stays: its status, timestamps, error and every cost field.
- After the deletion, the result answers
410 result_expiredwithdetails = {expired_at}, the time of the deletion. Do not retry it.404 job_not_foundand409 job_not_completedcome first. - The router deletes due results every hour, so
expired_atcan be up to about an hour afterresult_expires_at. - The router's database backups keep deleted data for 14 days after each backup is taken. They are used only to restore the service, never to answer a request.
Download a result you need to keep before result_expires_at.