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

Ability to pass in options to SuperstaqProvider and Service #708

Merged
merged 36 commits into from
Aug 31, 2023

Conversation

vtomole
Copy link
Member

@vtomole vtomole commented Aug 22, 2023

This PR is the beginning of having options be added at the top level. The inspiration for this change is #592.

New way of calling should look like

import json
import os
import qiskit
import qiskit_superstaq as qss


with open(os.path.expanduser('~/.coldquanta/cq_auth.json'), 'r') as file:
    cq_token = json.load(file)

superstaq = qss.superstaq_provider.SuperstaqProvider(token, cq_token=cq_token)

backend = superstaq.get_backend("cq_hilbert_simulator")


qc = qiskit.QuantumCircuit(1, 1)

qc.h(0)
qc.measure(0, 0)

job = backend.run(qc, shots=1)
print(job.result().get_counts())

This PR makes is so that get_job also has acess to the cq_token that's passed in .

Corresponding PR https://github.com/Infleqtion/server-superstaq/pull/2663

@vtomole vtomole marked this pull request as ready for review August 22, 2023 18:32
@vtomole vtomole marked this pull request as draft August 22, 2023 21:02
@vtomole vtomole marked this pull request as ready for review August 24, 2023 16:29
@vtomole
Copy link
Member Author

vtomole commented Aug 24, 2023

@SalahedeenIssa Please test and review.

vtomole and others added 4 commits August 25, 2023 14:32
Co-authored-by: richrines1 <85512171+richrines1@users.noreply.github.com>
Co-authored-by: richrines1 <85512171+richrines1@users.noreply.github.com>
Co-authored-by: richrines1 <85512171+richrines1@users.noreply.github.com>
Co-authored-by: richrines1 <85512171+richrines1@users.noreply.github.com>
epelaaez and others added 6 commits August 29, 2023 10:43
Co-authored-by: richrines1 <85512171+richrines1@users.noreply.github.com>
Co-authored-by: Victory Omole <vtomole2@gmail.com>
Co-authored-by: richrines1 <85512171+richrines1@users.noreply.github.com>
@vtomole vtomole requested a review from epelaaez as a code owner August 30, 2023 22:50
@@ -253,6 +253,22 @@ def test_dfe(service: css.Service) -> None:
assert isinstance(result, float)


def test_aces(service: css.Service) -> None:
Copy link
Contributor

@richrines1 richrines1 Aug 30, 2023

Choose a reason for hiding this comment

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

is this part of #699? /should that be merged first to simplify this pr?

Copy link
Member Author

Choose a reason for hiding this comment

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

I accidentally merged that branch into this one 😭 . Will wait until that one is in before this

Copy link
Contributor

@richrines1 richrines1 left a comment

Choose a reason for hiding this comment

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

(few more nits)

general-superstaq/general_superstaq/superstaq_client.py Outdated Show resolved Hide resolved
@@ -47,6 +47,7 @@ def __init__(
api_version: str = gss.API_VERSION,
max_retry_seconds: int = 3600,
verbose: bool = False,
**kwargs: Any,
Copy link
Contributor

Choose a reason for hiding this comment

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

should be added to docstring

vtomole and others added 5 commits August 31, 2023 16:30
Co-authored-by: richrines1 <85512171+richrines1@users.noreply.github.com>
Co-authored-by: richrines1 <85512171+richrines1@users.noreply.github.com>
Co-authored-by: richrines1 <85512171+richrines1@users.noreply.github.com>
Co-authored-by: richrines1 <85512171+richrines1@users.noreply.github.com>
@vtomole
Copy link
Member Author

vtomole commented Aug 31, 2023

Applied all the suggestions and added docstring. Thanks.

Copy link
Contributor

@richrines1 richrines1 left a comment

Choose a reason for hiding this comment

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

lgtm once test is fixed!

Co-authored-by: richrines1 <85512171+richrines1@users.noreply.github.com>
@vtomole vtomole merged commit 3e891cc into main Aug 31, 2023
16 checks passed
@vtomole vtomole deleted the pass_options_to_get branch August 31, 2023 22:34
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.

3 participants