qcs-sdk-python 0.16.5rc0__tar.gz → 0.17.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/Cargo.lock +76 -15
  2. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/Cargo.toml +4 -4
  3. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/PKG-INFO +1 -1
  4. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/CHANGELOG.md +56 -0
  5. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/Cargo.toml +1 -1
  6. qcs_sdk_python-0.17.0/crates/lib/examples/execute.rs +57 -0
  7. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/client.rs +7 -3
  8. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/executable.rs +1 -0
  9. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qpu/api.rs +40 -16
  10. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qpu/execution.rs +2 -0
  11. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qpu/translation.rs +33 -26
  12. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/tests/mocked_qpu.rs +14 -1
  13. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/CHANGELOG.md +56 -0
  14. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/Cargo.toml +1 -1
  15. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/qpu/translation.pyi +7 -34
  16. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/qpu/translation.rs +9 -41
  17. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/qpu/test_translation.py +2 -2
  18. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/pyproject.toml +2 -2
  19. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/qpu/translation.pyi +7 -34
  20. qcs_sdk_python-0.16.5rc0/crates/lib/examples/execute.rs +0 -31
  21. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/README.md +0 -0
  22. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/Makefile.toml +0 -0
  23. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/README.md +0 -0
  24. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/build.rs +0 -0
  25. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/examples/delayed_job_retrieval.rs +0 -0
  26. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/examples/libquil.rs +0 -0
  27. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/examples/local.rs +0 -0
  28. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/examples/parametric_compilation.rs +0 -0
  29. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/examples/quil_t.rs +0 -0
  30. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/bin/diagnostics.rs +0 -0
  31. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/compiler/isa/edge.rs +0 -0
  32. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/compiler/isa/mod.rs +0 -0
  33. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/compiler/isa/operator.rs +0 -0
  34. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/compiler/isa/qubit.rs +0 -0
  35. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/compiler/libquil.rs +0 -0
  36. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/compiler/mod.rs +0 -0
  37. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/compiler/quilc.rs +0 -0
  38. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/compiler/rpcq.rs +0 -0
  39. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/diagnostics.rs +0 -0
  40. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/execution_data.rs +0 -0
  41. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/lib.rs +0 -0
  42. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qpu/mod.rs +0 -0
  43. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qpu/result_data.rs +0 -0
  44. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qpu/rewrite_arithmetic.rs +0 -0
  45. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qpu/snapshots/qcs__qpu__rewrite_arithmetic__describe_rewrite_arithmetic__it_allocates_for_multiple_expressions-2.snap +0 -0
  46. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qpu/snapshots/qcs__qpu__rewrite_arithmetic__describe_rewrite_arithmetic__it_allocates_for_multiple_expressions.snap +0 -0
  47. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qpu/snapshots/qcs__qpu__rewrite_arithmetic__describe_rewrite_arithmetic__it_converts_frequency_expressions-2.snap +0 -0
  48. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qpu/snapshots/qcs__qpu__rewrite_arithmetic__describe_rewrite_arithmetic__it_converts_frequency_expressions.snap +0 -0
  49. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qpu/snapshots/qcs__qpu__rewrite_arithmetic__describe_rewrite_arithmetic__it_converts_phases.snap +0 -0
  50. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qpu/snapshots/qcs__qpu__rewrite_arithmetic__describe_rewrite_arithmetic__it_converts_set_scale_units.snap +0 -0
  51. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qpu/snapshots/qcs__qpu__rewrite_arithmetic__describe_rewrite_arithmetic__it_substitutes_and_reuses_gate_expressions.snap +0 -0
  52. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qpu/snapshots/qcs__qpu__rewrite_arithmetic__describe_rewrite_arithmetic__it_substitutes_gate_parameters.snap +0 -0
  53. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qvm/execution.rs +0 -0
  54. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qvm/http.rs +0 -0
  55. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qvm/libquil.rs +0 -0
  56. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qvm/mod.rs +0 -0
  57. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/qvm/snapshots/qcs__qvm__test__apply_valid_parameters_to_program.snap +0 -0
  58. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/src/register_data.rs +0 -0
  59. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/tests/aspen_9_isa.json +0 -0
  60. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/tests/basic_qvm.rs +0 -0
  61. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/tests/bell_state_response_data.hex +0 -0
  62. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/tests/compiler-isa-Aspen-8.json +0 -0
  63. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/tests/parametric_compilation.rs +0 -0
  64. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/tests/qcs-isa-Aspen-8.json +0 -0
  65. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/tests/qvm_api.rs +0 -0
  66. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/tests/qvm_isa.json +0 -0
  67. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/tests/secrets.toml +0 -0
  68. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/lib/tests/settings.toml +0 -0
  69. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/.flake8 +0 -0
  70. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/.stubtest-allowlist +0 -0
  71. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/Makefile.toml +0 -0
  72. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/README.md +0 -0
  73. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/build.rs +0 -0
  74. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/poetry.lock +0 -0
  75. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/__init__.py +0 -0
  76. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/__init__.pyi +0 -0
  77. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/client.py +0 -0
  78. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/client.pyi +0 -0
  79. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/compiler/__init__.py +0 -0
  80. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/compiler/__init__.pyi +0 -0
  81. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/compiler/quilc.pyi +0 -0
  82. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/diagnostics.py +0 -0
  83. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/py.typed +0 -0
  84. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/qpu/__init__.py +0 -0
  85. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/qpu/__init__.pyi +0 -0
  86. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/qpu/api.pyi +0 -0
  87. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/qpu/isa.pyi +0 -0
  88. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/qpu/rewrite_arithmetic.pyi +0 -0
  89. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/qvm/__init__.py +0 -0
  90. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/qvm/__init__.pyi +0 -0
  91. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/qcs_sdk/qvm/api.pyi +0 -0
  92. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/client.rs +0 -0
  93. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/compiler/mod.rs +0 -0
  94. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/compiler/quilc.rs +0 -0
  95. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/executable.rs +0 -0
  96. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/execution_data.rs +0 -0
  97. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/from_py.rs +0 -0
  98. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/grpc/mod.rs +0 -0
  99. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/grpc/models/controller.rs +0 -0
  100. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/grpc/models/mod.rs +0 -0
  101. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/lib.rs +0 -0
  102. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/py_sync.rs +0 -0
  103. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/qpu/api.rs +0 -0
  104. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/qpu/isa.rs +0 -0
  105. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/qpu/mod.rs +0 -0
  106. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/qpu/result_data.rs +0 -0
  107. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/qpu/rewrite_arithmetic.rs +0 -0
  108. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/qvm/api.rs +0 -0
  109. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/qvm/mod.rs +0 -0
  110. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/src/register_data.rs +0 -0
  111. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/_fixtures/aspen-m-3.json +0 -0
  112. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/_fixtures/device-2q.json +0 -0
  113. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/_qcs_config/secrets.toml +0 -0
  114. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/_qcs_config/settings.toml +0 -0
  115. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/compiler/__snapshots__/test_quilc.ambr +0 -0
  116. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/compiler/test_quilc.py +0 -0
  117. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/conftest.py +0 -0
  118. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/execution_data/test_execution_data.py +0 -0
  119. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/qpu/test_api.py +0 -0
  120. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/qpu/test_isa.py +0 -0
  121. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/qpu/test_qpu.py +0 -0
  122. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/qpu/test_rewrite_arithmetic.py +0 -0
  123. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/qvm/test_qvm.py +0 -0
  124. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/test_client.py +0 -0
  125. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/test_diagnostics.py +0 -0
  126. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/test_executable.py +0 -0
  127. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/crates/python/tests/test_logging.py +0 -0
  128. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/__init__.py +0 -0
  129. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/__init__.pyi +0 -0
  130. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/client.py +0 -0
  131. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/client.pyi +0 -0
  132. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/compiler/__init__.py +0 -0
  133. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/compiler/__init__.pyi +0 -0
  134. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/compiler/quilc.pyi +0 -0
  135. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/diagnostics.py +0 -0
  136. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/py.typed +0 -0
  137. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/qpu/__init__.py +0 -0
  138. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/qpu/__init__.pyi +0 -0
  139. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/qpu/api.pyi +0 -0
  140. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/qpu/isa.pyi +0 -0
  141. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/qpu/rewrite_arithmetic.pyi +0 -0
  142. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/qvm/__init__.py +0 -0
  143. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/qvm/__init__.pyi +0 -0
  144. {qcs_sdk_python-0.16.5rc0 → qcs_sdk_python-0.17.0}/qcs_sdk/qvm/api.pyi +0 -0
