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

Add Cost Tracker Support for AwsQuantumJobs

Open
#1,043 1 comment 0 reactions 0 assignees View on GitHub
requires service support
Dominant language
Python
Stars
373
Forks
195
Avg merge
4d 15h
Merged PRs (30d)
8

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.