qiskit-ibm-runtime
qiskit-ibm-runtime copied to clipboard
Handling new API errors when submitting a new job
What is the expected feature or enhancement?
When submitting a new job, the API could return the next two new errors:
- #4317: You have exceeded your monthly quota.
- #3458: You have reached the maximum number of pending jobs, so you need to wait for one job to move from pending before submitting a new one.
@jyu00 has mentioned that for 3458
the deprecated Qiskit provider already contained logic to handle it, displaying the warning/info message to the user while waiting for a job to complete to proceed with the submission.
The API has new endpoints to retrieve usage in https://api.quantum-computing.ibm.com/runtime/usage which returns per instance the quota, usage and number of pending jobs, it will eventually also add the max number of pending jobs for the instance (in progress). It also contains the start and end periods for the quota.
Acceptance criteria
When submitting a new job:
- If I have exceeded my monthly quota, it will show an error which should display information on how much I have consumed, what my quota was and when my quota will reset.
- If I have exceeded my pending jobs, the will be a message saying we have exceeded the number of pending jobs and that it's waiting for the a job to finish in order to proceed with the new job submission. The code will wait until there is room for a new pending job.
For reference, this is how the old provider handled it.
How should this work with https://github.com/Qiskit/qiskit-ibm-runtime/pull/1100? We already show a warning if the job usage estimation will exceed the monthly quota.
Your current pending jobs are estimated to consume 7.329993678195504 quantum seconds, but you only have 1
quantum seconds left in your monthly quota; therefore, it is likely this job will be canceled
I guess these are independent and we can still raise an error if the monthly quota or pending jobs limit is already exceeded?
If I have exceeded my monthly quota, it will show an error which should display information on how much I have consumed, what my quota was and when my quota will reset.
@francabrera Since this error message comes from the server, I think the server will need to update the message if you want more information in it.
If I have exceeded my monthly quota, it will show an error which should display information on how much I have consumed, what my quota was and when my quota will reset.
@francabrera Since this error message comes from the server, I think the server will need to update the message if you want more information in it.
that's correct!
I guess these are independent and we can still raise an error if the monthly quota or pending jobs limit is already exceeded?
@kt474 the warning is independent from the error, the error will only happen once you exceeded, the warning happen before you exceeds if we estimate the job may exceed your remaining time.
ok, so the only work here is
If I have exceeded my pending jobs, ... The code will wait until there is room for a new pending job (with message)