amazon-braket / amazon-braket-sdk-python

A Python SDK for interacting with quantum devices on Amazon Braket
https://aws.amazon.com/braket/
Apache License 2.0
300 stars 118 forks source link

feature: context manager for reservation arns #949

Closed mbeach-aws closed 5 months ago

mbeach-aws commented 5 months ago

feature: context manager for reservation arns

Issue #, if available:

Description of changes: Adds a context manager that temporarily modifies the run method of a device object to include a specified reservation_arn in all calls within the context. This is useful for ensuring that all quantum task run within the context are associated with a given reservation ARN (Amazon Resource Name).

Example usage

with reservation(device, reservation_arn="<my_reservation_arn>"):
    task1 = device.run(circuit, shots)
    task2 = device.run(circuit, shots)

Testing done:

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (53aba5e) to head (d3bf64e).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #949 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 134 136 +2 Lines 8911 8932 +21 Branches 2007 2010 +3 ========================================= + Hits 8911 8932 +21 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

mbeach-aws commented 5 months ago

closing to make sure qiskit/PL is supported