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

Attributes:

id (int): Automatically generated id of the database entity

qunicorn_core.db.models.deployment module

class qunicorn_core.db.models.deployment.DeploymentDataclass(id=None, deployed_by_id=None, deployed_by=None, programs=None, deployed_at=datetime.datetime(2023, 8, 27, 20, 17, 34, 314122), name=None)

Bases: DbModel

Dataclass for storing deployments

Attributes:

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

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

qunicorn_core.db.models.device module

class qunicorn_core.db.models.device.DeviceDataclass(id=None, provider_id=None, num_qubits=-1, device_name='', is_simulator=False, url=None, provider=None)

Bases: DbModel

Dataclass for storing CloudDevices of a provider

Attributes:

url (str): Rest-endpoint how to connect to the Cloud device provider: The provider of the cloud_service with the needed configurations

device_name: Mapped[str]
id: Mapped[int]
is_simulator: Mapped[bool]
num_qubits: Mapped[int]
provider: Mapped[ProviderDataclass]
provider_id: Mapped[int]
url: Mapped[str]

qunicorn_core.db.models.job module

class qunicorn_core.db.models.job.JobDataclass(id=None, results=<factory>, executed_by_id=None, executed_by=None, executed_on_id=None, executed_on=None, deployment_id=None, deployment=None, progress=None, state=None, shots=4000, type=JobType.RUNNER, started_at=datetime.datetime(2023, 8, 27, 20, 17, 34, 320038), finished_at=None, name=None, data=None, parameters=None)

Bases: DbModel

Dataclass for storing Jobs

Attributes:

name (str, optional): Optional name for a job executed_by_id (str): A user_id associated to the job, user that wants to execute the job deployment_id (int): A deployment_id associated with the job state (Optional[str], optional): The state of a job, enum JobState started_at (datetime, optional): The moment the job was scheduled.

(default utcnow())

finished_at (Optional[datetime], optional): The moment the job finished successfully or with an error. data (Union[dict, list, str, float, int, bool, None], optional): Mutable JSON-like store for additional

lightweight task data. Default value is empty dict.

results (ResultDataclass, optional): List of results for each quantum program that was executed parameters (str, optional): The parameters for the Job. Job parameters should already be prepared and error

checked before starting the task.

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

qunicorn_core.db.models.pilot module

class qunicorn_core.db.models.pilot.PilotDataclass(id=None, job_id=None, job=None, programming_language=None, state=None)

Bases: DbModel

Dataclass for storing Pilots

Attributes:

programming_language (ProgrammingLanguage): Programming language that the code should have after translation job (int): ID of the job that is executed by the pilot. state (PilotState): Represents progress and current state of pilot.

id: Mapped[int]
job: Mapped[JobDataclass]
job_id: Mapped[int]
programming_language: Mapped[str]
state: Mapped[PilotState]

qunicorn_core.db.models.provider module

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

Bases: DbModel

Dataclass for storing Providers

Attributes:

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

id: Mapped[int]
name: Mapped[str]
supported_language: Mapped[str]
with_token: Mapped[bool]

qunicorn_core.db.models.quantum_program module

class qunicorn_core.db.models.quantum_program.QuantumProgramDataclass(id=None, quantum_circuit=None, assembler_language=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 deployment_id (int): The deployment where a list of quantum program is used

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(id=None, result_dict=None, job_id=None, circuit=None, meta_data=None, result_type=ResultType.COUNTS)

Bases: DbModel

Dataclass for storing results of a job

Attributes: TODO

result_dict (dict): The results of the job, in the given result_type 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

class qunicorn_core.db.models.user.UserDataclass(id=None, name=None)

Bases: DbModel

Dataclass for storing Users

Attributes:

name (str): Name of the user.

id: Mapped[int]
name: Mapped[str | None]

Module contents

Module containing all SQLalchemy Models.