quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.24k stars 1.01k forks source link

Update start notebook to use `get_engine` instead of `get_qcs_objects_for_notebook` #6483

Closed senecameeks closed 6 months ago

senecameeks commented 7 months ago

Addresses #6427 by removing the incorrect processor_id in the notebook.

Although this doesn't fix the underlying issue as to why get_qcs_objects_for_notebook is incorrect and doesn't address Will's second point in his comment

FYI, I verified this works as a good replacement for get_qcs_objects_for_notebook

review-notebook-app[bot] commented 7 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.76%. Comparing base (d75d43f) to head (02d998b). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6483 +/- ## ======================================= Coverage 97.76% 97.76% ======================================= Files 1105 1105 Lines 94936 94963 +27 ======================================= + Hits 92810 92837 +27 Misses 2126 2126 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

NoureldinYosri commented 7 months ago

this might not work if it's run from outside corp network in which case authentication is needed which is part of get_qcs_objects_for_notebook https://github.com/quantumlib/Cirq/blob/eef7c5c9309fcdb9254a295491facee3118c2279/cirq-google/cirq_google/engine/qcs_notebook.py#L104


to check if it will from outside corp network try to run then notebook in colab.research

senecameeks commented 6 months ago

Thanks @NoureldinYosri for the catch!

6485 exposes authenticate_user, which I've added to this start notebook.

In the case where get_engine throws an exception, it will default to a virtual engine instance using get_qcs_notebook_objects. Note that because virtual is set to True, it does not print the erroneous message Using processor: which was the impetus for this change (See #6427).