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

Raising errors for missing M or nshots #81

Merged
merged 8 commits into from
Oct 21, 2024

Conversation

BrunoLiegiBastonLiegi
Copy link
Contributor

@BrunoLiegiBastonLiegi BrunoLiegiBastonLiegi commented Oct 17, 2024

As per title, errors are raised when running on hardware and either:

  • no measurements are present in the circuit
  • nshots is not defined

this should close #73

At the moment I am just checking whether device == "k2", but ideally it would be nice if each partition had a property, simulation=True for instance, doing the check on the node inside the job and returning an error response.

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (0ea1e2f) to head (4c7aa4e).
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #81   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          232       232           
=========================================
  Hits           232       232           
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BrunoLiegiBastonLiegi BrunoLiegiBastonLiegi marked this pull request as ready for review October 17, 2024 10:31
@scarrazza
Copy link
Member

Okay, that is a good point in favor of moving this check to the front end. @marcorossi5, could you please show @BrunoLiegiBastonLiegi how to change the front-end API and include this feature?

@marcorossi5
Copy link
Contributor

marcorossi5 commented Oct 17, 2024

Moving the logic to the webapp means adding the checks in this function: https://github.com/qiboteam/qibo-webapp/blob/892ee98d36d777873a1c713d3c92b8beade19cd6/src/client/views.py#L75

New tests go in this class: https://github.com/qiboteam/qibo-webapp/blob/892ee98d36d777873a1c713d3c92b8beade19cd6/src/client/tests/test_views.py#L27

@BrunoLiegiBastonLiegi
Copy link
Contributor Author

Now that qiboteam/qibo-webapp#105 implemented the blocking of circuit without measurements or nshots specified, this PR probably reduces to just some minor additions to the docstrings, and setting nshots=None by default. I am not sure whether we are supposed to test here as well that run_circuit returns a 403 response in those cases.

@scarrazza
Copy link
Member

Thanks @BrunoLiegiBastonLiegi . I think we should make the device mandatory (i.e. remove the default value).

@scarrazza
Copy link
Member

Thanks @BrunoLiegiBastonLiegi, could you please double check if the README and sphinx docs are okay with your latest changes?

@BrunoLiegiBastonLiegi
Copy link
Contributor Author

The README is showing an example with the sim partition (btw, this should be changed to k2 now, right?), thus it should be fine. The docs at the moment seem to consist in basically just the dosctrings from the source code, which I modified already, so nothing to do there as well.

@scarrazza
Copy link
Member

Thanks, I would suggest to do not state any device name here and just point to the user that in order to device the device name, visit the cloud system and checkout the available partitions for his account.

@BrunoLiegiBastonLiegi BrunoLiegiBastonLiegi merged commit d72c7e4 into main Oct 21, 2024
19 checks passed
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.

Revisiting run_circuit arguments
3 participants