-
Notifications
You must be signed in to change notification settings - Fork 157
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
Deprecate auth parameter and add new channel parameter #226
Deprecate auth parameter and add new channel parameter #226
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
217b3eb
to
b6d1f80
Compare
Pull Request Test Coverage Report for Build 2042278316Warning: 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
💛 - Coveralls |
… with named channel accounts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rathishcholarajan carefully reviewed the changes and left a few comments. Let me know if you disagree or anything is unclear.
Co-authored-by: Daniel Kaulen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - Thanks!! I find the new terminology much clearer.
def migrate(cls) -> None: | ||
"""Migrate accounts on disk by removing `auth` and adding `channel`.""" | ||
data = read_config(filename=_DEFAULT_ACCOUNT_CONFIG_JSON_FILE) | ||
for key, value in data.items(): | ||
if key == _DEFAULT_ACCOUNT_NAME_CLOUD: | ||
value.pop("auth", None) | ||
value.update(channel="ibm_cloud") | ||
delete_config(filename=_DEFAULT_ACCOUNT_CONFIG_JSON_FILE, name=key) | ||
save_config( | ||
filename=_DEFAULT_ACCOUNT_CONFIG_JSON_FILE, | ||
name=_DEFAULT_ACCOUNT_NAME_IBM_CLOUD, | ||
config=value, | ||
overwrite=False, | ||
) | ||
elif key == _DEFAULT_ACCOUNT_NAME_LEGACY: | ||
value.pop("auth", None) | ||
value.update(channel="ibm_quantum") | ||
delete_config(filename=_DEFAULT_ACCOUNT_CONFIG_JSON_FILE, name=key) | ||
save_config( | ||
filename=_DEFAULT_ACCOUNT_CONFIG_JSON_FILE, | ||
name=_DEFAULT_ACCOUNT_NAME_IBM_QUANTUM, | ||
config=value, | ||
overwrite=False, | ||
) | ||
else: | ||
if hasattr(value, "auth"): | ||
if value["auth"] == "cloud": | ||
value.update(channel="ibm_cloud") | ||
elif value["auth"] == "legacy": | ||
value.update(channel="ibm_quantum") | ||
value.pop("auth", None) | ||
save_config( | ||
filename=_DEFAULT_ACCOUNT_CONFIG_JSON_FILE, | ||
name=key, | ||
config=value, | ||
overwrite=True, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this a lot easier to understand than the previous approach, thanks for updating the PR accordingly!
Instead of persisting the changes for every stored account, we could also make all updates in-memory and overwrite the file with a single write operation. Given that this is temporary migration code and I don't expect users to have hundreds of account I'm personally fine with this. I don't think we have to optimize at this level of detail.
No objections from my side if the CI checks pass... |
* Add error handling of separate cregs * do not raise an error unless error mitigation is enabled * always check unused classical bits * revert a test name * avoid applying correction to classical bits not used for measurements * update an error messgage * isort * Update test/unit/test_sampler.py Co-authored-by: Mariana Bernagozzi <[email protected]> * add MidcircuitMeasurementError Co-authored-by: Rathish Cholarajan <[email protected]> Co-authored-by: JESSIE YU <[email protected]> Co-authored-by: Mariana Bernagozzi <[email protected]>
Summary
Deprecate existing
auth
parameter to IBMRuntimeService and introduce newchannel
parameter to better accommodate the different channels that may be available in the future.channel="ibm_quantum"
channel="ibm_cloud"
Details and comments
Fixes #217
TODO
channel
parameter and replaceauth
everywhere withchannel
to makechannel
work (auth
gets broken at the end of this step)auth
parameter and fix code now to makeauth
also to work alongsidechannel
save_account
)delete_account
)saved_accounts
)__init__
)ibm-quantum-production
,ibm-quantum-staging
,ibm-cloud-production
andibm-cloud-staging
.channel
tests and make them work usingauth
flowauth
parameter and the tests related to it will be removed in a later release as per Qiskit deprecation policy.