Skip to content

Update usage method to include remaining usage #2329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 21, 2025

Conversation

kt474
Copy link
Member

@kt474 kt474 commented Jul 17, 2025

Summary

Also cleaned up the old usage() methods from IQP classic

Details and comments

Fixes #1829

@kt474 kt474 added the Changelog: New Feature Include in the Added section of the changelog label Jul 17, 2025
@kt474 kt474 marked this pull request as ready for review July 17, 2025 19:00
Copy link
Collaborator

@ElePT ElePT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method needs to handle the None case independently. I tried the new method with an open plan account and it raised a TypeError:

>>> service.usage()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ept/qiskit_workspace/qiskit-ibm-runtime/qiskit_ibm_runtime/qiskit_runtime_service.py", line 1037, in usage
    usage_dict.get("usage_limit_seconds", usage_dict.get("usage_allocation_seconds"))
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

@kt474
Copy link
Member Author

kt474 commented Jul 18, 2025

The method needs to handle the None case independently. I tried the new method with an open plan account and it raised a TypeError:

In the case where usage_allocation_seconds and usage_limit_seconds both don't exist? Just created an open plan instance and I didn't run into this issue.

Copy link
Collaborator

@ElePT ElePT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I just have a final remark, should we call the entry usage_remaining_seconds for consistency with the others? I find it a bit strange to suddenly drop the units.

kt474 and others added 2 commits July 21, 2025 09:44
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
Copy link
Collaborator

@ElePT ElePT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvements, I really like the new release note. LGTM.

@kt474 kt474 added this pull request to the merge queue Jul 21, 2025
Merged via the queue into Qiskit:main with commit 3269568 Jul 21, 2025
20 checks passed
@kt474 kt474 deleted the update-usage-method branch July 21, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the Added section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remaining time of an instance
2 participants