Expand "monitor and cancel a job"#5240
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
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", |
There was a problem hiding this comment.
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.
| "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", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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", |
| " 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", |
There was a problem hiding this comment.
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).

Closes #4722