@@ -186,6 +186,20 @@ dependencies = [
186
186
  "tower-service",
187
187
  ]
188
188
 
189
+ [[package]]
190
+ name = "backoff"
191
+ version = "0.4.0"
192
+ source = "registry+https://github.com/rust-lang/crates.io-index"
193
+ checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1"
194
+ dependencies = [
195
+ "futures-core",
196
+ "getrandom",
197
+ "instant",
198
+ "pin-project-lite",
199
+ "rand",
200
+ "tokio",
201
+ ]
202
+
189
203
  [[package]]
190
204
  name = "backtrace"
191
205
  version = "0.3.69"
@@ -380,6 +394,15 @@ version = "1.0.0"
380
394
  source = "registry+https://github.com/rust-lang/crates.io-index"
381
395
  checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
382
396
 
397
+ [[package]]
398
+ name = "chrono"
399
+ version = "0.4.34"
400
+ source = "registry+https://github.com/rust-lang/crates.io-index"
401
+ checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b"
402
+ dependencies = [
403
+ "num-traits",
404
+ ]
405
+
383
406
  [[package]]
384
407
  name = "clang-sys"
385
408
  version = "0.29.3"
@@ -575,6 +598,9 @@ name = "deranged"
575
598
  version = "0.3.10"
