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

unwrapped DAGCircuit::collect_runs() to not return an Option #13222

Merged
merged 5 commits into from
Sep 27, 2024

Conversation

cameron-d28
Copy link
Contributor

@cameron-d28 cameron-d28 commented Sep 25, 2024

Summary

This change updates the collect_runs function to return a PyResult instead of an Option so that error can be routed by to DAGCircuit when invalid states are present.

Details and comments

fixes #13109

@cameron-d28 cameron-d28 requested a review from a team as a code owner September 25, 2024 15:57
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Sep 25, 2024
@CLAassistant
Copy link

CLAassistant commented Sep 25, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@cameron-d28 cameron-d28 reopened this Sep 26, 2024
@cameron-d28 cameron-d28 marked this pull request as ready for review September 26, 2024 15:14
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@cameron-d28 cameron-d28 changed the title changed py_collect_runs to return Ok and Err instead of Some and None unwrapped DAGCircuit::collect_runs() to not return an Option Sep 26, 2024
Copy link
Contributor

@kevinhartman kevinhartman left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution, @cameron-d28!

This looks like a good start. I've left a few comments inline, primarily regarding the way we ought to handle the cycle error case. After addressing that, you'll need to adjust py_collect_runs as well for the new return type.

crates/circuit/src/dag_circuit.rs Outdated Show resolved Hide resolved
crates/circuit/src/dag_circuit.rs Outdated Show resolved Hide resolved
@cameron-d28
Copy link
Contributor Author

thank you for the feedback @kevinhartman! i have improved my changes. please let me know how they look 🙂

Copy link
Contributor

@kevinhartman kevinhartman left a comment

Choose a reason for hiding this comment

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

Thanks for the updates, @cameron-d28!

This is looking good to me now. I like the change you made to use a single for-loop rather than a map followed by a for-loop when adding runs to the out_set in DAGCircuit::py_collect_runs.

@kevinhartman kevinhartman added this pull request to the merge queue Sep 27, 2024
@coveralls
Copy link

coveralls commented Sep 27, 2024

Pull Request Test Coverage Report for Build 11077292777

Details

  • 14 of 15 (93.33%) changed or added relevant lines in 2 files are covered.
  • 5 unchanged lines in 2 files lost coverage.
  • Overall coverage remained the same at 88.883%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/circuit/src/dag_circuit.rs 12 13 92.31%
Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/expr.rs 1 94.02%
crates/qasm2/src/lex.rs 4 92.98%
Totals Coverage Status
Change from base Build 11076723215: 0.0%
Covered Lines: 74138
Relevant Lines: 83411

💛 - Coveralls

@cameron-d28
Copy link
Contributor Author

glad to see the update made sense @kevinhartman! i didn't see why the mapping would still be needed - (maybe for lazy eval?? not sure).

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 27, 2024
@kevinhartman kevinhartman added this pull request to the merge queue Sep 27, 2024
Merged via the queue into Qiskit:main with commit 9778462 Sep 27, 2024
15 checks passed
emilkovacev pushed a commit to emilkovacev/qiskit that referenced this pull request Oct 1, 2024
…13222)

* changed collect runs to unwrap Option and route error to DAGCircuit

* changes by @kevinhartman

* updated py_collect_runs

* update collect_runs calls and specified lifteime of return

---------

Co-authored-by: Kevin Hartman <[email protected]>
ElePT pushed a commit to ElePT/qiskit that referenced this pull request Oct 9, 2024
…13222)

* changed collect runs to unwrap Option and route error to DAGCircuit

* changes by @kevinhartman

* updated py_collect_runs

* update collect_runs calls and specified lifteime of return

---------

Co-authored-by: Kevin Hartman <[email protected]>
@raynelfss raynelfss added the Changelog: None Do not include in changelog label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog Community PR PRs from contributors that are not 'members' of the Qiskit repo
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Change DAGCircuit::collect_runs() return to not be an Option
6 participants