Skip to content
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

Add backend refresh() method #1955

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

kt474
Copy link
Member

@kt474 kt474 commented Sep 30, 2024

Summary

Details and comments

Fixes #

@kt474 kt474 added the Changelog: New Feature Include in the Added section of the changelog label Sep 30, 2024
@kt474 kt474 requested a review from jyu00 September 30, 2024 18:45
Copy link
Collaborator

@jyu00 jyu00 left a comment

Choose a reason for hiding this comment

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

can you also add a test?

qiskit_ibm_runtime/ibm_backend.py Outdated Show resolved Hide resolved
instance=self._instance,
):
self._configuration = config
self._get_properties(datetime=python_datetime.now())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looking at the code, _get_properties() and properties() seem to nearly identical, with the exception that the latter support refresh. I wonder if we can consolidate them and just pass refresh=True.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I think we can consolidate the two methods - i'll do that when fixing #1956

Comment on lines 127 to 130
old_target = backend.target_history(datetime=datetime.now() - timedelta(60))
self.assertIsNotNone(old_target)
backend.refresh()
self.assertNotEqual(old_target, backend.target)
Copy link
Collaborator

Choose a reason for hiding this comment

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

haha I just opened an issue that, when fixed, would make this test less useful.

I think you can just do

old_target = backend.target
backend.refresh()
new_target = backend.target

and assert old_target and new_target are different objects (to validate target is not cached)

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.

2 participants