-
Notifications
You must be signed in to change notification settings - Fork 85
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
Test notebooks on pull request #483
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Should we skip these notebooks? Or somehow the specific code blocks? We want to be careful that CI doesn't burn through a bunch of compute resources. |
fc3ec2e
to
d6ebd9a
Compare
c764a01
to
de85125
Compare
3c127e1
to
9b58ed6
Compare
- name: Check for notebooks that require LaTeX | ||
id: latex-changed-files | ||
uses: tj-actions/changed-files@af2816c65436325c50621100d67f6e853cd1b0f1 | ||
with: | ||
# Add your notebook to this list if it needs latex to run | ||
files: | | ||
docs/build/circuit-visualization.ipynb | ||
|
||
- name: Install LaTeX dependencies | ||
if: steps.latex-changed-files.outputs.any_changed == 'true' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install texlive-pictures texlive-latex-extra poppler-utils |
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.
I've replaced the bash logic with this, should be easier to understand, and the step will now appear as "skipped" in the action log if it doesn't run.
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.
This is looking excellent 🙌
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
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 great! But we probably want Arnau to review it first
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.
Great job Frank! I've been testing the script with different arguments and files, and besides a small thing (see below), all worked really well! I like a lot the way you wrote the test using actions to get the changed files, and good thinking adding the conditional to install the latex packages only when necessary!
Co-authored-by: Arnau Casau <47946624+arnaucasau@users.noreply.github.com>
This PR addresses a couple of edge cases I didn't consider in #483. - ~~Adds a token for `qiskit_ibm_provider`, and checks for trailing jobs as we already do for runtime.~~ Turns out provider and runtime share saved account info, and `QiskitRuntimeService.jobs` includes provider jobs, which means the script already handles this fine. - Don't run job-submitting notebooks without the `--submit-jobs` flag, even if passed explicitly. Currently, PR tests will fail if we edit these notebooks as the script will try to run them and they'll time out. To avoid having two lists of "notebooks that submit jobs" (one in the script and one in the action), I'm requiring the flag.
Adds a GitHub action to test notebook code examples on pull request. ### Handling notebooks that submit jobs We only want to submit jobs to IBM Quantum _very_ rarely (such as updating notebook outputs once per qiskit release), but runtime doesn't have a way of restricting the types of job you can send. In this PR, I've limited cell execution to 100s. This should be short enough to do most local tasks and to get backend information, but not nearly long enough for a job to run on the open provider (usually takes hours). If someone accidentally makes a PR with a notebook that submits jobs, the script will timeout and raise an error. On exit, the script cancels any jobs created since it started running. This means they won't take up any resources, and the author will be alerted when CI fails. --------- Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com> Co-authored-by: Arnau Casau <47946624+arnaucasau@users.noreply.github.com>
This PR addresses a couple of edge cases I didn't consider in Qiskit#483. - ~~Adds a token for `qiskit_ibm_provider`, and checks for trailing jobs as we already do for runtime.~~ Turns out provider and runtime share saved account info, and `QiskitRuntimeService.jobs` includes provider jobs, which means the script already handles this fine. - Don't run job-submitting notebooks without the `--submit-jobs` flag, even if passed explicitly. Currently, PR tests will fail if we edit these notebooks as the script will try to run them and they'll time out. To avoid having two lists of "notebooks that submit jobs" (one in the script and one in the action), I'm requiring the flag.
Adds a GitHub action to test notebook code examples on pull request.
Handling notebooks that submit jobs
We only want to submit jobs to IBM Quantum very rarely (such as updating notebook outputs once per qiskit release), but runtime doesn't have a way of restricting the types of job you can send.
In this PR, I've limited cell execution to 100s. This should be short enough to do most local tasks and to get backend information, but not nearly long enough for a job to run on the open provider (usually takes hours).
If someone accidentally makes a PR with a notebook that submits jobs, the script will timeout and raise an error. On exit, the script cancels any jobs created since it started running. This means they won't take up any resources, and the author will be alerted when CI fails.