Job#

class qiskit_calculquebec.API.job.Job(circuit: QuantumCircuit, shots: int = 1)#

Bases: object

Wrapper for submitting a single circuit to the MonarQ/Thunderhead API.

Converts the circuit to dictionary format, posts the job, polls for completion, and returns the result histogram.

Parameters:
  • circuit (QuantumCircuit) – The circuit to execute.

  • shots (int) – Number of shots. Default: 1.

raise_api_error(response)

Parse an API error response and raise a JobException.

run([max_tries])

Submit the job and block until it succeeds, then return the histogram.

run_getID()

Submit the job and return its ID without waiting for completion.

raise_api_error(response)#

Parse an API error response and raise a JobException.

Parameters:

response (requests.Response) – The failed HTTP response.

Raises:

JobException – Always raised with the parsed error code and message.

run(max_tries: int = -1) dict#

Submit the job and block until it succeeds, then return the histogram.

Polls the API every 200 ms. The job is considered done when its status is "SUCCEEDED".

Parameters:

max_tries (int) – Maximum number of polling iterations. -1 means effectively unlimited (2¹⁵ attempts). Default: -1.

Returns:

Result histogram mapping bitstrings to shot counts.

Return type:

dict

Raises:

JobException – If the job does not complete within max_tries iterations, or if submission fails.

run_getID() str#

Submit the job and return its ID without waiting for completion.

Returns:

The job ID assigned by the scheduler.

Return type:

str

Raises:

JobException – If submission fails or the response is not 200.