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:
DbModelDataclass 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.
- deployment: Mapped[DeploymentDataclass | None]
- executed_on: Mapped[DeviceDataclass | 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)
- 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.