Skip to content

Commit 20e5869

Browse files
authored
[braket] support reservation ARN (#2553)
* support reservation arn * DCO Remediation Commit for Tim <[email protected]> I, Tim <[email protected]>, hereby add my Signed-off-by to this commit: 955d837 Signed-off-by: Tim <[email protected]> * fix: run clang formatter Signed-off-by: Tim <[email protected]> --------- Signed-off-by: Tim <[email protected]>
1 parent 3602887 commit 20e5869

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

runtime/common/BraketExecutor.h

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class BraketExecutor : public Executor {
5555

5656
std::shared_future<std::string> defaultBucketFuture;
5757
char const *jobToken;
58+
char const *reservationArn;
5859

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

runtime/cudaq/platform/default/rest/helpers/braket/BraketExecutor.cpp

+13-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "common/BraketExecutor.h"
1010
#include "common/BraketServerHelper.h"
1111

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

101103
namespace cudaq {
102104
BraketExecutor::BraketExecutor()
103-
: api(options), jobToken(std::getenv("AMZN_BRAKET_JOB_TOKEN")) {}
105+
: api(options), jobToken(std::getenv("AMZN_BRAKET_JOB_TOKEN")),
106+
reservationArn(std::getenv("AMZN_BRAKET_RESERVATION_TIME_WINDOW_ARN")) {}
104107

105108
/// @brief Set the server helper
106109
void BraketExecutor::setServerHelper(ServerHelper *helper) {
@@ -190,6 +193,15 @@ BraketExecutor::execute(std::vector<KernelExecution> &codesToExecute,
190193
req.SetShots(message["shots"]);
191194
if (jobToken)
192195
req.SetJobToken(jobToken);
196+
197+
if (reservationArn) {
198+
Aws::Braket::Model::Association assoc;
199+
assoc.SetArn(reservationArn);
200+
assoc.SetType(
201+
Aws::Braket::Model::AssociationType::RESERVATION_TIME_WINDOW_ARN);
202+
req.AddAssociations(std::move(assoc));
203+
}
204+
193205
req.SetOutputS3Bucket(defaultBucket);
194206
req.SetOutputS3KeyPrefix(defaultPrefix);
195207

0 commit comments

Comments
 (0)