1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
=
"""There was a problem submitting the program to QCS for execution."""
...
"""An error occured while interacting with the QPU API."""
...
"""
Data vectors within a single ``ExecutionResult``.
Variants:
- ``i32``: A register of 32-bit integers.
- ``complex64``: A register of 32-bit complex numbers.
Methods (each per variant):
- ``is_*``: if the underlying values are that type.
- ``as_*``: if the underlying values are that type, then those values, otherwise ``None``.
- ``to_*``: the underlyting values as that type, raises ``ValueError`` if they are not.
- ``from_*``: wrap underlying values as this enum type.
"""
"""Returns the inner register data."""
...
...
...
...
...
...
...
...
...
"""Execution readout data from a particular memory location."""
"""Build an `ExecutionResult` from a `Register`."""
"""The shape of the result data."""
...
"""The result data for all shots by the particular memory location."""
...
"""The type of the result data (as a `numpy` `dtype`)."""
...
"""Execution readout data for all memory locations."""
"""
The readout results of execution, mapping a published filter node to its data.
See `TranslationResult.ro_sources` which provides the mapping from the filter node name to the name of the memory declaration in the source program.
"""
...
"""
The final state of memory for parameters that were read from and written to during the exectuion of the program.
"""
"""The time spent executing the program."""
...
"""
Submits an executable `program` to be run on the specified QPU.
:param program: An executable program (see `translate`).
:param patch_values: A mapping of symbols to their desired values (see `build_patch_values`).
:param quantum_processor_id: The ID of the quantum processor to run the executable on. This field is required, unless being used with the `ConnectionStrategy.endpoint_id()` execution option.
:param client: The ``QCSClient`` to use. Creates one using environment configuration if unset - see https://docs.rigetti.com/qcs/references/qcs-client-configuration
:param execution_options: The ``ExecutionOptions`` to use. If the connection strategy option used is `ConnectionStrategy.endpoint_id("endpoint_id")`, then direct access to "endpoint_id" overrides the `quantum_processor_id` parameter.
:returns: The ID of the submitted job which can be used to fetch results
:raises LoadClientError: If there is an issue loading the QCS Client configuration.
:raises SubmissionError: If there was a problem submitting the program for execution.
"""
...
"""
Submits an executable `program` to be run on the specified QPU.
(async analog of ``submit``)
:param program: An executable program (see `translate`).
:param patch_values: A mapping of symbols to their desired values (see `build_patch_values`).
:param quantum_processor_id: The ID of the quantum processor to run the executable on. This field is required, unless being used with the `ConnectionStrategy.endpoint_id()` execution option.
:param client: The ``QCSClient`` to use. Creates one using environment configuration if unset - see https://docs.rigetti.com/qcs/references/qcs-client-configuration
:param execution_options: The ``ExecutionOptions`` to use. If the connection strategy option used is `ConnectionStrategy.endpoint_id("endpoint_id")`, then direct access to "endpoint_id" overrides the `quantum_processor_id` parameter.
:returns: The ID of the submitted job which can be used to fetch results
:raises LoadClientError: If there is an issue loading the QCS Client configuration.
:raises SubmissionError: If there was a problem submitting the program for execution.
"""
...
"""
Execute a compiled program on a QPU with multiple sets of `patch_values`.
This action is *atomic* in that all jobs will be queued, or none of them will. On success, this
function will return a list of strings where the length and order correspond to the
`patch_values` given. However, note that execution in the order of given patch values is not
guaranteed. If there is a failure to queue any of the jobs, then none will be queued.
Submits an executable `program` to be run on the specified QPU.
:param program: An executable program (see `translate`).
:param patch_values: An iterable containing one ore more mapping of symbols to their desired values
(see `build_patch_values`).
:param quantum_processor_id: The ID of the quantum processor to run the executable on. This field is required, unless being used with the `ConnectionStrategy.endpoint_id()` execution option.
:param client: The ``QCSClient`` to use. Creates one using environment configuration if unset - see https://docs.rigetti.com/qcs/references/qcs-client-configuration
:param execution_options: The ``ExecutionOptions`` to use. If the connection strategy option used is `ConnectionStrategy.endpoint_id("endpoint_id")`, then direct access to "endpoint_id" overrides the `quantum_processor_id` parameter.
:returns: The ID of the submitted job which can be used to fetch results
:raises LoadClientError: If there is an issue loading the QCS Client configuration.
:raises SubmissionError: If there was a problem submitting any of the jobs for execution, or if no
`patch_values` are given.
"""
...
"""
Execute a compiled program on a QPU with multiple sets of `patch_values`.
(async analog of `submit_with_parameter_batch`)
This action is *atomic* in that all jobs will be queued, or none of them will. On success, this
function will return a list of strings where the length and order correspond to the
`patch_values` given. However, note that execution in the order of given patch values is not
guaranteed. If there is a failure to queue any of the jobs, then none will be queued.
Submits an executable `program` to be run on the specified QPU.
:param program: An executable program (see `translate`).
:param patch_values: An iterable containing one ore more mapping of symbols to their desired values
(see `build_patch_values`).
:param quantum_processor_id: The ID of the quantum processor to run the executable on. This field is required, unless being used with the `ConnectionStrategy.endpoint_id()` execution option.
:param client: The ``QCSClient`` to use. Creates one using environment configuration if unset - see https://docs.rigetti.com/qcs/references/qcs-client-configuration
:param execution_options: The ``ExecutionOptions`` to use. If the connection strategy option used is `ConnectionStrategy.endpoint_id("endpoint_id")`, then direct access to "endpoint_id" overrides the `quantum_processor_id` parameter.
:returns: The ID of the submitted job which can be used to fetch results
:raises LoadClientError: If there is an issue loading the QCS Client configuration.
:raises SubmissionError: If there was a problem submitting any of the jobs for execution, or if no
`patch_values` are given.
"""
...
"""
Cancel a job that has yet to begin executing.
This action is *not* atomic, and will attempt to cancel a job even if it cannot be cancelled. A
job can be cancelled only if it has not yet started executing.
Success response indicates only that the request was received. Cancellation is not guaranteed,
as it is based on job state at the time of cancellation, and is completed on a best effort
basis.
:param job_id: The job ID to cancel.
:param quantum_processor_id: The quantum processor to execute the job on. This parameter is
required unless using the `ConnectionStrategy.endpoint_id()` execution option.
:client: - The `QCSClient` to use.
:execution_options: The `ExecutionOptions` to use. If the connection strategy used is
ConnectionStrategy.endpoint_id() then direct access to that endpoint overrides the
`quantum_processor_id` parameter.
"""
...
"""
Cancel a job that has yet to begin executing (async analog of `cancel_job`).
This action is *not* atomic, and will attempt to cancel a job even if it cannot be cancelled. A
job can be cancelled only if it has not yet started executing.
Success response indicates only that the request was received. Cancellation is not guaranteed,
as it is based on job state at the time of cancellation, and is completed on a best effort
basis.
:param job_id: The job ID to cancel.
:param quantum_processor_id: The quantum processor to execute the job on. This parameter is
required unless using the `ConnectionStrategy.endpoint_id()` execution option.
:client: - The `QCSClient` to use.
:execution_options: The `ExecutionOptions` to use. If the connection strategy used is
ConnectionStrategy.endpoint_id() then direct access to that endpoint overrides the
`quantum_processor_id` parameter.
"""
...
"""
Cancel all given jobs that have yet to begin executing.
This action is *not* atomic, and will attempt to cancel every job even when some jobs cannot be
cancelled. A job can be cancelled only if it has not yet started executing.
Success response indicates only that the request was received. Cancellation is not guaranteed,
as it is based on job state at the time of cancellation, and is completed on a best effort
basis.
:param quantum_processor_id: The quantum processor to execute the job on. This parameter is
required unless using the `ConnectionStrategy.endpoint_id()` execution option.
:param job_ids: The job IDs to cancel.
:client: - The `QCSClient` to use.
:execution_options: The `ExecutionOptions` to use. If the connection strategy used is
ConnectionStrategy.endpoint_id() then direct access to that endpoint overrides the
`quantum_processor_id` parameter.
"""
...
"""
Cancel all given jobs that have yet to begin executing (async analog of `cancel_jobs`).
Success response indicates only that the request was received. Cancellation is not guaranteed,
as it is based on job state at the time of cancellation, and is completed on a best effort
basis.
:param quantum_processor_id: The quantum processor to execute the job on. This parameter is
required unless using the `ConnectionStrategy.endpoint_id()` execution option.
:param job_ids: The job IDs to cancel.
:client: - The `QCSClient` to use.
:execution_options: The `ExecutionOptions` to use. If the connection strategy used is
ConnectionStrategy.endpoint_id() then direct access to that endpoint overrides the
`quantum_processor_id` parameter.
"""
...
"""
Fetches execution results for the given QCS Job ID.
:param job_id: The ID of the job to retrieve results for.
:param quantum_processor_id: The ID of the quantum processor the job ran on. This field is required, unless being used with the `ConnectionStrategy.endpoint_id()` execution option.
:param client: The ``QCSClient`` to use. Creates one using environment configuration if unset - see https://docs.rigetti.com/qcs/references/qcs-client-configuration
:param endpoint_id: retrieve the results of a program submitted to an explicitly provided endpoint. If `None`, the default endpoint for the given quantum_processor_id is used.
:param execution_options: The ``ExecutionOptions`` to use. If the connection strategy option used is `ConnectionStrategy.endpoint_id("endpoint_id")`, then direct access to "endpoint_id" overrides the `quantum_processor_id` parameter.
:returns: results from execution.
:raises LoadClientError: If there is an issue loading the QCS Client configuration.
:raises QpuApiError: If there was a problem retrieving the results.
"""
...
"""
Fetches execution results for the given QCS Job ID.
(async analog of ``retrieve_results``)
:param job_id: The ID of the job to retrieve results for.
:param quantum_processor_id: The ID of the quantum processor the job ran on. This field is required, unless being used with the `ConnectionStrategy.endpoint_id()` execution option.
:param client: The ``QCSClient`` to use. Creates one using environment configuration if unset - see https://docs.rigetti.com/qcs/references/qcs-client-configuration
:param endpoint_id: retrieve the results of a program submitted to an explicitly provided endpoint. If `None`, the default endpoint for the given quantum_processor_id is used.
:param execution_options: The ``ExecutionOptions`` to use. If the connection strategy option used is `ConnectionStrategy.endpoint_id("endpoint_id")`, then direct access to "endpoint_id" overrides the `quantum_processor_id` parameter.
:returns: results from execution.
:raises LoadClientError: If there is an issue loading the QCS Client configuration.
:raises QpuApiError: If there was a problem retrieving the results.
"""
...
"""Return ExecutionOptions with a reasonable set of defaults."""
...
"""Get an ``ExecutionOptionsBuilder`` that can be used to build a custom set of ``ExecutionOptions``"""
"""Get the ``ConnectionStrategy`` to be used to connect to the QPU."""
"""The time in seconds to wait before timing out a request, if any."""
"""Execution options particular to the API call at the point of execution."""
...
"""Return a builder with the default values for ``ExecutionOptions``"""
...
# This was the least clunky way of expressing connection_strategy as write only.
# Other methods exposed helper functions that didn't actually exist, while still
# requiring a getter was defined in some way.
"""Set the ``ConnectionStrategy`` used to establish a connection to the QPU."""
"""Set the number of seconds to wait before timing out. If set to `None` there is no timeout."""
"""Execution options particular to the API call at the point of execution."""
"""Build the ``ExecutionOptions`` using the options set in this builder."""
"""
Create a new QpuApiDuration with the given number of seconds and nanoseconds.
"""
...
"""The number of seconds in the duration."""
...
"""The number of nanoseconds in the duration."""
...
"""Return APIExecutionOptions with a reasonable set of defaults."""
...
"""Get an ``APIExecutionOptionsBuilder`` that can be used to build a custom set of ``APIExecutionOptions``"""
"""Whether or not to force managed settings to change, if applicable. Subject to additional authorization requirements."""
"""
The job timeout.
Note, this is the timeout while running a job; the job will be evicted from
the hardware once this time has elapsed.
If unset, the job's estimated duration will be used;
if the job does not have an estimated duration, the default
timeout is selected by the service.
The service may also enforce a maximum value for this field
The time in seconds to wait before timing out a request, if any.
"""
...
...
"""Return a builder with the default values for ``APIExecutionOptions``"""
...
"""Whether or not to force managed settings to change, if applicable. Subject to additional authorization requirements."""
"""Set the job timeout. See ``APIExecutionOptions.timeout`` for details."""
"""Build the ``APIExecutionOptions`` using the options set in this builder."""
"""The connection strategy to use when submitting and retrieiving jobs from a quantum processor."""
"""Get the default connection strategy. Currently, this is ``ConnectionStrategy.gateway()``"""
"""Connect through the publicly accessbile gateway."""
"""True if the ConnectionStrategy is to connect to the QCS gateway."""
"""Connect directly to the default endpoint, bypassing the gateway. Should only be used when you have
direct network access and an active reservation."""
"""True if the ConnectionStrategy is to use direct access."""
"""Connect directly to a specific endpoint using its ID."""
"""True if the ConnectionStrategy is to connect to a particular endpoint ID."""
"""Get the endpoint ID used by the ConnectionStrategy.
Raises an error if this ConnectionStrategy doesn't use a specific endpoint ID.
"""