qunicorn_core.core.pilotmanager.base_pilot module

class qunicorn_core.core.pilotmanager.base_pilot.Pilot

Bases: object

Base class for Pilots

cancel(job_id: int | None, user_id: str | None, token: str | None = None)

Cancel the execution of a job, locally or if that is not possible at the backend

cancel_provider_specific(job: JobDataclass, token: str | None = None)

Cancel execution of a job at the corresponding backend

create_default_job_with_circuit_and_device(device: DeviceDataclass, circuit: str, assembler_language: str | None = None) JobDataclass

Method to create a default job for a pilot with one given circuit and device. This method always takes the first supported Language of the pilot and assigns it to the program. The Deployment and Job Name will be generated from the ProviderName and SupportedLanguage of the Pilot.

determine_db_job_progress(db_job: JobDataclass) int
determine_db_job_state(db_job: JobDataclass) JobState
execute(jobs: Sequence[PilotJob], token: str | None = None)

Execute a job on a backend using a Pilot

execute_provider_specific(jobs: Sequence[PilotJob], job_type: str, token: str | None = None)

Execute a job of a provider specific type on a backend using a Pilot

get_device_data_from_provider(device: DeviceDataclass | DeviceDto, token: str | None) dict

Get device data for a specific device from the provider

get_standard_devices() Tuple[list[DeviceDataclass], DeviceDataclass]

Get all devices from the provider

get_standard_job_with_deployment(device: DeviceDataclass) JobDataclass

Create the standard ProviderDataclass Object for the pilot and return it

get_standard_provider() ProviderDataclass

Create the standard ProviderDataclass Object for the pilot and return it

has_same_provider(provider_name: str) bool

Check if the provider name is the same as the pilot provider name

is_device_available(device: DeviceDataclass | DeviceDto, token: str | None) bool

Check if a device is available for a user

provider_name: str
static qubit_binary_string_to_hex(qubits_in_binary: dict, reverse_qubit_order: bool = False) dict

To make sure that the qubits in the counts or probabilities are in hex format with registers and not in binary string format with registers

@param qubits_in_binary: example: { “010 1”: 1234 } @param reverse_qubit_order: whether to reverse the order of the qubits @return: example: { “0x2 0x1”: 1234 }

static qubit_hex_string_to_binary(qubits_in_hex: dict, registers: List[int], reverse_qubit_order: bool = False) dict

To make sure that the qubits in the counts or probabilities are in binary format with registers and not in hex string format without registers

@param qubits_in_hex: example: { “0x5”: 1234 } @param registers: size of the registers, example: [3, 1] @param reverse_qubit_order: whether to reverse the order of the qubits in the individual registers @return: example: { “010 1”: 1234 }

static qubits_integer_to_hex(qubits_as_integers: dict) dict

To make sure that the qubits in the counts or probabilities are in hex string format and not in decimal integer format.

@param qubits_as_integers: example: { 3: 1234 } @return: example: { “0x3”: 1234 }

run(jobs: Sequence[PilotJob], token: str | None = None)

Run a job of type RUNNER on a backend using a Pilot

save_devices_from_provider(token: str | None)

Access the devices from the cloud service of the provider, to update the current device list of qunicorn

save_results(job: PilotJob, results: Sequence[PilotJobResult], commit: bool = False)
supported_languages: Sequence[str]
class qunicorn_core.core.pilotmanager.base_pilot.PilotJob(circuit, job, program, circuit_fragment_id)

Bases: NamedTuple

circuit: Any

Alias for field number 0

circuit_fragment_id: int | None

Alias for field number 3

job: JobDataclass

Alias for field number 1

program: QuantumProgramDataclass

Alias for field number 2

class qunicorn_core.core.pilotmanager.base_pilot.PilotJobResult(data, meta, result_type)

Bases: NamedTuple

data: Any

Alias for field number 0

meta: Dict[str, Any]

Alias for field number 1

result_type: ResultType

Alias for field number 2