Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Tracker to track number of tasks in LocalSimulator #975

Open
mbeach-aws opened this issue May 10, 2024 · 3 comments
Open

Use Tracker to track number of tasks in LocalSimulator #975

mbeach-aws opened this issue May 10, 2024 · 3 comments
Labels
good first issue Good for newcomers

Comments

@mbeach-aws
Copy link
Contributor

Describe the feature you'd like
Currently, the Tracker counts the number of on-demand tasks, but not LocalSimulator tasks. For example

from braket.aws import AwsDevice
from braket.circuits import Circuit
from braket.tracking import Tracker

circ = Circuit().h(0).cnot(0,1)
device = AwsDevice("arn:aws:braket:::device/quantum-simulator/amazon/sv1")
with Tracker() as tracker:
    task = device.run(circ, shots=1000).result()


print(tracker.quantum_tasks_statistics())
>> {'arn:aws:braket:::device/quantum-simulator/amazon/sv1':
 {'shots': 1000,
  'tasks': {'COMPLETED': 1},
  'execution_duration': datetime.timedelta(microseconds=4000),
  'billed_execution_duration': datetime.timedelta(seconds=3)}}
  
print(tracker.simulator_tasks_cost())
>> $0.00375

The proposal is to add this functionality to track task counts on local simulator like this:

from braket.aws import AwsDevice
from braket.circuits import Circuit
from braket.tracking import Tracker
from braket.devices import LocalSimulator

circ = Circuit().h(0).cnot(0,1)
device = LocalSimulator()
with Tracker() as tracker:
    task = device.run(circ, shots=1000).result()


print(tracker.quantum_tasks_statistics())
>> {'braket:local/simulator':
 {'shots': 1000,
  'tasks': {'COMPLETED': 1},
  'execution_duration': datetime.timedelta(microseconds=4000),
  'billed_execution_duration': None}}
  
print(tracker.simulator_tasks_cost())
>> $0
@rmshaffer rmshaffer added the good first issue Good for newcomers label May 14, 2024
@njones93531
Copy link

Hi! I would like to work on this task as part of unitaryhack.

@rmshaffer
Copy link
Contributor

Hi! I would like to work on this task as part of unitaryhack.

Hi @njones93531, thanks for your interest! Feel free to create a PR with your changes and we will be happy to review it and provide feedback.

@blolt
Copy link

blolt commented Jan 5, 2025

Hello! I think I've got a change for this that should be working. I am currently seeing this issue when attempting to run integ tests.

INTERNALERROR> botocore.errorfactory.AccessDeniedException: An error occurred (AccessDeniedException) when calling the CreateJob operation: This account is not authorized to use this resource. In order to access additional resources, please contact customer support

Looks like others have seen this issue before, too. I have explored the issue and solutions posted online pretty exhaustively, and now cut a support ticket to AWS to address it. Hopefully I will hear back on that soon, be able to run the integ tests, and submit a PR for this issue. We will probably want a second revision on that PR before merging, too, as there are a few details that may need ironing out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants