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

Fix notebook testing CI #526

Merged
merged 8 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/notebook-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
shell: python
run: |
# This saves the result for qiskit-ibm-provider too
from qiskit_ibm_runtime import QiskitRuntimeService
QiskitRuntimeService.save_account(
channel="ibm_quantum",
Expand Down
3 changes: 3 additions & 0 deletions scripts/nb-tester/test-notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def cancel_trailing_jobs(start_time: datetime) -> bool:
If a notebook submits a job but does not wait for the result, this check
will also catch it and cancel the job.
"""
# QiskitRuntimeService().jobs() includes qiskit-ibm-provider jobs too
service = QiskitRuntimeService()
jobs = [j for j in service.jobs(created_after=start_time) if not j.in_final_state()]
if not jobs:
Expand Down Expand Up @@ -161,6 +162,8 @@ def create_argument_parser() -> argparse.ArgumentParser:
args = create_argument_parser().parse_args()

paths = map(Path, args.filenames or find_notebooks(submit_jobs=args.submit_jobs))
if not args.submit_jobs:
paths = [path for path in paths if not any(path.match(glob) for glob in NOTEBOOKS_THAT_SUBMIT_JOBS)]

# Execute notebooks
start_time = datetime.now()
Expand Down