Skip to main content
IBM Quantum Platform
This page is from the dev version of Qiskit Runtime client. Go to the stable version.

Executor

class Executor(mode=None, options=None)

GitHub

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 BackendV2 if you are using job mode.
    • A Session if you are using session execution mode.
    • A Batch if you are using batch execution mode.

    Refer to the Qiskit Runtime documentation for more information about the Execution modes.

  • options (ExecutorOptions) – Executor options, see ExecutorOptions for detailed description. This can be an ExecutorOptions instance or a dictionary that will be used to construct one.

Raises

  • TypeError – If options is not a valid type.
  • ValueError – If local mode is used.

Attributes

options

Type: ExecutorOptions

The options of this executor.


Methods

backend

backend()

GitHub

Return the backend the primitive query will be run on.

Return type

BackendV2

run

run(program)

GitHub

Run a quantum program.

Parameters

program (QuantumProgram) – The program to run.

Returns

A job.

Return type

RuntimeJobV2

Was this page helpful?
Report a bug, typo, or request content on GitHub.