diff --git a/docs/guides/monitor-job.ipynb b/docs/guides/monitor-job.ipynb index ae1341e081f..db8fc865e42 100644 --- a/docs/guides/monitor-job.ipynb +++ b/docs/guides/monitor-job.ipynb @@ -7,7 +7,7 @@ "source": [ "---\n", "title: Monitor or cancel a job\n", - "description: How to monitor or cancel a job submitted to IBM Quantum Platform or IBM Quantum on IBM Cloud\n", + "description: How to monitor or cancel a job submitted to IBM Quantum Platform\n", "---\n", "\n", "\n", @@ -33,15 +33,15 @@ "\n", "| | |\n", "| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n", - "| job.result() | Review job results immediately after the job completes. Job results are available after the job completes. Therefore, job.result() is a blocking call until the job completes. |\n", - "| job.job\\_id() | Return the ID that uniquely identifies that job. Retrieving the job results at a later time requires the job ID. Therefore, it is recommended that you save the IDs of jobs you might want to retrieve later. |\n", - "| job.status() | Check the job status. |\n", - "| job = service.job(\\) | Retrieve a job you previously submitted. This call requires the job ID. |\n", + "| `job.result()` | Review job results immediately after the job completes. Job results are available after the job completes. Therefore, `job.result()` is a blocking call until the job completes. |\n", + "| `job.job_id()` | Return the ID that uniquely identifies that job. Retrieving the job results at a later time requires the job ID. Therefore, it is recommended that you save the IDs of jobs you might want to retrieve later. |\n", + "| `job.status()` | Check the job status. |\n", + "| `job = service.job(\\)` | Retrieve a job you previously submitted. This call requires the job ID. |\n", "\n", "\n", "## Retrieve job results at a later time\n", "\n", - "Call `service.job(\\)` to retrieve a job you previously submitted. If you don't have the job ID, or if you want to retrieve multiple jobs at once; including jobs from retired QPUs (quantum processing units), call `service.jobs()` with optional filters instead. See [QiskitRuntimeService.jobs](../api/qiskit-ibm-runtime/qiskit-runtime-service#jobs).\n", + "Call `service.job()` to retrieve a job you previously submitted. If you don't have the job ID, or if you want to retrieve multiple jobs at once; including jobs from retired QPUs (quantum processing units), call `service.jobs()` with optional filters instead. See [QiskitRuntimeService.jobs](/docs/api/qiskit-ibm-runtime/qiskit-runtime-service#jobs).\n", "\n", "\n", " `service.jobs()` also returns jobs run from the deprecated `qiskit-ibm-provider` package. Jobs submitted by the older (also deprecated) `qiskit-ibmq-provider` package are no longer available.\n", @@ -121,8 +121,54 @@ }, { "cell_type": "code", - "execution_count": 2, - "id": "03946d0d-aeac-45d7-9e8e-6af38e40e758", + "execution_count": null, + "id": "4415838a-04da-4a8e-8fed-4c062d186ec7", + "metadata": {}, + "outputs": [], + "source": [ + "from qiskit_ibm_runtime import QiskitRuntimeService\n", + "\n", + "# Initialize the account first.\n", + "service = QiskitRuntimeService()\n", + "# Use `limit` to retrieve a specific number of jobs. The default `limit` is 10.\n", + "service.jobs(backend_name=my_backend)" + ] + }, + { + "cell_type": "markdown", + "id": "59195a9f-8df8-46f7-9ea0-c3a9b8eb3cac", + "metadata": {}, + "source": [ + "## Cancel a job\n", + "\n", + "You can cancel a job from the IBM Quantum Platform dashboard either on the Workloads page or the details page for a specific workload. On the Workloads page, click the overflow menu at the end of the row for that workload, and select Cancel. If you are on the details page for a specific workload, use the Actions dropdown at the top of the page, and select Cancel.\n", + "\n", + "In Qiskit, use `job.cancel()` to cancel a job.\n", + "\n", + "\n", + "## View Sampler execution spans\n", + "\n", + "The results of [`SamplerV2`](/docs/api/qiskit-ibm-runtime/sampler-v2) jobs executed in Qiskit Runtime contain execution timing information in their metadata.\n", + "This timing information can be used to place upper and lower timestamp bounds on when particular shots were executed on the QPU.\n", + "Shots are grouped into [`ExecutionSpan`](/docs/api/qiskit-ibm-runtime/execution-span-execution-span) objects, each of which indicates a start time, a stop time, and a specification of which shots were collected in the span.\n", + "\n", + "An execution span specifies which data was executed during its window by providing an [`ExecutionSpan.mask`](/docs/api/qiskit-ibm-runtime/execution-span-execution-span#mask) method. This method, given any [Primitive Unified Block (PUB)](/docs/guides/primitive-input-output) index, returns a boolean mask that is `True` for all shots executed during its window. PUBs are indexed by the order in which they were given to the Sampler run call. If, for example, a PUB has shape `(2, 3)` and was run with four shots, then the mask's shape is `(2, 3, 4)`. See the [execution_span](/docs/api/qiskit-ibm-runtime/execution-span) API page for full details.\n", + "\n", + "Example:" + ] + }, + { + "cell_type": "markdown", + "id": "ae2820bc-c762-4d2e-944c-58cbc253acbe", + "metadata": {}, + "source": [ + "To view execution span information, review the metadata of the result returned by `SamplerV2`, which comes in the form of an `ExecutionSpans` object. This object is a list-like container containing instances of subclasses of `ExecutionSpan`, such as `SliceSpan`:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0dd5600c-0071-4523-b76f-ff38adf6fdb1", "metadata": {}, "outputs": [ { @@ -143,8 +189,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "id": "897d35cb-140a-4587-a687-97982a01d846", + "execution_count": null, + "id": "bf962103-3ef2-45ad-b088-5eaf6d5e2e05", "metadata": {}, "outputs": [ { @@ -154,9 +200,8 @@ " [0.94700856, 0.96826017, 0.98426562]])" ] }, - "execution_count": 3, "metadata": {}, - "output_type": "execute_result" + "output_type": "display_data" } ], "source": [ @@ -166,8 +211,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "id": "38176ecc-64fe-4dbb-a9fa-bd0ca2942920", + "execution_count": null, + "id": "5f8b0e31-291b-4f08-b1ac-b9d8fd39ccd9", "metadata": {}, "outputs": [ { @@ -183,9 +228,8 @@ " [ True, True, True, True]]])" ] }, - "execution_count": 4, "metadata": {}, - "output_type": "execute_result" + "output_type": "display_data" } ], "source": [ @@ -193,52 +237,6 @@ "mask" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "4415838a-04da-4a8e-8fed-4c062d186ec7", - "metadata": {}, - "outputs": [], - "source": [ - "from qiskit_ibm_runtime import QiskitRuntimeService\n", - "\n", - "# Initialize the account first.\n", - "service = QiskitRuntimeService()\n", - "# Use `limit` to retrieve a specific number of jobs. The default `limit` is 10.\n", - "service.jobs(backend_name=my_backend)" - ] - }, - { - "cell_type": "markdown", - "id": "59195a9f-8df8-46f7-9ea0-c3a9b8eb3cac", - "metadata": {}, - "source": [ - "## Cancel a job\n", - "\n", - "You can cancel a job from the IBM Quantum Platform dashboard either on the Workloads page or the details page for a specific workload. On the Workloads page, click the overflow menu at the end of the row for that workload, and select Cancel. If you are on the details page for a specific workload, use the Actions dropdown at the top of the page, and select Cancel.\n", - "\n", - "In Qiskit, use `job.cancel()` to cancel a job.\n", - "\n", - "\n", - "## View Sampler execution spans\n", - "\n", - "The results of [`SamplerV2`](/docs/api/qiskit-ibm-runtime/sampler-v2) jobs executed in Qiskit Runtime contain execution timing information in their metadata.\n", - "This timing information can be used to place upper and lower timestamp bounds on when particular shots were executed on the QPU.\n", - "Shots are grouped into [`ExecutionSpan`](/docs/api/qiskit-ibm-runtime/execution-span-execution-span) objects, each of which indicates a start time, a stop time, and a specification of which shots were collected in the span.\n", - "\n", - "An execution span specifies which data was executed during its window by providing an [`ExecutionSpan.mask`](/docs/api/qiskit-ibm-runtime/execution-span-execution-span#mask) method. This method, given any [Primitive Unified Block (PUB)](/docs/guides/primitive-input-output) index, returns a boolean mask that is `True` for all shots executed during its window. PUBs are indexed by the order in which they were given to the Sampler run call. If, for example, a PUB has shape `(2, 3)` and was run with four shots, then the mask's shape is `(2, 3, 4)`. See the [execution_span](/docs/api/qiskit-ibm-runtime/execution-span) API page for full details.\n", - "\n", - "Example:" - ] - }, - { - "cell_type": "markdown", - "id": "ae2820bc-c762-4d2e-944c-58cbc253acbe", - "metadata": {}, - "source": [ - "To view execution span information, review the metadata of the result returned by `SamplerV2`, which comes in the form of an `ExecutionSpans` object. This object is a list-like container containing instances of subclasses of `ExecutionSpan`, such as `SliceSpan`:" - ] - }, { "cell_type": "code", "execution_count": 6,