Running jobs

Async submit

submit() sends the circuit and returns a job handle right away without blocking. Use it when a job is slow (a cold GPU worker can take a few minutes), when you want to submit several circuits at once, or when you want to do other work while it runs.

Submit and wait

submit() returns a QXelJob immediately. Its status starts at PENDING. Call job.wait() to block until the job reaches a terminal state, then job.result() to download the result.

python
job = sim.submit(circuit, shots=256)
print(job.job_id, job.status)   # job_... PENDING

job.wait()                      # blocks until terminal
print(job.result())

Submit many, collect later

Because submit() does not block, you can launch a batch of circuits and gather their results afterward:

python
jobs = [sim.submit(c, shots=256) for c in circuits]
results = [j.wait().result() for j in jobs]

Reattach from another session

A job_id is durable. Save it and look the job up later, from a different process or machine, with get_job():

python
saved = sim.get_job("job_...")
if saved.is_done():
    print(saved.result())