execute

qnexus.execute(
programs: CircuitRef | HUGRRef | QIRRef | list[CircuitRef | HUGRRef | QIRRef],
n_shots: list[int] | list[None],
backend_config: Annotated[AerConfig | AerStateConfig | AerUnitaryConfig | BraketConfig | QuantinuumConfig | IBMQConfig | IBMQEmulatorConfig | QulacsConfig | SeleneConfig | SelenePlusConfig | HeliosConfig, FieldInfo(annotation=NoneType, required=True, discriminator='type')],
name: str,
description: str = '',
properties: OrderedDict[str, bool | int | float | str] | None = None,
project: ProjectRef | None = None,
valid_check: bool = True,
wasm_module: WasmModuleRef | None = None,
gpu_decoder_config: GpuDecoderConfigRef | None = None,
language: Language = Language.AUTO,
credential_name: str | None = None,
user_group: str | None = None,
target_region: Literal['us', 'sg'] | None = None,
timeout: float | None = 300.0,
max_cost: float | list[float] | list[None] = [],
n_qubits: int | list[int] | list[None] = [],
) list[QsysResult | BackendResult | QIRResult][source]

Utility method to run an execute job and return the results. Blocks until the results are available. See qnexus.start_execute_job for a function that submits the job and returns immediately, rather than waiting for results.

Examples

>>> import qnexus as qnx
>>> results = qnx.execute(
...     programs=[compiled_circuit_ref],
...     n_shots=[100],
...     backend_config=qnx.models.QuantinuumConfig(device_name="H2-1LE"),
...     name="my_execute_job",
...     project=project_ref,
... )
qnexus.start_execute_job(
programs: CircuitRef | HUGRRef | QIRRef | list[CircuitRef | HUGRRef | QIRRef],
n_shots: int | list[int] | list[None],
backend_config: Annotated[AerConfig | AerStateConfig | AerUnitaryConfig | BraketConfig | QuantinuumConfig | IBMQConfig | IBMQEmulatorConfig | QulacsConfig | SeleneConfig | SelenePlusConfig | HeliosConfig, FieldInfo(annotation=NoneType, required=True, discriminator='type')],
name: str,
description: str = '',
properties: OrderedDict[str, bool | int | float | str] | None = None,
project: ProjectRef | None = None,
valid_check: bool = True,
language: Language = Language.AUTO,
credential_name: str | None = None,
wasm_module: WasmModuleRef | None = None,
gpu_decoder_config: GpuDecoderConfigRef | None = None,
user_group: str | None = None,
target_region: Literal['us', 'sg'] | None = None,
max_cost: float | list[float] | list[None] = [],
n_qubits: int | list[int] | list[None] = [],
) ExecuteJobRef[source]

Submit an execute job to be run in Nexus. Returns an ExecuteJobRef object which can be used to check the job’s status. See qnexus.execute for a utility method that waits for the results and returns them.

Examples

>>> import qnexus as qnx
>>> execute_job_ref = qnx.jobs.execute(
...     programs=hugr_ref,
...     n_shots=1000,
...     backend_config=qnx.models.HeliosConfig(system_name="Helios-1"),
...     name="my-execute-job",
...     max_cost=10.0,
... )