Skip to content

Commit

Permalink
doc: Remove STS calls from examples (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
speller26 authored Mar 16, 2021
1 parent 2bf4532 commit e86238c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ from braket.aws import AwsDevice
from braket.circuits import Circuit

device = AwsDevice("arn:aws:braket:::device/quantum-simulator/amazon/sv1")
s3_folder = (f"amazon-braket-Your-Bucket-Name", "folder-name") # Use the S3 bucket you created during onboarding
s3_folder = ("amazon-braket-Your-Bucket-Name", "folder-name") # Use the S3 bucket you created during onboarding

bell = Circuit().h(0).cnot(0, 1)
task = device.run(bell, s3_folder, shots=100)
Expand Down Expand Up @@ -114,7 +114,7 @@ from braket.circuits import Circuit
from braket.aws import AwsDevice

device = AwsDevice("arn:aws:braket:::device/qpu/rigetti/Aspen-8")
s3_folder = (f"amazon-braket-Your-Bucket-Name", "RIGETTI") # Use the S3 bucket you created during onboarding
s3_folder = ("amazon-braket-Your-Bucket-Name", "RIGETTI") # Use the S3 bucket you created during onboarding

bell = Circuit().h(0).cnot(0, 1)
task = device.run(bell, s3_folder)
Expand Down
8 changes: 3 additions & 5 deletions examples/bell.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

import boto3

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

aws_account_id = boto3.client("sts").get_caller_identity()["Account"]

device = AwsDevice("arn:aws:braket:::device/quantum-simulator/amazon/sv1")
s3_folder = (f"amazon-braket-{aws_account_id}", "folder-name")

# Use the S3 bucket you created during onboarding
s3_folder = ("amazon-braket-Your-Bucket-Name", "folder-name")

# https://wikipedia.org/wiki/Bell_state
bell = Circuit().h(0).cnot(0, 1)
Expand Down
8 changes: 3 additions & 5 deletions examples/debug_bell.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,17 @@
import logging
import sys

import boto3

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

logger = logging.getLogger("newLogger") # create new logger
logger.addHandler(logging.StreamHandler(stream=sys.stdout)) # configure to print to sys.stdout
logger.setLevel(logging.DEBUG) # print to sys.stdout all log messages with level DEBUG or above

aws_account_id = boto3.client("sts").get_caller_identity()["Account"]

device = AwsDevice("arn:aws:braket:::device/quantum-simulator/amazon/sv1")
s3_folder = (f"amazon-braket-{aws_account_id}", "folder-name")

# Use the S3 bucket you created during onboarding
s3_folder = ("amazon-braket-Your-Bucket-Name", "folder-name")

bell = Circuit().h(0).cnot(0, 1)
# pass in logger to device.run, enabling debugging logs to print to console
Expand Down

0 comments on commit e86238c

Please sign in to comment.