qunicorn_core.db.models package

Submodules

qunicorn_core.db.models.db_model module

class qunicorn_core.db.models.db_model.DbModel

Bases: object

Dataclass for database model to create a table name and the id column

qunicorn_core.db.models.deployment module

class qunicorn_core.db.models.deployment.DeploymentDataclass(name, deployed_at, programs, id=None, deployed_by=None)

Bases: DbModel

Dataclass for storing deployments

Attributes:

name (str, optional): Optional name for a deployment. deployed_at (Date): Date of the creation of a deployment. programs (list): A list of quantum programs. id (int): The id of a deployment. deployed_by (str): The user_id that deployed this Deployment.

deployed_at: Mapped[datetime]
deployed_by: Mapped[str | None]
id: Mapped[int]
name: Mapped[str | None]
programs: Mapped[List[QuantumProgramDataclass]]

qunicorn_core.db.models.device module

class qunicorn_core.db.models.device.DeviceDataclass(name, num_qubits, is_simulator, is_local, provider, id=None, provider_id=None)

Bases: DbModel

Dataclass for storing CloudDevices of a provider

Attributes:

name (str): The name of the device. num_qubits (int): The amount of qubits that is available at this device. is_simulator (bool): The information whether the device is a simulator (true) or not (false). is_local (bool): The information whether jobs executed on this device are executed local or not. provider (ProviderDataclass): The provider of this device. id (int): The id of the device. provider_id (int): provider_id of the provider saved in the provider table.

id: Mapped[int]
is_local: Mapped[bool]
is_simulator: Mapped[bool]
name: Mapped[str]
num_qubits: Mapped[int]
provider: Mapped[ProviderDataclass]
provider_id: Mapped[int]

qunicorn_core.db.models.job module

class qunicorn_core.db.models.job.JobDataclass(name, results, executed_by, executed_on, deployment, progress, state, shots, type, started_at, id=None, provider_specific_id=None, celery_id=None, executed_on_id=None, deployment_id=None, finished_at=None)

Bases: DbModel

Dataclass for storing Jobs

Attributes:

name (str, optional): Optional name for a job. results (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): The device where the job is running on. deployment (DeploymentDataclass): 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. started_at (datetime, optional): The moment the job was scheduled. (default: datetime.utcnow) id (int): The id of a job. 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) executed_on_id (int, optional): The device_id of the device where the job is running on. finished_at (Optional[datetime], optional): The moment the job finished successfully or with an error. deployment_id (int, optional): A deployment_id associated with the job.

celery_id: Mapped[str | None]
deployment: Mapped[DeploymentDataclass]
deployment_id: Mapped[int]
executed_by: Mapped[str | None]
executed_on: Mapped[DeviceDataclass]
executed_on_id: Mapped[int]
finished_at: Mapped[datetime | None]
id: Mapped[int]
name: Mapped[str | None]
progress: Mapped[str]
provider_specific_id: Mapped[str | None]
results: Mapped[List[ResultDataclass] | None]
shots: Mapped[int]
started_at: Mapped[datetime]
state: Mapped[str]
type: Mapped[str]

qunicorn_core.db.models.provider module

class qunicorn_core.db.models.provider.ProviderDataclass(name, with_token, supported_languages, id=None)

Bases: DbModel

Dataclass for storing Providers

Attributes:

name (ProviderName): Name of the cloud service. with_token (bool): If authentication is needed and can be done by passing a token this attribute is true. supported_languages (list): The programming language that is supported by this provider. id (int): The id of a provider.

id: Mapped[int]
name: Mapped[str]
supported_languages: Mapped[List[ProviderAssemblerLanguageDataclass]]
with_token: Mapped[bool]

qunicorn_core.db.models.provider_assembler_language module

class qunicorn_core.db.models.provider_assembler_language.ProviderAssemblerLanguageDataclass(supported_language, id=None, provider_id=None)

Bases: DbModel

Dataclass for storing Assembler Languages

Attributes:

supported_language (str): The AssemblerLanguage (Enum) which is supported. id (int): The ID of the assembler language. provider_id (int): The ID of the provider that supports this language.

id: Mapped[int]
provider_id: Mapped[int]
supported_language: Mapped[str]

qunicorn_core.db.models.quantum_program module

class qunicorn_core.db.models.quantum_program.QuantumProgramDataclass(quantum_circuit, assembler_language, id=None, deployment_id=None, python_file_path=None, python_file_metadata=None, python_file_options=None, python_file_inputs=None)

Bases: DbModel

Dataclass for storing QuantumPrograms

Attributes:

quantum_circuit (str): Quantum code that needs to be executed. assembler_language (enum): Assembler language in which the code should be interpreted. id (int): The ID of the quantum program. deployment_id (int): The deployment where a list of quantum program is used. python_file_path (str): Part of experimental feature: path to file to be uploaded (to IBM). python_file_metadata (str): Part of experimental feature: metadata for the python_file. python_file_options (str): Part of experimental feature: options for the python_file. python_file_input (str): Part of experimental feature: inputs for the python_file.

assembler_language: Mapped[str]
deployment_id: Mapped[int]
id: Mapped[int]
python_file_inputs: Mapped[str]
python_file_metadata: Mapped[str]
python_file_options: Mapped[str]
python_file_path: Mapped[str]
quantum_circuit: Mapped[str]

qunicorn_core.db.models.result module

class qunicorn_core.db.models.result.ResultDataclass(result_dict, id=None, job_id=None, circuit=None, meta_data=None, result_type=ResultType.COUNTS)

Bases: DbModel

Dataclass for storing results of a job

Attributes:
result_dict (dict): The results of the job, in the given result_type.

For the Runner it should have the keys counts and probabilities. The counts and probabilities should be a dict with hexadecimals as quantum-bit-keys.

id (int): The ID of the result. job_id (int): The job_id that was executed. circuit (str): The circuit which was executed by the job. meta_data (dict): Some other data that was given by ibm. result_type (Enum): Result type depending on the Job_Type of the job.

circuit: Mapped[str]
id: Mapped[int]
job_id: Mapped[int]
meta_data: Mapped[dict]
result_dict: Mapped[dict]
result_type: Mapped[str]

qunicorn_core.db.models.user module

Module contents

Module containing all SQLalchemy Models.