Skip to main contentIBM Quantum Documentation

Maximum execution time for a Qiskit Runtime job or session

To ensure fairness and help control costs, there is a maximum amount of time each Qiskit® Runtime job and session can run. If a job exceeds this time limit, it is forcibly canceled and a RuntimeJobMaxTimeoutError exception is raised. If a session exceeds its limits, any queued jobs are canceled but any jobs that are already running are not.


Job maximum execution time

The maximum execution time for a job is the smaller of these values:

  • The value set for max_execution_time
  • The system-determined job timeout value
Note

As of 7 August 2023, the max_execution_time value is based on quantum time instead of wall clock time. Quantum time is the duration a quantum system is committed to fulfilling a user request.

Simulator jobs continue to use wall clock time because they do not have quantum time.

Set the maximum execution time (in seconds) on the job options by using one of the following methods:

# Initiate the Options class with parameters
options = Options(max_execution_time=360)
# Create the options object with attributes and values
options = {"max_execution_time": 360}

You can also find how much quantum time completed jobs have used by returning the job metrics as follows:

# Find quantum time used by the job
print(f"Quantum time used by job {job.job_id()} was {job.metrics()['usage']['quantum_seconds']} seconds")

System maximum execution time

The system calculates an appropriate job timeout value based on the input circuits and options. This system-calculated timeout is capped at 3 hours to ensure fair device usage. If a max_execution_time is also specified for the job, the lesser of the two values is used.

For example, if you specify max_execution_time=5000 (approximately 83 minutes), but the system determines it should not take more than 5 minutes (300 seconds) to execute the job, then the job is canceled after 5 minutes.


Session maximum execution time

When a session is started, it is assigned a maximum session timeout value. After this timeout is reached, the session is terminated, any jobs that are already running continue running, and any queued jobs that remain in the session are put into a failed state. For instructions to set the session maximum time, see Specify the session length.


Other limitations


Next steps

Recommendations
Was this page helpful?