nexus_worker

Module Contents

Functions

upload_circuit

Wrapper around qnx.circuits.upload.

start_execute_job

Wrapper around qnx.start_execute_job.

is_running

Wrapper around qnx.jobs.status.

get_results

Wrapper around qnx.results and qnx.download_result.

check_status

submit

main

Data

API

nexus_worker.logger = 'getLogger(...)'
nexus_worker.worker = 'Worker(...)'
nexus_worker.upload_circuit(project_name: str, circ: pytket._tket.circuit.Circuit) qnexus.models.references.ExecutionProgram

Wrapper around qnx.circuits.upload.

Parameters:
  • project_name (str) – The name of the nexus project to upload the circuit to.

  • circ (Circuit) – The circuit to upload.

Returns:

A reference to the uploaded circuit.

Return type:

ExecutionProgram

nexus_worker.start_execute_job(project_name: str, job_name: str, circuits: list[qnexus.models.references.ExecutionProgram], n_shots: list[int], backend_config: qnexus.BackendConfig) qnexus.models.references.ExecuteJobRef

Wrapper around qnx.start_execute_job.

Parameters:
  • project_name (str) – The name of the nexus project to start the job in.

  • job_name (str) – The name of the job to start.

  • circuits (list[ExecutionProgram]) – The circuits to execute.

  • n_shots (list[int]) – The number of shots for each circuit.

  • backend_config (BackendConfig) – The backend configuration to use.

Returns:

A reference to the started execution job.

Return type:

ExecuteJobRef

nexus_worker.is_running(execute_ref: qnexus.models.references.ExecuteJobRef) bool

Wrapper around qnx.jobs.status.

Parameters:

execute_ref (ExecuteJobRef) – The reference to the execution job.

Raises:

TierkreisError – If the job was cancelled or errored.

Returns:

True if the job is still running, False otherwise.

Return type:

bool

nexus_worker.get_results(execute_ref: qnexus.models.references.ExecuteJobRef) list[pytket.backends.backendresult.BackendResult]

Wrapper around qnx.results and qnx.download_result.

Parameters:

execute_ref (ExecuteJobRef) – The reference to the execution job.

Returns:

A list of backend results for each circuit in the job.

Return type:

list[BackendResult]

nexus_worker.check_status(execute_ref: qnexus.models.references.ExecuteJobRef) str
nexus_worker.submit(circuits: list[pytket._tket.circuit.Circuit], n_shots: int) qnexus.models.references.ExecuteJobRef
nexus_worker.main()