qunicorn_core.db.models.job module

class qunicorn_core.db.models.job.JobDataclass(name, executed_by, executed_on, deployment, progress, state, shots, error_mitigation, type, cut_to_width=None, started_at=<factory>, provider_specific_id=None, celery_id=None, finished_at=None, results=<factory>, _transient=<factory>)

Bases: DbModel

Dataclass for storing Jobs

Attributes:

id (int): The id of a job. (set by the database) name (str, optional): Optional name for a job. results (List[ResultDataclass], optional): List of results for each quantum program that was executed. executed_by(str): A user_id associated to the job, user that wants to execute the job. executed_on (DeviceDataclass|None): The device where the job is running on. deployment (DeploymentDataclass|None): The deployment where the program is coming from. progress (float): The progress of the job. state (str): The state of a job, enum JobState. shots (int): The number of shots for the job type (JobType): The type of the job. error_mitigation (str): The type of error mitigation to apply to the circuits. cut_to_width (int | None, Optional): If a number is given, every circuit with more than that number of qubits will be cut into smaller circuits. started_at (datetime, optional): The moment the job was scheduled. (default: datetime.utcnow) provider_specific_id (str, optional): The provider specific id for the job. (Used for canceling) celery_id (str, optional): The celery id for the job. (Used for canceling) finished_at (Optional[datetime], optional): The moment the job finished successfully or with an error.

classmethod apply_authentication_filter(query: Select, user_id: str | None) Select
celery_id: Mapped[str | None]
cut_to_width: Mapped[int | None]
deployment: Mapped[DeploymentDataclass | None]
deployment_id: Mapped[int]
error_mitigation: Mapped[str]
executed_by: Mapped[str | None]
executed_on: Mapped[DeviceDataclass | None]
executed_on_id: Mapped[int]
finished_at: Mapped[datetime | None]
classmethod get_by_deployment(deployment: int | DeploymentDataclass)
classmethod get_by_deployment_authenticated(deployment: int | DeploymentDataclass, user_id: str | None)
get_transient_state(*, program: int | None = None, circuit_fragment_id: int | None = None, filter_: Callable[[TransientJobStateDataclass], bool] | None = None)
get_transient_state_key(key: str, default: Any | None = Ellipsis, *, program: int | None = None, circuit_fragment_id: int | None = None, filter_: Callable[[TransientJobStateDataclass], bool] | None = None)
id: Mapped[int]
name: Mapped[str | None]
progress: Mapped[int]
provider_specific_id: Mapped[str | None]
results: Mapped[List[ResultDataclass]]
save_error(exception: BaseException, program: QuantumProgramDataclass | None = None, extra_data: dict | None = None, extra_meta: dict | None = None)
save_results(results: List[ResultDataclass], job_state: JobState | str = JobState.FINISHED)

Update the job to include the results and commit everything to the database and delete transient state.

shots: Mapped[int]
started_at: Mapped[datetime]
state: Mapped[str]
type: Mapped[str]