-
Notifications
You must be signed in to change notification settings - Fork 87
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 with test-eagle
#2447
Closed
Closed
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ce296ea
Make notebooks runnable with nb-tester
frankharkins 1637132
Add `extended` strategy and reclassify notebooks
frankharkins db247c0
Add new `qiskit-ibm-runtime-open` patch
frankharkins 70e9aa4
Add extended notebook tests action
frankharkins 80180c2
Skip fractional gates notebook (#2454)
frankharkins 89c3915
Update docs/guides/q-ctrl-optimization-solver.ipynb
frankharkins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# This code is a Qiskit project. | ||
# | ||
# (C) Copyright IBM 2024. | ||
# | ||
# This code is licensed under the Apache License, Version 2.0. You may | ||
# obtain a copy of this license in the LICENSE file in the root directory | ||
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Any modifications or derivative works of this code must retain this | ||
# copyright notice, and modified files need to carry a notice indicating | ||
# that they have been altered from the originals. | ||
|
||
name: Test notebooks that submit jobs | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
execute: | ||
name: Execute notebooks with test-eagle | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get relevant changed files | ||
id: all-changed | ||
uses: tj-actions/changed-files@af2816c65436325c50621100d67f6e853cd1b0f1 | ||
with: | ||
files: "{docs/**/*.ipynb,scripts/nb-tester/**/*}" | ||
separator: "\n" | ||
write_output_files: true | ||
|
||
- name: Setup environment | ||
uses: ./.github/actions/set-up-notebook-testing | ||
with: | ||
ibm-quantum-token: ${{ secrets.IBM_QUANTUM_TEST_TOKEN }} | ||
instance: "client-enablement/documentation/qiskit-documenta" | ||
|
||
- name: Execute notebooks | ||
run: python scripts/ci/extended-execute-notebooks.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,11 +139,6 @@ | |
"# If you have not previously saved your credentials, follow instructions at\n", | ||
"# https://docs.quantum.ibm.com/guides/setup-channel#iqp\n", | ||
"# to authenticate with your API token.\n", | ||
"hub = \"<YOUR_IQP_HUB>\"\n", | ||
"group = \"<YOUR_IQP_GROUP>\"\n", | ||
"project = \"<YOUR_IQP_PROJECT>\"\n", | ||
"\n", | ||
"# Authentication\n", | ||
"catalog = QiskitFunctionsCatalog()\n", | ||
"\n", | ||
"# Access Function\n", | ||
|
@@ -252,7 +247,26 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 14, | ||
"execution_count": null, | ||
"id": "cf53550c", | ||
"metadata": { | ||
"tags": [ | ||
"remove-cell" | ||
] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# This cell is hidden from users\n", | ||
"from qiskit_ibm_runtime import QiskitRuntimeService\n", | ||
"\n", | ||
"service = QiskitRuntimeService()\n", | ||
"instance = service.active_account()[\"instance\"]\n", | ||
"backend_name = service.least_busy().name" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "16c66d64", | ||
"metadata": {}, | ||
"outputs": [], | ||
|
@@ -261,7 +275,8 @@ | |
"maxcut_job = solver.run(\n", | ||
" problem=problem_as_str,\n", | ||
" problem_type=\"maxcut\",\n", | ||
" instance=hub + \"/\" + group + \"/\" + project,\n", | ||
" instance=instance, # E.g. \"ibm-q/open/main\"\n", | ||
" backend_name=backend_name, # E.g. \"ibm_kyiv\"\n", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the main change to most notebooks: We load the |
||
")" | ||
] | ||
}, | ||
|
@@ -476,7 +491,9 @@ | |
"source": [ | ||
"# Solve the problem\n", | ||
"mvc_job = solver.run(\n", | ||
" problem=srepr(cost_function), instance=hub + \"/\" + group + \"/\" + project\n", | ||
" problem=srepr(cost_function),\n", | ||
" instance=instance,\n", | ||
frankharkins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
" backend_name=backend_name, # E.g. \"ibm_kyiv\"\n", | ||
")" | ||
] | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nice feature of most Jupyter execution tools. The exception in this cell is intentional.