Fix #68: make the S3 bucket optional and fall back to Braket's default bucket - #100
Open
corgab wants to merge 2 commits into
Open
Fix #68: make the S3 bucket optional and fall back to Braket's default bucket#100corgab wants to merge 2 commits into
corgab wants to merge 2 commits into
Conversation
…ucket The aws driver refused to run without a bucket, on the PHP side through requiredConfig() and on the Python side through run_options(), even though AwsDevice.run() and run_batch() default the S3 destination to the SDK's own amazon-braket-<region>-<account> bucket, created on demand. A first run against the free SV1 simulator therefore failed until the user created a bucket by hand. The bucket is now an optional override: when set, results go to s3://<bucket>/results as before; when unset, run_options() returns no destination and the SDK applies its default. Config comment, README and both test suites describe and cover the two branches. Closes #68
…IAM need A bucket made of whitespace slipped past both sides once the PHP required key check was gone, so run_options() now strips the value and treats an empty result as "use the SDK default"; the PHP tests cover the null and empty-string shapes config/aether.php actually produces. The README, the config comment and the driver docblock say that the default bucket is created on first use and therefore needs s3:CreateBucket.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
awsdriver refused to run without a bucket:AwsBraketDriver::requiredConfig()listed it andproviders/aws.py::run_options()raisedValueErrorwhen it was empty. The Braket SDK does not need it:AwsDevice.run()andrun_batch()defaults3_destination_folderto(aws_session.default_bucket(), "tasks"), theamazon-braket-<region>-<account>bucket the SDK creates on demand. A firstQuantum::circuit('aws')->run()against the free SV1 simulator therefore failed withInvalidDriverConfigExceptionuntil the user created a bucket by hand and wired an env var.Plan
Treat the bucket as an optional override, the way a Laravel package treats any setting the underlying SDK already has a sensible default for: keep
AETHER_S3_BUCKETas the way to route results to a bucket of your own, and let the SDK pick its default when it is unset or blank. Say what the default costs in permissions.Changes
AwsBraketDriver::requiredConfig():['region', 'device_arn']; docblock explains the SDK default and thes3:CreateBucketit needs.bin/python/providers/aws.py::run_options(): trims the configured bucket; returns{"s3_destination_folder": (bucket, "results")}when one is left and{}otherwise (unset, null, empty or whitespace-only), sodevice.run()andrun_batch()apply their own default. No moreValueError.config/aether.php: comment onbucketdescribing both cases and the IAM requirement. README "Configuration": the env example leaves the bucket blank with a comment, and the paragraph now says which keys are required, what happens with and without a bucket, and that the default bucket needss3:CreateBucketon the calling credentials.No new dependencies. Behaviour change for existing installs: a configured bucket keeps working unchanged; a previously failing empty bucket now runs against the SDK default bucket instead of throwing.
Tests
tests/python/test_providers.py:run_optionsreturns{}for a missing, blank, null or whitespace-only bucket (the old "raises" test is replaced), trims a padded name, and still returns the destination folder when a bucket is set.AwsBraketDriverTest: the missing-keys message no longer namesbucket; a driver configured without a bucket key, withnull(unset env var) and with''(blank env line) runsexecuteCircuit()through to the bridge.{}assertions fail onmain.Local: pint passed, pest 794 tests passed, pytest 53 passed.
Closes #68