Quantum Machine Manager API¶
qm.quantum_machines_manager.QuantumMachinesManager
¶
PARAMETER | DESCRIPTION |
---|---|
host
|
Host where to find the QM orchestrator. If
TYPE:
|
port
|
Port where to find the QM orchestrator. If None, local settings are used.
TYPE:
|
cluster_name
|
The name of the cluster, requires redirection between devices.
TYPE:
|
timeout
|
The timeout, in seconds, for detecting the qmm. Default is 60.
TYPE:
|
log_level
|
The logging level for the connection instance. Defaults to
TYPE:
|
octave
|
The configuration for the Octave devices. Deprecated from QOP 2.4.0.
TYPE:
|
octave_calibration_db_path
|
The path for storing the Octave's calibration database. It can also be a calibration database which is an instance of
TYPE:
|
follow_gateway_redirections
|
If True (default), the client will follow redirections to find a QuantumMachinesManager and Octaves. Otherwise, it will only connect to the given host and port.
TYPE:
|
async_follow_redirects
|
If False (default), async httpx will not follow redirections, relevant only in case follow_gateway_redirections is True.
TYPE:
|
async_trust_env
|
If True (default), async httpx will read the environment variables for settings as proxy settings, relevant only in case follow_gateway_redirections is True.
TYPE:
|
clear_all_job_results
¶
Deletes all data from all previous jobs
close_all_qms
¶
Closes ALL open quantum machines
get_controllers
¶
Returns a list of all the controllers that are available
get_job
¶
-- Available in QOP 3.x --
Get a job based on the job_id.
PARAMETER | DESCRIPTION |
---|---|
job_id
|
A list of jobs ids
TYPE:
|
Returns: The job
get_job_result_handles
¶
-- Available in QOP 2.x --
Returns the result handles for a job. Args: job_id: The job id Returns: The handles that this job generated
get_jobs
¶
-- Available in QOP 3.x --
Get jobs based on filtering criteria. All fields are optional.
PARAMETER | DESCRIPTION |
---|---|
qm_ids
|
A list of qm ids
TYPE:
|
job_ids
|
A list of jobs ids
TYPE:
|
user_ids
|
A list of user ids
TYPE:
|
description
|
Jobs' description
TYPE:
|
status
|
A list of job statuses
TYPE:
|
Returns: A list of jobs
get_qm
¶
Gets an open quantum machine object with the given machine id
PARAMETER | DESCRIPTION |
---|---|
machine_id
|
The id of the open quantum machine to get
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Union[QuantumMachine, QmApi]
|
A quantum machine obj that can be used to execute programs |
list_open_qms
¶
Return a list of open quantum machines. (Returns only the ids, use get_qm(...)
to get the machine object)
RETURNS | DESCRIPTION |
---|---|
List[str]
|
The ids list |
open_qm
¶
Opens a new quantum machine. A quantum machine can use multiple OPXes, and a single OPX can also be used by multiple quantum machines as long as they do not share the same physical resources (input/output ports) as defined in the config.
PARAMETER | DESCRIPTION |
---|---|
config
|
The config that will be used by the quantum machine
TYPE:
|
close_other_machines
|
When set to true (default) any open quantum machines will be closed. This simplifies the workflow, but does not enable opening more than one quantum machine.
TYPE:
|
validate_with_protobuf
|
Validates config with protobuf instead of marshmallow. It is usually faster when working with large configs. Defaults to False.
TYPE:
|
add_calibration_elements_to_config
|
Automatically adds config entries to allow Octave calibration.
TYPE:
|
use_calibration_data
|
Automatically load updated calibration data from calibration database into the config.
TYPE:
|
keep_dc_offsets_when_closing
|
Available in QOP 2.4.2 - When closing the QM, do not change the DC offsets.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Union[QuantumMachine, QmApi]
|
A quantum machine obj that can be used to execute programs |
open_qm_from_file
¶
Opens a new quantum machine with config taken from a file on the local file system
PARAMETER | DESCRIPTION |
---|---|
filename
|
The path to the file that contains the config
TYPE:
|
close_other_machines
|
Flag whether to close all other running machines
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Union[QuantumMachine, QmApi]
|
A quantum machine obj that can be used to execute programs |
perform_healthcheck
¶
Perform a health check against the QM server.
PARAMETER | DESCRIPTION |
---|---|
strict
|
Will raise an exception if health check failed
TYPE:
|
reset_data_processing
¶
Stops current data processing for ALL running jobs
set_capabilities_offline
staticmethod
¶
Some modules of the sdk cannot be run without the capabilities of the QOP server, which is automatically set when connecting to the server via QuantumMachinesManager (in "_initialize_connection"). This function provides an alternative to connecting to a QOP server via QuantumMachinesManager, by setting the capabilities manually and globally.
It is possible to extract the capabilities of an existing QuantumMachinesManager object by checking the capabilities attribute.
e.g. qmm = QuantumMachinesManager(); capabilities = qmm.capabilities
.
The QopCaps class (from qm import QopCaps
) can be used to get and view all capabilities.
Warning: Setting the capabilities when there is an open QuantumMachinesManager will override them and can cause unexpected behavior.
PARAMETER | DESCRIPTION |
---|---|
capabilities
|
A set of capabilities (or a ServerCapabilities object) to create the container with. If None, all capabilities are set. Warning: Using all capabilities might not produce the expected behavior.
TYPE:
|
simulate
¶
Simulate the outputs of a deterministic QUA program.
The following example shows a simple execution of the simulator, where the associated config object is omitted for brevity.
Example
Args:
config: A QM config
program: A QUA program()
object to execute
simulate: A SimulationConfig
configuration object
compiler_options: additional parameters to pass to execute
strict: a deprecated option for the compiler
flags: deprecated way to provide flags to the compiler
RETURNS | DESCRIPTION |
---|---|
Union[SimulatedJob, SimulatedJobApi]
|
a |
validate_qua_config
¶
Validates a qua config based on the connected server's capabilities. Raises an exception if the config is invalid.
PARAMETER | DESCRIPTION |
---|---|
qua_config
|
A python dict containing the qua config to validate
TYPE:
|
version
¶
RETURNS | DESCRIPTION |
---|---|
Union[Version, DevicesVersion]
|
An object with the qm-qua and QOP versions |
version_dict
¶
RETURNS | DESCRIPTION |
---|---|
Version
|
A dictionary with the qm-qua and QOP versions |