Executor
class Executor(mode=None, options=None)
Bases: object
Class for running QuantumProgram\s.
The run() method can be used to submit a quantum program to be executed on a backend.
from qiskit_ibm_runtime import QiskitRuntimeService, Executor, QuantumProgram
service = QiskitRuntimeService()
backend = service.backend("ibm_boston")
program = QuantumProgram(shots=100)
... # add program contents
executor = Executor(backend)
executor.options.environment.job_tags = ["my_tag"]
job = executor.run(program)Parameters
-
mode (BackendV2 | Session |Batch | None) –
The execution mode used to make the query. It can be:
- A
BackendV2if you are using job mode. - A
Sessionif you are using session execution mode. - A
Batchif you are using batch execution mode.
Refer to the IBM Quantum Compute documentation for more information about the
Execution modes. - A
-
options (ExecutorOptions) – Executor options, see
ExecutorOptionsfor detailed description. This can be anExecutorOptionsinstance or a dictionary that will be used to construct one.
Raises
TypeError – If options is not a valid type.
Attributes
mode
Return the execution mode used by this primitive.
Returns
Mode used by this primitive, or None if an execution mode is not used.
options
Type: ExecutorOptions
The options of this executor.
Methods
backend
run
run(program, dry_run=False)
Run a quantum program.
Parameters
- program (QuantumProgram) – The program to run.
- dry_run (bool) – If
True, performs a dry run without executing the job on a QPU. This mode can be used to validate the job, estimate usage consumption, and retrieve circuit timing metadata. Returned results preserve the expected schema but contain randomized mock data rather than actual or simulated measurement results. Unlike the fake backends, the processing of this dry run happens on the server-side, so the job may not finish immediately and access to this feature may be restricted.
Returns
A job.
Return type
RuntimeJobV2 | LocalRuntimeJob