amazon-braket / amazon-braket/amazon-braket-sdk-python

Add Cost Tracker Support for AwsQuantumJobs

未关闭
#1,043 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
requires service support
主要语言
Python
星标
373
派生
195
平均合并
4 天 15 小时
30 天内合并 PR
8

描述

The costs of a quantum task can be constrained by:
```python
device = AwsDevice("arn:aws:braket:us-west-1::device/qpu/rigetti/Ankaa-2")
with Tracker() as tracker:
while tracker.qpu_tasks_cost() < 1:
result = device.run(circ, shots=200).result()
print(tracker.quantum_tasks_statistics())
print(tracker.qpu_tasks_cost(), "USD")
```

As far as I know, there is no equivalent for AwsQuantumJobs yet. It would be nice to have a feature added so that a cost threshold for AwsQuantumJobs can be set either by:
```python
with Tracker() as tracker:
while tracker.qpu_tasks_cost() < 1:
job = AwsQuantumJob.create(
device="arn:aws:braket:::device/quantum-simulator/amazon/sv1",
source_module="src",
entry_point="src.test_code:run",
hyperparameters={},
job_name=f"job1",
)
print(tracker.quantum_tasks_statistics())
print(tracker.qpu_tasks_cost(), "USD")
```
or by adding another parameter to the .create() method.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。