Skip to content

Expand "monitor and cancel a job"#5240

Open
abbycross wants to merge 17 commits into
mainfrom
ajc/monitor-job-rewrite
Open

Expand "monitor and cancel a job"#5240
abbycross wants to merge 17 commits into
mainfrom
ajc/monitor-job-rewrite

Conversation

@abbycross

Copy link
Copy Markdown
Collaborator

Closes #4722

@abbycross abbycross requested a review from a team June 9, 2026 21:28
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@qiskit-bot

Copy link
Copy Markdown
Contributor

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

"params = np.random.uniform(size=(2, 3)).T\n",
"<Tabs>\n",
" <TabItem value=\"Qiskit\" label=\"Get job metrics with Qiskit\">\n",
" Use the `service.jobs()` method with filters to retrieve information about your submitted jobs, such as how many have been submitted, whether they were batch or session workloads, which instance they are associated with, when they were created, and so on. The following example looks at the last 50 workloads in an instance and outputs how many were batch or session workloads. It then lists out job ID, status, tags, and date created for the last ten jobs.\n",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit - we should link to the API reference for service.jobs() since it has a lot of useful filters. For example, the code block talks about jobs in a session. There is a session_id filter that can be used to get all jobs within a particular session.

Comment on lines +217 to +222
"session_workloads = sum(1 for job in all_jobs if job.session_id is not None)\n",
"batch_jobs = sum(1 for job in all_jobs if job.session_id is None)\n",
"\n",
"print(f\"Total jobs submitted: {total_jobs}\")\n",
"print(f\"Batch workloads (session_id = None): {batch_jobs}\")\n",
"print(f\"Session workloads (session_id != None): {session_workloads}\")\n",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not having a session id means the job ran in job mode, not Batch. Also because of historical reasons, sessions and batches are treated as the same on the server side. So a job with a session ID means it ran either in Session or Batch mode.

For simplicity I'd change this example to using one of the jobs() filter. Perhaps program_id="sampler" to make it a runnable example.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

AH so that's why Claude couldn't figure out how to show both session and batch separately!

" <CodeCellPlaceholder tag=\"id-metrics\" />\n",
" </TabItem>\n",
" <TabItem value=\"IQP\" label=\"View job metrics on IBM Quantum Platform\">\n",
" Navigate to the [Analytics page](https://quantum.cloud.ibm.com/analytics) to see and download data, such as the following:\n",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It feels that the workloads page matches the Qiskit example better? E.g. the workloads page give you information on "how many have been submitted, whether they were batch or session workloads, which instance they are associated with, when they were created, and so on"

"\n",
" <CodeCellPlaceholder tag=\"id-retrieve\" />\n",
"\n",
" You can use `job.properties()` to retrieve backend properties, including error rates, at the time of the job execution.\n",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This can be its own section since IQP also supports this now 😄. The "view calibration history" link brings up the backend with the calibration from the time the job ran.

Image

" 1. Go to the [Workloads page](https://quantum.cloud.ibm.com/workloads)\n",
" 2. Use the search or filter options to find your job by name, date, or status\n",
" 3. Click on the job to view its results and details\n",
" 4. Results remain available indefinitely in your workload history\n",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think this is true. IQP data retention is only 3 years ? I would just delete this line or link to our policy (if it's documented anywhere).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Fix Monitor or cancel a job page

3 participants