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 refresh method to fake backends #1740

Merged
merged 24 commits into from
Jun 18, 2024
Merged

Conversation

ptristan3
Copy link
Collaborator

Summary

Details and comments

Fixes #1707

@coveralls
Copy link

coveralls commented Jun 10, 2024

Pull Request Test Coverage Report for Build 9455558491

Details

  • 13 of 48 (27.08%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.4%) to 82.05%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit_ibm_runtime/utils/backend_encoder.py 8 17 47.06%
qiskit_ibm_runtime/fake_provider/fake_backend.py 5 31 16.13%
Totals Coverage Status
Change from base Build 9452478202: -0.4%
Covered Lines: 6084
Relevant Lines: 7415

💛 - Coveralls

@ptristan3 ptristan3 marked this pull request as ready for review June 12, 2024 18:45
@ptristan3 ptristan3 requested a review from kt474 June 12, 2024 18:46
@Qiskit Qiskit deleted a comment from coveralls Jun 13, 2024
@Qiskit Qiskit deleted a comment from coveralls Jun 13, 2024
@Qiskit Qiskit deleted a comment from coveralls Jun 13, 2024
@coveralls
Copy link

coveralls commented Jun 13, 2024

Pull Request Test Coverage Report for Build 9500935091

Details

  • 13 of 49 (26.53%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.4%) to 81.929%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit_ibm_runtime/utils/backend_encoder.py 8 17 47.06%
qiskit_ibm_runtime/fake_provider/fake_backend.py 5 32 15.63%
Totals Coverage Status
Change from base Build 9500909504: -0.4%
Covered Lines: 6048
Relevant Lines: 7382

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 14, 2024

Pull Request Test Coverage Report for Build 9516500365

Details

  • 13 of 49 (26.53%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.4%) to 81.929%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit_ibm_runtime/utils/backend_encoder.py 8 17 47.06%
qiskit_ibm_runtime/fake_provider/fake_backend.py 5 32 15.63%
Totals Coverage Status
Change from base Build 9504829260: -0.4%
Covered Lines: 6048
Relevant Lines: 7382

💛 - Coveralls

@kt474 kt474 added the Changelog: New Feature Include in the Added section of the changelog label Jun 18, 2024
@kt474 kt474 modified the milestone: 0.25.0 Jun 18, 2024
@kt474 kt474 merged commit 76d8341 into Qiskit:main Jun 18, 2024
18 checks passed
@coveralls
Copy link

coveralls commented Jun 18, 2024

Pull Request Test Coverage Report for Build 9568678069

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 13 of 49 (26.53%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.4%) to 81.941%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit_ibm_runtime/utils/backend_encoder.py 8 17 47.06%
qiskit_ibm_runtime/fake_provider/fake_backend.py 5 32 15.63%
Totals Coverage Status
Change from base Build 9568564788: -0.4%
Covered Lines: 6053
Relevant Lines: 7387

💛 - Coveralls

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.

A little bit late, but I think this needs some changes.

if real_props:
new_version = real_props.backend_version

if new_version > version:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we really rely on the version? I don't think it gets updated every time new calibration is pushed. And why even check the version if the server side data is already the freshest.

logger.info("There are no available new updates for %s.", self.backend_name)

except Exception as ex:
logger.info("The refreshing of %s has failed: %s", self.backend_name, str(ex))
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should raise an exception or at least a warning. Info level log doesn't get surfaced by default.

"The backend %s has been updated from {version} to %s version.",
self.backend_name,
real_props.backend_version,
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This just updates the files but doesn't actually refresh the target if it's already built since it's cached.

Comment on lines +186 to +190
old_backend = FakeSherbrooke()
with self.assertLogs("qiskit_ibm_runtime", level="INFO"):
old_backend.refresh(self.service)
new_backend = FakeSherbrooke()
self.assertGreaterEqual(old_backend.backend_version, new_backend.backend_version)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't quite understand this test. If FakeSherbrooke currently has version 1. The server data has version 2. If the refresh() code is not working correctly, both old_backend and new_backend would remain at version 1, and the test would still pass.

ptristan3 added a commit to ptristan3/qiskit-ibm-runtime that referenced this pull request Jun 26, 2024
kt474 added a commit that referenced this pull request Jul 10, 2024
* improvements from #1740

* updated tests

* updated refresh condition

* style fixes

* mypy warning

* update name

---------

Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
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.

Allow users to update fake backends with latest data
4 participants