Batch
Batch(**data)
Bases: BaseModel
Class to load batch data return by the API.
A batch groups up several jobs with the same sequence. When a batch is assigned to a QPU, all its jobs are run sequentially and no other batch can be assigned to the device until all its jobs are done and declared complete.
ATTRIBUTE | DESCRIPTION |
---|---|
open |
Whether the batch accepts more jobs or not.
TYPE:
|
complete |
Opposite of open, deprecated.
TYPE:
|
created_at |
Timestamp of the creation of the batch.
TYPE:
|
updated_at |
Timestamp of the last update of the batch.
TYPE:
|
device_type |
Type of device to run the batch on.
TYPE:
|
project_id |
ID of the owner project of the batch.
TYPE:
|
id |
Unique identifier for the batch.
TYPE:
|
user_id |
Unique identifier of the user that created the batch.
TYPE:
|
status |
Status of the batch. Possible values are: PENDING, RUNNING, DONE, CANCELED, TIMED_OUT, ERROR, PAUSED.
TYPE:
|
webhook |
Webhook where the job results are automatically sent to.
TYPE:
|
_client |
A Client instance to connect to PCS.
TYPE:
|
sequence_builder |
Pulser sequence of the batch.
TYPE:
|
start_datetime |
Timestamp of the time the batch was sent to the QPU.
TYPE:
|
end_datetime |
Timestamp of when the batch process was finished.
TYPE:
|
device_status |
Status of the device where the batch is running.
TYPE:
|
jobs |
Dictionary of all the jobs added to the batch.
TYPE:
|
ordered_jobs |
List of all the jobs added to the batch, ordered by creation time.
TYPE:
|
jobs_count |
Number of jobs added to the batch.
TYPE:
|
jobs_count_per_status |
Number of jobs per status.
TYPE:
|
configuration |
Further configuration for certain emulators.
TYPE:
|
Source code in pasqal_cloud/batch.py
jobs
property
writable
Once the 'ordered_jobs' is built, we need to keep the 'jobs' attribute for backward compatibility with the code written by the users of the sdk
add_jobs(jobs, wait=False)
Add some jobs to batch for execution on PCS and returns the updated batch.
The batch must be open
otherwise the API will return an error.
The new jobs are appended to the ordered_jobs
list attribute.
PARAMETER | DESCRIPTION |
---|---|
jobs
|
List of jobs to be added to the batch.
TYPE:
|
wait
|
If True, blocks until all jobs in the batch are done.
TYPE:
|
Source code in pasqal_cloud/batch.py
cancel()
Cancel the current batch on the PCS.
close(wait=False, fetch_results=False)
Declare to PCS that the batch is closed and returns an updated batch instance.
PARAMETER | DESCRIPTION |
---|---|
wait
|
Whether to wait for the batch to be done and fetch results.
TYPE:
|
fetch_results
|
Whether to wait for the batch to be done and fetch results.
TYPE:
|
A batch that is closed awaits no extra jobs. All jobs previously added will be executed before the batch is terminated. When all its jobs are done, the closed batch is unassigned to its running device.
Source code in pasqal_cloud/batch.py
declare_complete(wait=False, fetch_results=False)
Deprecated, use close instead.
Source code in pasqal_cloud/batch.py
refresh()
Fetch the batch from the API and update it in place.
retry(job, wait=False)
Retry a job in the same batch.
The batch should not be 'closed'.
The new job is appended to the ordered_jobs
list attribute.
PARAMETER | DESCRIPTION |
---|---|
job
|
The job to retry
TYPE:
|
wait
|
Whether to wait for job completion
TYPE:
|
RAISES | DESCRIPTION |
---|---|
JobRetryError
|
if there was an error adding the job to the batch. |