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

[braket] support reservation ARN #2553

Merged
merged 7 commits into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions runtime/common/BraketExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class BraketExecutor : public Executor {

std::shared_future<std::string> defaultBucketFuture;
char const *jobToken;
char const *reservationArn;

std::chrono::microseconds pollingInterval = std::chrono::milliseconds{100};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "common/BraketExecutor.h"
#include "common/BraketServerHelper.h"

#include <aws/braket/model/Association.h>
#include <aws/braket/model/AssociationType.h>
#include <aws/braket/model/CreateQuantumTaskRequest.h>
#include <aws/braket/model/GetQuantumTaskRequest.h>
#include <aws/braket/model/QuantumTaskStatus.h>
Expand Down Expand Up @@ -100,7 +102,8 @@ void tryCreateBucket(Aws::S3Crt::S3CrtClient &client, std::string const &region,

namespace cudaq {
BraketExecutor::BraketExecutor()
: api(options), jobToken(std::getenv("AMZN_BRAKET_JOB_TOKEN")) {}
: api(options), jobToken(std::getenv("AMZN_BRAKET_JOB_TOKEN")),
reservationArn(std::getenv("AMZN_BRAKET_RESERVATION_TIME_WINDOW_ARN")) {}

/// @brief Set the server helper
void BraketExecutor::setServerHelper(ServerHelper *helper) {
Expand Down Expand Up @@ -190,6 +193,15 @@ BraketExecutor::execute(std::vector<KernelExecution> &codesToExecute,
req.SetShots(message["shots"]);
if (jobToken)
req.SetJobToken(jobToken);

if (reservationArn) {
Aws::Braket::Model::Association assoc;
assoc.SetArn(reservationArn);
assoc.SetType(
Aws::Braket::Model::AssociationType::RESERVATION_TIME_WINDOW_ARN);
req.AddAssociations(std::move(assoc));
}

req.SetOutputS3Bucket(defaultBucket);
req.SetOutputS3KeyPrefix(defaultPrefix);

Expand Down
Loading