-
Notifications
You must be signed in to change notification settings - Fork 27
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
Allow IBMServerlessProvider users to save their credentials to disk #1048
Conversation
…erverlessProvider
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.
Should we use what QiskitRuntimeService already have? 🤔
then implementation would be something like this:
class IBMServerlessProvider(...):
def __init__(self, token: Optional[str] = None, name: Optional[str] = None):
if token is None:
self.token = QiskitRuntimeService(name=name).token
else:
self.token = token
@classmethod
def save_account(cls, token: Union[str, QiskitRuntimeService], overwrite: bool = True):
if isinstance(token, QiskitRuntimeService):
QiskitRuntimeService.save_acoount(**token.get_account())
else:
# token string
QiskitRuntimeService.save_account(token=token, channel=..., ...)
In that case it will be same file as runtime is using.
But in general I'm ok with any option :)
Yes, I think this is a better solution. Let me take a look.. |
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.
Looks clean! :)
Feel free to merge after docstring update
Fixes #1042