Skip to content
Pasqal Documentation

Job

Job(**data)

Bases: BaseModel

Class for job data.

ATTRIBUTE DESCRIPTION
runs

Number of times the job should be run.

TYPE: int

batch_id

ID of the batch which the job belongs to.

TYPE: str

id

Unique identifier for the job.

TYPE: str

project_id

ID of the project which the users scheduling the job belong to.

TYPE: str

status

Status of the job. Possible values are: PENDING, RUNNING, DONE, CANCELED, TIMED_OUT, ERROR, PAUSED.

TYPE: str

_client

A Client instance to connect to PCS.

TYPE: Client

created_at

Timestamp of the creation of the job.

TYPE: str

updated_at

Timestamp of the last update of the job.

TYPE: str

errors

Error messages that occurred while processing job.

TYPE: Optional[List[str]]

start_timestamp

The timestamp of when the job began processing.

TYPE: Optional[str]

end_timestamp

The timestamp of when the job finished processing.

TYPE: Optional[str]

full_result

Dictionnary of all the results obtained after complete execution of the job. It maps the type of results (e.g. "counter", "raw") to the associated execution result.

TYPE: Optional[JobResult]

result

Bitstring counter result. Should be equal to full_results["counter"]

TYPE: Optional[Dict[str, Any]]

variables

Dictionary of variables of the job. None if the associated batch is non-parametrized.

TYPE: Optional[Dict[str, Any]]

Source code in pasqal_cloud/job.py
def __init__(self, **data: Any) -> None:
    # Workaround to make the private attribute '_client' working
    # like we need with Pydantic V2, more information on
    # https://docs.pydantic.dev/latest/concepts/models/#private-model-attributes
    super().__init__(**data)
    self._client = data["_client"]

cancel()

Cancel the current job on the PCS.

Source code in pasqal_cloud/job.py
def cancel(self) -> Dict[str, Any]:
    """Cancel the current job on the PCS."""
    try:
        job_rsp = self._client.cancel_job(self.id)
    except HTTPError as e:
        raise JobCancellingError(e) from e
    self.status = job_rsp.get("status", "CANCELED")
    return job_rsp