|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 | 4 | "cell_type": "markdown",
|
5 |
| - "id": "a47ac9aa-4bb9-4240-806e-9beabfd2dda2", |
| 5 | + "id": "97b94d47-ba58-4251-91f2-93097e50f2c9", |
6 | 6 | "metadata": {},
|
7 | 7 | "source": [
|
8 | 8 | "# Introduction to Qiskit Functions\n",
|
|
22 | 22 | },
|
23 | 23 | {
|
24 | 24 | "cell_type": "markdown",
|
25 |
| - "id": "0be0fe02-bc50-45a6-aaf6-2120dac862c2", |
| 25 | + "id": "a4c425ca-c6c6-4232-b4b9-b2a365d10ad9", |
26 | 26 | "metadata": {
|
27 | 27 | "tags": [
|
28 | 28 | "version-info"
|
|
45 | 45 | },
|
46 | 46 | {
|
47 | 47 | "cell_type": "markdown",
|
48 |
| - "id": "098d8fd4-1558-40df-a1b1-ad70fdef8863", |
| 48 | + "id": "1fe03d0f-c7bb-439b-b98e-91ca400b62fc", |
49 | 49 | "metadata": {},
|
50 | 50 | "source": [
|
51 | 51 | "Qiskit Functions simplify and accelerate utility-scale algorithm discovery and application development, by abstracting away parts of the quantum software development workflow. In this way, Qiskit Functions free up time normally spent hand-writing code and fine-tuning experiments.\n",
|
|
61 | 61 | },
|
62 | 62 | {
|
63 | 63 | "cell_type": "markdown",
|
64 |
| - "id": "df18227b-787a-4dc6-a8c7-7abd0f67110c", |
| 64 | + "id": "5e5b0531-f286-4573-8b1e-664ca5496d2d", |
65 | 65 | "metadata": {},
|
66 | 66 | "source": [
|
67 | 67 | "Functions are provided by IBM® and third-party partners. Each is performant for specific workload characteristics and have unique performance-tuning options. Premium Plan users can get started with IBM Qiskit Functions for free, or procure a license from one of the partners who have contributed a function to the catalog.\n",
|
|
103 | 103 | {
|
104 | 104 | "cell_type": "code",
|
105 | 105 | "execution_count": 1,
|
106 |
| - "id": "e872c222-aee9-40eb-8778-9a8e5434a11c", |
| 106 | + "id": "6699700c-ae26-4c10-8d09-05ee77a1afb7", |
107 | 107 | "metadata": {},
|
108 | 108 | "outputs": [],
|
109 | 109 | "source": [
|
|
115 | 115 | },
|
116 | 116 | {
|
117 | 117 | "cell_type": "markdown",
|
118 |
| - "id": "80441467-1d9a-4107-8570-22afa6e369f7", |
| 118 | + "id": "a00d2d76-dfbe-4a92-be82-8dea393ff12a", |
119 | 119 | "metadata": {},
|
120 | 120 | "source": [
|
121 | 121 | "<LegacyContent>\n",
|
|
151 | 151 | },
|
152 | 152 | {
|
153 | 153 | "cell_type": "markdown",
|
154 |
| - "id": "6f2d0a37-1c6d-4cad-a9ce-c4d05c7aaaf1", |
| 154 | + "id": "374939e2-54ac-4b72-92df-19a5fe9ec352", |
155 | 155 | "metadata": {},
|
156 | 156 | "source": [
|
157 | 157 | "<LegacyContent>\n",
|
|
172 | 172 | },
|
173 | 173 | {
|
174 | 174 | "cell_type": "markdown",
|
175 |
| - "id": "5154cbea-ccfa-42ea-a9ef-c31699c3b2c0", |
| 175 | + "id": "e3cada45-0364-4096-8481-6eb99d43c656", |
176 | 176 | "metadata": {},
|
177 | 177 | "source": [
|
178 | 178 | "4. After you have authenticated, you can list the functions from the Qiskit Functions Catalog that you have access to:"
|
|
181 | 181 | {
|
182 | 182 | "cell_type": "code",
|
183 | 183 | "execution_count": 2,
|
184 |
| - "id": "55b73ad8-6e3b-4b76-8ba5-ae7ea339ffcc", |
| 184 | + "id": "275b4b94-7656-403e-8997-941c03c7ef55", |
185 | 185 | "metadata": {},
|
186 | 186 | "outputs": [
|
187 | 187 | {
|
|
210 | 210 | },
|
211 | 211 | {
|
212 | 212 | "cell_type": "markdown",
|
213 |
| - "id": "a1c73799-30ec-44dc-b4b9-06e59d521d8c", |
| 213 | + "id": "de09ad8c-bd6d-4a02-8b24-7bb73beca811", |
214 | 214 | "metadata": {},
|
215 | 215 | "source": [
|
216 | 216 | "### Run enabled functions\n",
|
|
221 | 221 | {
|
222 | 222 | "cell_type": "code",
|
223 | 223 | "execution_count": 3,
|
224 |
| - "id": "4ac22236-2a34-46fb-890f-30d6ba70081e", |
| 224 | + "id": "65a26da5-f537-44ed-9cb4-b335518d009d", |
225 | 225 | "metadata": {},
|
226 | 226 | "outputs": [],
|
227 | 227 | "source": [
|
|
230 | 230 | },
|
231 | 231 | {
|
232 | 232 | "cell_type": "markdown",
|
233 |
| - "id": "deb844d3-051a-4db1-b0a1-4ba9801ef95e", |
| 233 | + "id": "0a5f87e4-3082-4ec5-a7ae-7ddb5c35632a", |
234 | 234 | "metadata": {},
|
235 | 235 | "source": [
|
236 | 236 | "Each Qiskit Function has custom inputs, options, and outputs. Check the specific documentation pages for the function you want to run for more information. By default, all users can only run one function job at a time:"
|
|
241 | 241 | "execution_count": null,
|
242 | 242 | "id": "139ac1d5-3727-4f44-a26c-0d8a1d8a58f2",
|
243 | 243 | "metadata": {
|
| 244 | + "scrolled": true, |
244 | 245 | "tags": [
|
245 | 246 | "remove-cell"
|
246 | 247 | ]
|
|
289 | 290 | },
|
290 | 291 | {
|
291 | 292 | "cell_type": "markdown",
|
292 |
| - "id": "b1518e8e-04ea-4e4e-9f30-10f87dd4ee82", |
| 293 | + "id": "113d4382-a987-492d-9e12-b66d3b955bc4", |
293 | 294 | "metadata": {},
|
294 | 295 | "source": [
|
295 | 296 | "### Check job status\n",
|
|
311 | 312 | {
|
312 | 313 | "cell_type": "code",
|
313 | 314 | "execution_count": 6,
|
314 |
| - "id": "d811be20-cf0d-4070-a126-b40af6a33132", |
| 315 | + "id": "d0574d73-0966-4426-b2f5-94df72a07caa", |
315 | 316 | "metadata": {},
|
316 | 317 | "outputs": [
|
317 | 318 | {
|
|
331 | 332 | },
|
332 | 333 | {
|
333 | 334 | "cell_type": "markdown",
|
334 |
| - "id": "8e6528b5-c36f-48e1-bb2f-2416ccb12902", |
| 335 | + "id": "439fbefc-f7d3-4e6e-b3e6-61a3664ac5e9", |
335 | 336 | "metadata": {},
|
336 | 337 | "source": [
|
337 | 338 | "### Retrieve results\n",
|
|
342 | 343 | {
|
343 | 344 | "cell_type": "code",
|
344 | 345 | "execution_count": 7,
|
345 |
| - "id": "04f6a446-fbc6-438a-bc07-00fc9d551d83", |
| 346 | + "id": "45e302d8-f3c2-4868-8b7c-6d451f6119a9", |
346 | 347 | "metadata": {},
|
347 | 348 | "outputs": [
|
348 | 349 | {
|
|
360 | 361 | },
|
361 | 362 | {
|
362 | 363 | "cell_type": "markdown",
|
363 |
| - "id": "76c32136-f449-454c-896b-ff9d0edf9abc", |
| 364 | + "id": "d809d8fa-479c-4c3b-81d7-3408925cec68", |
364 | 365 | "metadata": {},
|
365 | 366 | "source": [
|
366 | 367 | "You can also cancel a job at any time:"
|
|
369 | 370 | {
|
370 | 371 | "cell_type": "code",
|
371 | 372 | "execution_count": 8,
|
372 |
| - "id": "7ddc2394-64a9-4fdd-bb3d-7729433fcd9c", |
| 373 | + "id": "0e55d4d6-4680-4671-907f-35aac16971ef", |
373 | 374 | "metadata": {},
|
374 | 375 | "outputs": [
|
375 | 376 | {
|
|
389 | 390 | },
|
390 | 391 | {
|
391 | 392 | "cell_type": "markdown",
|
392 |
| - "id": "5b5d7c8d-7a96-41e2-93aa-528513acdd21", |
| 393 | + "id": "1ef980bc-9030-4f8a-84d6-a0abd15923ac", |
393 | 394 | "metadata": {},
|
394 | 395 | "source": [
|
395 | 396 | "### List previously run jobs run with Qiskit Functions\n",
|
|
399 | 400 | },
|
400 | 401 | {
|
401 | 402 | "cell_type": "code",
|
402 |
| - "execution_count": 9, |
403 |
| - "id": "c1a2832b-1ca3-4ef1-9a8a-3f3804b3aedf", |
| 403 | + "execution_count": 8, |
| 404 | + "id": "4becfe13-68dd-481d-bb43-fc502c254623", |
404 | 405 | "metadata": {},
|
405 | 406 | "outputs": [
|
406 | 407 | {
|
|
418 | 419 | " <Job | eaa2db93-0d2f-4b52-9f1b-a69fc03dc3d6>]"
|
419 | 420 | ]
|
420 | 421 | },
|
421 |
| - "execution_count": 9, |
| 422 | + "execution_count": 8, |
422 | 423 | "metadata": {},
|
423 | 424 | "output_type": "execute_result"
|
424 | 425 | }
|
|
430 | 431 | },
|
431 | 432 | {
|
432 | 433 | "cell_type": "markdown",
|
433 |
| - "id": "9137071a-e39c-4b66-afbd-697db38cc670", |
| 434 | + "id": "af7fa72a-f272-43ff-800d-5ae37dd42b2b", |
| 435 | + "metadata": {}, |
| 436 | + "source": [ |
| 437 | + "If you already have the job ID for a certain job, you can retrieve the job with `catalog.get_job_by_id()`:" |
| 438 | + ] |
| 439 | + }, |
| 440 | + { |
| 441 | + "cell_type": "code", |
| 442 | + "execution_count": null, |
| 443 | + "id": "18d87f07-8a8e-4b93-80d0-7c07e49272e2", |
| 444 | + "metadata": {}, |
| 445 | + "outputs": [], |
| 446 | + "source": [ |
| 447 | + "# First, get the most recent job that has been executed.\n", |
| 448 | + "latest_job = old_jobs[0]\n", |
| 449 | + "\n", |
| 450 | + "# We can also get that same job with get_job_by_id\n", |
| 451 | + "job_by_id = catalog.get_job_by_id(latest_job.job_id)\n", |
| 452 | + "\n", |
| 453 | + "# Verify that the job is the same using both retrieval methods.\n", |
| 454 | + "assert job_by_id == latest_job\n", |
| 455 | + "\n", |
| 456 | + "# Print the job_id for this job.\n", |
| 457 | + "print(job_by_id.job_id)" |
| 458 | + ] |
| 459 | + }, |
| 460 | + { |
| 461 | + "cell_type": "markdown", |
| 462 | + "id": "e15f89f8-925d-4d13-8fb8-80ad1d8ac7f6", |
434 | 463 | "metadata": {},
|
435 | 464 | "source": [
|
436 | 465 | "### Fetch error messages\n",
|
|
441 | 470 | {
|
442 | 471 | "cell_type": "code",
|
443 | 472 | "execution_count": 10,
|
444 |
| - "id": "abfdf746-bc46-4df7-85b3-4a7a61ab7ca7", |
| 473 | + "id": "3e9d090a-7eb4-476e-92f8-6871803a704d", |
445 | 474 | "metadata": {},
|
446 | 475 | "outputs": [
|
447 | 476 | {
|
|
458 | 487 | },
|
459 | 488 | {
|
460 | 489 | "cell_type": "markdown",
|
461 |
| - "id": "7c8c3e5d-1de2-4fed-be03-d134dc3fd907", |
| 490 | + "id": "709b39ca-5dbd-42c0-830c-1248c2e5d63c", |
462 | 491 | "metadata": {},
|
463 | 492 | "source": [
|
464 | 493 | "## Next steps\n",
|
|
494 | 523 | "title": "Introduction to Qiskit Functions"
|
495 | 524 | },
|
496 | 525 | "nbformat": 4,
|
497 |
| - "nbformat_minor": 2 |
| 526 | + "nbformat_minor": 4 |
498 | 527 | }
|
0 commit comments