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

rework IBMQ account adminstration #1000

Merged
merged 11 commits into from
Oct 2, 2018
Merged

Conversation

ajavadia
Copy link
Member

@ajavadia ajavadia commented Oct 1, 2018

Summary

PR #1000!

Fixes #980
Fixes #1001

The IBMQ account adminstration has been changed a bit. Here is how it works now.

enable_account(token, url) # add to current session
disable_accounts(**kwargs)  #remove from current session
save_account(token, url) #save to disk
delete_accounts(**kwargs) #delete from disk
load_accounts(**kwargs) #load into session
active_accounts() # list all accounts active in this session
stored_accounts() # list all accounts saved to disk

Example usage:

from qiskit import *
import Qconfig
import QconfigCore

# start fresh. delete any accounts on disk
IBMQ.delete_accounts()
# verify that there are no accounts stored now
IBMQ.stored_accounts()

# enable an account (useful for one-off use, or if you don't want to save to disk)
IBMQ.enable_account(Qconfig.APItoken, Qconfig.config['url'])
# you see that specific account enabled for use
IBMQ.active_accounts()

# and its backends are available
IBMQ.backends()

# disable that account (so we go back to no accounts active)
IBMQ.disable_accounts(token=Qconfig.APItoken, url=Qconfig.config['url'])

# save two accounts: a public and a premium
import Qconfig
import QconfigCore
IBMQ.save_account(Qconfig.APItoken, Qconfig.config['url'])
IBMQ.save_account(QconfigCore.APItoken, QconfigCore.config['url'])

# now they should show up as present on disk
IBMQ.stored_accounts()

# but no account active in current session yet
IBMQ.active_accounts()

# so IBMQ can't see any backends yet
IBMQ.backends()

# now load up every account stored to disk
IBMQ.load_accounts()

# backends from two different accounts available for use
IBMQ.backends()

# now if you want to work with backends of a single account,
# you can do so via backend filtering
IBMQ.backends(name='ibmq_qasm_simulator', group=None)

# but you can also just disable account in the current session
IBMQ.disable_accounts(project='qiskit-core')

# so now only one account is active
IBMQ.active_accounts()

# and only that account's backends are available
IBMQ.backends()

# or from the start just load up that account you're interested in
IBMQ.disable_accounts()
IBMQ.load_accounts(project='qiskit-core')
IBMQ.backends()

@ajavadia
Copy link
Member Author

ajavadia commented Oct 1, 2018

@diego-plan9 please take a look at this to make sure I didn't mess up anything with your account management stuff.

@jaygambetta jaygambetta added this to the 0.6 milestone Oct 2, 2018
jaygambetta
jaygambetta previously approved these changes Oct 2, 2018
doc/releases.rst Outdated Show resolved Hide resolved
@ajavadia
Copy link
Member Author

ajavadia commented Oct 2, 2018

Please hold off on merging until I push a small fix.
Some tests fail locally.

diego-plan9
diego-plan9 previously approved these changes Oct 2, 2018
@jaygambetta jaygambetta merged commit 22656a3 into Qiskit:master Oct 2, 2018
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this pull request Jul 30, 2019
rework IBMQ account adminstration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running tests locally kills the IBMQ credentials in qiskitrc IBMQ account adminstration is a bit unclear
3 participants