576
599
  source = "registry+https://github.com/rust-lang/crates.io-index"
577
600
  checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc"
601
+ dependencies = [
602
+ "powerfmt",
603
+ ]
578
604
 
579
605
  [[package]]
580
606
  name = "derive_builder"
@@ -1604,6 +1630,12 @@ dependencies = [
1604
1630
  "serde",
1605
1631
  ]
1606
1632
 
1633
+ [[package]]
1634
+ name = "num-conv"
1635
+ version = "0.1.0"
1636
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1637
+ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
1638
+
1607
1639
  [[package]]
1608
1640
  name = "num-integer"
1609
1641
  version = "0.1.45"
@@ -1817,6 +1849,21 @@ dependencies = [
1817
1849
  "prost-types",
1818
1850
  ]
1819
1851
 
1852
+ [[package]]
1853
+ name = "pbjson-types"
1854
+ version = "0.5.1"
1855
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1856
+ checksum = "4a88c8d87f99a4ac14325e7a4c24af190fca261956e3b82dd7ed67e77e6c7043"
1857
+ dependencies = [
1858
+ "bytes",
1859
+ "chrono",
1860
+ "pbjson",
1861
+ "pbjson-build",
1862
+ "prost",
1863
+ "prost-build",
1864
+ "serde",
1865
+ ]
1866
+
1820
1867
  [[package]]
1821
1868
  name = "peeking_take_while"
1822
1869
  version = "0.1.2"
@@ -1886,6 +1933,12 @@ version = "0.3.27"
1886
1933
  source = "registry+https://github.com/rust-lang/crates.io-index"
1887
1934
  checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
1888
1935
 
1936
+ [[package]]
1937
+ name = "powerfmt"
1938
+ version = "0.2.0"
1939
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1940
+ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
1941
+
1889
1942
  [[package]]
1890
1943
  name = "ppv-lite86"
1891
1944
  version = "0.2.17"
@@ -2054,7 +2107,7 @@ dependencies = [
2054
2107
 
2055
2108
  [[package]]
2056
2109
  name = "qcs"
2057
- version = "0.20.6-rc.0"
2110
+ version = "0.21.0"
2058
2111
  dependencies = [
2059
2112
  "assert2",
2060
2113
  "async-trait",
@@ -2114,11 +2167,12 @@ dependencies = [
2114
2167
 
2115
2168
  [[package]]
2116
2169
  name = "qcs-api-client-common"
2117
- version = "0.7.9"
2170
+ version = "0.7.10"
2118
2171
  source = "registry+https://github.com/rust-lang/crates.io-index"
2119
- checksum = "cc3356caa74bb697c4271c950a3040e8dbb9448a9bd0124411b9b43155b8e192"
2172
+ checksum = "36b591a8d1498c533f714c6b6f420ffbab9577e6fc92b0d07d05b9e6e3689e90"
2120
2173
  dependencies = [
2121
2174
  "async-trait",
2175
+ "backoff",
2122
2176
  "futures",
2123
2177
  "home",
2124
2178
  "http",
@@ -2126,6 +2180,7 @@ dependencies = [
2126
2180
  "reqwest",
2127
2181
  "serde",
2128
2182
  "thiserror",
2183
+ "time",
2129
2184
  "tokio",
2130
2185
  "toml 0.7.8",
2131
2186
  "tracing",
@@ -2135,10 +2190,11 @@ dependencies = [
2135
2190
 
2136
2191
  [[package]]
2137
2192
  name = "qcs-api-client-grpc"
2138
- version = "0.7.9"
2193
+ version = "0.7.12"
2139
2194
  source = "registry+https://github.com/rust-lang/crates.io-index"
2140
- checksum = "37bd1842ca3485e8c0abf36be4cbcee1ea12e97da15ac731ce9dae20f7f58f41"
2195
+ checksum = "52716630ac986eabf83be964118fa5cc109f50e3404e37b5a6a7a8e801ea96a8"
2141
2196
  dependencies = [
2197
+ "backoff",
2142
2198
  "http",
2143
2199
  "http-body",
2144
2200
  "hyper",
@@ -2149,11 +2205,13 @@ dependencies = [
2149
2205
  "opentelemetry_api",
2150
2206
  "pbjson",
2151
2207
  "pbjson-build",
2208
+ "pbjson-types",
2152
2209
  "prost",
2153
2210
  "prost-build",
2154
2211
  "qcs-api-client-common",
2155
2212
  "serde",
2156
2213
  "thiserror",
2214
+ "tokio",
2157
2215
  "tonic",
2158
2216
  "tonic-build",
2159
2217
  "tower",
@@ -2164,9 +2222,9 @@ dependencies = [
2164
2222
 
2165
2223
  [[package]]
2166
2224
  name = "qcs-api-client-openapi"
2167
- version = "0.8.9"
2225
+ version = "0.8.11"
2168
2226
  source = "registry+https://github.com/rust-lang/crates.io-index"
2169
- checksum = "c605c4bdf887f487dbe7c0055f303728a992a6d508eedc55d7efa41b36adba07"
2227
+ checksum = "ff1892f58e793ff0d68110736583c88a442a9690ceb3e59dc65cd2daf3fbec29"
2170
2228
  dependencies = [
2171
2229
  "anyhow",
2172
2230
  "qcs-api-client-common",
@@ -2176,6 +2234,7 @@ dependencies = [
2176
2234
  "serde",
2177
2235
  "serde_json",
2178
2236
  "task-local-extensions",
2237
+ "tokio",
2179
2238
  "tracing",
2180
2239
  "url",
2181
2240
  "urlpattern",
@@ -2183,7 +2242,7 @@ dependencies = [
2183
2242
 
2184
2243
  [[package]]
2185
2244
  name = "qcs-sdk-python"
2186
- version = "0.16.5-rc.0"
2245
+ version = "0.17.0"
2187
2246
  dependencies = [
2188
2247
  "async-trait",
2189
2248
  "numpy",
@@ -2421,7 +2480,6 @@ dependencies = [
2421
2480
  "num-traits",
2422
2481
  "paste",
2423
2482
  "pyo3",
2424
- "time",
2425
2483
  ]
2426
2484
 
2427
2485
  [[package]]
@@ -3063,12 +3121,14 @@ dependencies = [
3063
3121
 
3064
3122
  [[package]]
3065
3123
  name = "time"
3066
- version = "0.3.28"
3124
+ version = "0.3.34"
3067
3125
  source = "registry+https://github.com/rust-lang/crates.io-index"
3068
- checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48"
3126
+ checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749"
3069
3127
  dependencies = [
3070
3128
  "deranged",
3071
3129
  "itoa",
3130
+ "num-conv",
3131
+ "powerfmt",
3072
3132
  "serde",
3073
3133
  "time-core",
3074
3134
  "time-macros",
@@ -3076,16 +3136,17 @@ dependencies = [
3076
3136
 
3077
3137
  [[package]]
3078
3138
  name = "time-core"
3079
- version = "0.1.1"
3139
+ version = "0.1.2"
3080
3140
  source = "registry+https://github.com/rust-lang/crates.io-index"
3081
- checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
3141
+ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
3082
3142
 
3083
3143
  [[package]]
3084
3144
  name = "time-macros"
3085
- version = "0.2.14"
3145
+ version = "0.2.17"
3086
3146
  source = "registry+https://github.com/rust-lang/crates.io-index"
3087
- checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572"
3147
+ checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774"
3088
3148
  dependencies = [
3149
+ "num-conv",
3089
3150
  "time-core",
3090
3151
  ]
3091
3152
 
@@ -4,9 +4,9 @@ resolver = "2"
4
4
 
5
5
  [workspace.dependencies]
6
6
  qcs-api = "0.2.1"
7
- qcs-api-client-common = "0.7.9"
8
- qcs-api-client-grpc = "0.7.9"
9
- qcs-api-client-openapi = "0.8.9"
7
+ qcs-api-client-common = "0.7.10"
8
+ qcs-api-client-grpc = "0.7.12"
9
+ qcs-api-client-openapi = "0.8.11"
10
10
  serde_json = "1.0.86"
11
11
  thiserror = "1.0.37"
12
12
  tokio = "1.34.0"
@@ -27,7 +27,7 @@ numpy = "0.20.0"
27
27
  pyo3 = "0.20.0"
28
28
  pyo3-asyncio = { version = "0.20", features = ["tokio-runtime"] }
29
29
  pyo3-build-config = "0.20.0"
30
- rigetti-pyo3 = { version = "0.3.1", features = ["complex"] }
30
+ rigetti-pyo3 = { version = "0.3.1", default-features = false, features = ["complex"] }
31
31
 
32
32
  # The primary intent of these options is to reduce the binary size for Python wheels
33
33
  # since PyPi has limits on how much storage a project can use.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qcs-sdk-python
3
- Version: 0.16.5rc0
3
+ Version: 0.17.0
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: License :: OSI Approved :: Apache Software License
6
6
  Classifier: Programming Language :: Python :: 3.8
@@ -1,3 +1,59 @@
1
+ ## 0.21.0
2
+
3
+ ### Breaking Changes
4
+
5
+ - The calibration program is now from
6
+ `get_quilt_calibrations` as a string. The error variants have also been
7
+ slightly modified.
8
+
9
+ * simplify error map
10
+
11
+ * cleanup test
12
+
13
+ * put calibration in mock calibration program
14
+
15
+ ### Features
16
+
17
+ - Automatically retry requests that fail due to transient network errors, fgequests to cancel job no longer error due to missing target. (#443)
18
+
19
+ ## 0.21.0-rc.1
20
+
21
+ ### Breaking Changes
22
+
23
+ - The calibration program is now from
24
+ `get_quilt_calibrations` as a string. The error variants have also been
25
+ slightly modified.
26
+
27
+ * simplify error map
28
+
29
+ * cleanup test
30
+
31
+ * put calibration in mock calibration program
32
+
33
+ ### Features
34
+
35
+ - Automatically retry requests that fail due to transient network errors, fgequests to cancel job no longer error due to missing target. (#443)
36
+
37
+ ## 0.21.0-rc.0
38
+
39
+ ### Breaking Changes
40
+
41
+ - The calibration program is now from
42
+ `get_quilt_calibrations` as a string. The error variants have also been
43
+ slightly modified.
44
+
45
+ * simplify error map
46
+
47
+ * cleanup test
48
+
49
+ * put calibration in mock calibration program
50
+
51
+ ## 0.20.6
52
+
53
+ ### Features
54
+
55
+ - Jobs that have yet to begin executing can be cancelled. (#438)
56
+
1
57
  ## 0.20.6-rc.0
2
58
 
3
59
  ### Features
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  name = "qcs"
3
3
  description = "High level interface for running Quil on a QPU"
4
- version = "0.20.6-rc.0"
4
+ version = "0.21.0"
5
5
  edition = "2018"
6
6
  license = "Apache-2.0"
7
7
  repository = "https://github.com/rigetti/qcs-sdk-rust"
@@ -0,0 +1,57 @@
1
+ use std::f64::consts::PI;
2
+
3
+ use qcs::{client::Qcs, compiler::rpcq, qpu::api::ExecutionOptions, Executable};
4
+
5
+ const PROGRAM: &str = r#"
6
+ DECLARE ro BIT[2]
7
+ DECLARE theta REAL
8
+ RX(theta) 0
9
+ CNOT 0 1
10
+ MEASURE 0 ro[0]
11
+ MEASURE 1 ro[1]
12
+ "#;
13
+
14
+ async fn quilc_client() -> rpcq::Client {
15
+ let qcs = Qcs::load().await;
16
+ let endpoint = qcs.get_config().quilc_url();
17
+ rpcq::Client::new(endpoint).unwrap()
18
+ }
19
+
20
+ #[tokio::main]
21
+ async fn main() {
22
+ let mut exe = Executable::from_quil(PROGRAM).with_quilc_client(Some(quilc_client().await));
23
+ let execution_options = ExecutionOptions::default();
24
+
25
+ // You can submit a job to a QPU and retrieve results in a single step.
26
+ let result = exe
27
+ .with_parameter("theta", 0, PI)
28
+ .execute_on_qpu("Ankaa-2", None, &execution_options)
29
+ .await
30
+ .expect("Program should execute successfully");
31
+
32
+ dbg!(&result);
33
+
34
+ // Or you can submit a job, then retrieve results later.
35
+ let handle = exe
36
+ .with_parameter("theta", 0, PI / 2.0)
37
+ .submit_to_qpu("Ankaa-2", None, &execution_options)
38
+ .await
39
+ .expect("Program should be sumbitted successfully.");
40
+
41
+ // You can use the job handle to attempt job cancellation. This will only succeed if the job
42
+ // has not begun executing.
43
+ let cancelled_result = exe.cancel_qpu_job(handle.clone()).await;
44
+ dbg!(&cancelled_result);
45
+ let cancelled = cancelled_result.is_ok();
46
+
47
+ // Retrieving results will return an error if the job was successfully cancelled.
48
+ let result = exe.retrieve_results(handle.clone()).await;
49
+ if !cancelled {
50
+ println!("Job was not cancelled");
51
+ assert!(result.is_ok());
52
+ } else {
53
+ println!("Job was cancelled");
54
+ assert!(result.is_err());
55
+ }
56
+ dbg!(&result);
57
+ }
@@ -6,7 +6,10 @@ use std::time::Duration;
6
6
 
7
7
  use qcs_api_client_common::configuration::{ClientConfiguration, RefreshError};
8
8
  use qcs_api_client_grpc::{
9
- channel::{get_channel, parse_uri, wrap_channel_with, RefreshService},
9
+ channel::{
10
+ get_channel, parse_uri, wrap_channel_with, wrap_channel_with_retry, RefreshService,
11
+ RetryService,
12
+ },
10
13
  services::translation::translation_client::TranslationClient,
11
14
  };
12
15
  use qcs_api_client_openapi::apis::configuration::Configuration as OpenApiConfiguration;
@@ -21,7 +24,7 @@ pub use qcs_api_client_openapi::apis::Error as OpenApiError;
21
24
  /// It is public so that users can create gRPC clients with different APIs using a "raw" connection
22
25
  /// initialized by this library. This ensures that the exact Tonic version used for such clients
23
26
  /// matches what this library uses.
24
- pub type GrpcConnection = RefreshService<Channel, ClientConfiguration>;
27
+ pub type GrpcConnection = RetryService<RefreshService<Channel, ClientConfiguration>>;
25
28
 
26
29
  /// TODO: make configurable at the client level.
27
30
  /// <https://github.com/rigetti/qcs-sdk-rust/issues/239>
@@ -88,7 +91,8 @@ impl Qcs {
88
91
  ) -> Result<TranslationClient<GrpcConnection>, GrpcError<RefreshError>> {
89
92
  let uri = parse_uri(translation_grpc_endpoint)?;
90
93
  let channel = get_channel(uri)?;
91
- let service = wrap_channel_with(channel, self.get_config().clone());
94
+ let service =
95
+ wrap_channel_with_retry(wrap_channel_with(channel, self.get_config().clone()));
92
96
  Ok(TranslationClient::new(service))
93
97
  }
94
98
  }
@@ -715,6 +715,7 @@ impl From<ExecutionError> for Error {
715
715
  ExecutionError::Unexpected(inner) => Self::Unexpected(format!("{inner:?}")),
716
716
  ExecutionError::Quilc { .. } => Self::Connection(Service::Quilc),
717
717
  ExecutionError::QcsClient(v) => Self::Unexpected(format!("{v:?}")),
718
+ ExecutionError::Translation(v) => Self::Translation(v.to_string()),
718
719
  ExecutionError::Isa(v) => Self::Unexpected(format!("{v:?}")),
719
720
  ExecutionError::ReadoutParse(v) => Self::Unexpected(format!("{v:?}")),
720
721
  ExecutionError::Quil(e) => Self::Quil(e),
@@ -8,17 +8,17 @@ use derive_builder::Builder;
8
8
  use qcs_api_client_common::configuration::RefreshError;
9
9
  pub use qcs_api_client_grpc::channel::Error as GrpcError;
10
10
  use qcs_api_client_grpc::{
11
- channel::{parse_uri, wrap_channel_with},
11
+ channel::{parse_uri, wrap_channel_with, wrap_channel_with_retry},
12
12
  get_channel_with_timeout,
13
13
  models::controller::{
14
14
  controller_job_execution_result, data_value::Value, ControllerJobExecutionResult,
15
15
  DataValue, EncryptedControllerJob, JobExecutionConfiguration, RealDataValue,
16
16
  },
17
17
  services::controller::{
18
- controller_client::ControllerClient, execute_controller_job_request,
19
- get_controller_job_results_request, CancelControllerJobsRequest,
20
- ExecuteControllerJobRequest, ExecutionOptions as InnerApiExecutionOptions,
21
- GetControllerJobResultsRequest,
18
+ cancel_controller_jobs_request, controller_client::ControllerClient,
19
+ execute_controller_job_request, get_controller_job_results_request,
20
+ CancelControllerJobsRequest, ExecuteControllerJobRequest,
21
+ ExecutionOptions as InnerApiExecutionOptions, GetControllerJobResultsRequest,
22
22
  },
23
23
  };
24
24
  pub use qcs_api_client_openapi::apis::Error as OpenApiError;
@@ -131,9 +131,8 @@ pub async fn submit(
131
131
  /// This action is *not* atomic, and will attempt to cancel every job even when some jobs cannot be
132
132
  /// cancelled. A job can be cancelled only if it has not yet started executing.
133
133
  ///
134
- /// Success response indicates only that the request was received. Cancellation is not guaranteed,
135
- /// as it is based on job state at the time of cancellation, and is completed on a best effort
136
- /// basis.
134
+ /// Cancellation is not guaranteed, as it is based on job state at the time of cancellation, and is
135
+ /// completed on a best effort basis.
137
136
  ///
138
137
  /// # Arguments
139
138
  /// * `quantum_processor_id` - The quantum processor to execute the job on. This parameter
@@ -144,20 +143,25 @@ pub async fn submit(
144
143
  /// * `execution_options` - The [`ExecutionOptions`] to use. If the connection strategy used
145
144
  /// is [`ConnectionStrategy::EndpointId`] then direct access to that endpoint
146
145
  /// overrides the `quantum_processor_id` parameter.
146
+ ///
147
+ /// # Errors
148
+ /// * Returns [`QpuApiError::GrpcClientError`] with [`GrpcClientError::RequestFailed`] if any of
149
+ /// the jobs could not be cancelled.
147
150
  pub async fn cancel_jobs(
148
151
  job_ids: Vec<JobId>,
149
152
  quantum_processor_id: Option<&str>,
150
153
  client: &Qcs,
151
154
  execution_options: &ExecutionOptions,
152
155
  ) -> Result<(), QpuApiError> {
153
- let request = CancelControllerJobsRequest {
154
- job_ids: job_ids.into_iter().map(|id| id.0).collect(),
155
- };
156
-
157
156
  let mut controller_client = execution_options
158
157
  .get_controller_client(client, quantum_processor_id)
159
158
  .await?;
160
159
 
160
+ let request = CancelControllerJobsRequest {
161
+ job_ids: job_ids.into_iter().map(|id| id.0).collect(),
162
+ target: execution_options.get_cancel_target(quantum_processor_id),
163
+ };
164
+
161
165
  controller_client
162
166
  .cancel_controller_jobs(request)
163
167
  .await
@@ -171,9 +175,8 @@ pub async fn cancel_jobs(
171
175
  /// This action is *not* atomic, and will attempt to cancel a job even if it cannot be cancelled. A
172
176
  /// job can be cancelled only if it has not yet started executing.
173
177
  ///
174
- /// Success response indicates only that the request was received. Cancellation is not guaranteed,
175
- /// as it is based on job state at the time of cancellation, and is completed on a best effort
176
- /// basis.
178
+ /// Cancellation is not guaranteed, as it is based on job state at the time of cancellation, and is
179
+ /// completed on a best effort basis.
177
180
  ///
178
181
  /// # Arguments
179
182
  /// * `quantum_processor_id` - The quantum processor to execute the job on. This parameter is
@@ -184,6 +187,10 @@ pub async fn cancel_jobs(
184
187
  /// * `execution_options` - The [`ExecutionOptions`] to use. If the connection strategy used is
185
188
  /// [`ConnectionStrategy::EndpointId`] then direct access to that endpoint overrides the
186
189
  /// `quantum_processor_id` parameter.
190
+ ///
191
+ /// # Errors
192
+ /// * Returns [`QpuApiError::GrpcClientError`] with [`GrpcClientError::RequestFailed`] if the
193
+ /// job could not be cancelled.
187
194
  pub async fn cancel_job(
188
195
  job_id: JobId,
189
196
  quantum_processor_id: Option<&str>,
@@ -404,6 +411,20 @@ impl ExecutionOptions {
404
411
  }
405
412
  }
406
413
 
414
+ fn get_cancel_target(
415
+ &self,
416
+ quantum_processor_id: Option<&str>,
417
+ ) -> Option<cancel_controller_jobs_request::Target> {
418
+ match self.connection_strategy() {
419
+ ConnectionStrategy::EndpointId(endpoint_id) => Some(
420
+ cancel_controller_jobs_request::Target::EndpointId(endpoint_id.to_string()),
421
+ ),
422
+ ConnectionStrategy::Gateway | ConnectionStrategy::DirectAccess => quantum_processor_id
423
+ .map(String::from)
424
+ .map(cancel_controller_jobs_request::Target::QuantumProcessorId),
425
+ }
426
+ }
427
+
407
428
  /// Get a controller client for the given QPU ID.
408
429
  pub async fn get_controller_client(
409
430
  &self,
@@ -457,7 +478,10 @@ impl ExecutionOptions {
457
478
  let uri = parse_uri(address).map_err(QpuApiError::GrpcError)?;
458
479
  let channel = get_channel_with_timeout(uri, self.timeout())
459
480
  .map_err(|err| QpuApiError::GrpcError(err.into()))?;
460
- Ok(wrap_channel_with(channel, client.get_config().clone()))
481
+ Ok(wrap_channel_with_retry(wrap_channel_with(
482
+ channel,
483
+ client.get_config().clone(),
484
+ )))
461
485
  }
462
486
 
463
487
  async fn get_gateway_address(
@@ -51,6 +51,8 @@ pub(crate) enum Error {
51
51
  Quilc { uri: String, details: String },
52
52
  #[error("Problem using QCS API: {0}")]
53
53
  QcsClient(#[from] GrpcClientError),
54
+ #[error(transparent)]
55
+ Translation(#[from] super::translation::Error),
54
56
  #[error("Problem fetching ISA: {0}")]
55
57
  Isa(#[from] GetIsaError),
56
58
  #[error("Problem parsing memory readout: {0}")]
@@ -8,17 +8,25 @@ use qcs_api_client_grpc::{
8
8
  services::translation::{
9
9
  translate_quil_to_encrypted_controller_job_request::NumShots,
10
10
  translation_options::TranslationBackend, BackendV1Options, BackendV2Options,
11
+ GetQuantumProcessorQuilCalibrationProgramRequest,
11
12
  TranslateQuilToEncryptedControllerJobRequest, TranslationOptions as ApiTranslationOptions,
12
13
  },
13
14
  };
14
- use qcs_api_client_openapi::{
15
- apis::{translation_api, Error as OpenAPIError},
16
- models::GetQuiltCalibrationsResponse,
17
- };
18
15
  use tokio::time::error::Elapsed;
19
16
 
20
17
  use crate::client::{GrpcClientError, Qcs, DEFAULT_HTTP_API_TIMEOUT};
21
18
 
19
+ /// Errors that can occur when making a request to translation service.
20
+ #[derive(Debug, thiserror::Error)]
21
+ pub enum Error {
22
+ /// Error due to gRPC client
23
+ #[error(transparent)]
24
+ Grpc(#[from] GrpcClientError),
25
+ /// Error due to client timeout
26
+ #[error("Client configured timeout exceeded")]
27
+ ClientTimeout(#[from] Elapsed),
28
+ }
29
+
22
30
  /// An encrypted and translated program, along with `readout_map`
23
31
  /// to map job `readout_data` back to program-declared variables.
24
32
  #[derive(Debug)]
@@ -40,7 +48,7 @@ pub async fn translate<TO>(
40
48
  num_shots: u32,
41
49
  client: &Qcs,
42
50
  translation_options: Option<TO>,
43
- ) -> Result<EncryptedTranslationResult, GrpcClientError>
51
+ ) -> Result<EncryptedTranslationResult, Error>
44
52
  where
45
53
  TO: Into<ApiTranslationOptions>,
46
54
  {
@@ -61,9 +69,11 @@ where
61
69
  };
62
70
 
63
71
  let response = client
64
- .get_translation_client()?
72
+ .get_translation_client()
73
+ .map_err(GrpcClientError::from)?
65
74
  .translate_quil_to_encrypted_controller_job(request)
66
- .await?
75
+ .await
76
+ .map_err(GrpcClientError::from)?
67
77
  .into_inner();
68
78
 
69
79
  Ok(EncryptedTranslationResult {
@@ -77,36 +87,33 @@ where
77
87
  })
78
88
  }
79
89
 
80
- /// API Errors encountered when trying to get Quil-T calibrations.
81
- #[derive(Debug, thiserror::Error)]
82
- pub enum GetQuiltCalibrationsError {
83
- /// Failed the http call
84
- #[error("Failed to get Quil-T calibrations via API: {0}")]
85
- ApiError(#[from] OpenAPIError<translation_api::GetQuiltCalibrationsError>),
86
-
87
- /// API call did not finish before timeout
88
- #[error("API call did not finish before timeout.")]
89
- TimeoutError(#[from] Elapsed),
90
- }
91
-
92
90
  /// Query the QCS API for Quil-T calibrations.
93
91
  /// If `None`, the default `timeout` used is 10 seconds.
94
92
  pub async fn get_quilt_calibrations(
95
- quantum_processor_id: &str,
93
+ quantum_processor_id: String,
96
94
  client: &Qcs,
97
95
  timeout: Option<Duration>,
98
- ) -> Result<GetQuiltCalibrationsResponse, GetQuiltCalibrationsError> {
96
+ ) -> Result<String, Error> {
99
97
  #[cfg(feature = "tracing")]
100
98
  tracing::debug!("getting Quil-T calibrations for {}", quantum_processor_id);
101
99
 
102
100
  let timeout = timeout.unwrap_or(DEFAULT_HTTP_API_TIMEOUT);
103
101
 
102
+ let mut translation_client = client
103
+ .get_translation_client()
104
+ .map_err(GrpcClientError::from)?;
105
+
104
106
  tokio::time::timeout(timeout, async move {
105
- Ok(translation_api::get_quilt_calibrations(
106
- &client.get_openapi_client(),
107
- quantum_processor_id,
108
- )
109
- .await?)
107
+ Ok(translation_client
108
+ .get_quantum_processor_quil_calibration_program(
109
+ GetQuantumProcessorQuilCalibrationProgramRequest {
110
+ quantum_processor_id,
111
+ },
112
+ )
113
+ .await
114
+ .map_err(GrpcClientError::from)?
115
+ .into_inner()
116
+ .quil_calibration_program)
110
117
  })
111
118
  .await?
112
119
  }