From 2270498b1050e5723b496bd160d4c305e03bd9c7 Mon Sep 17 00:00:00 2001
From: awstools
Date: Fri, 22 Sep 2023 18:19:57 +0000
Subject: [PATCH] feat(client-braket): This release adds support to view the
device queue depth (the number of queued quantum tasks and hybrid jobs on a
device) and queue position for a quantum task and hybrid job.
---
.../src/commands/GetDeviceCommand.ts | 7 +
.../src/commands/GetJobCommand.ts | 8 +
.../src/commands/GetQuantumTaskCommand.ts | 9 +
clients/client-braket/src/models/models_0.ts | 174 ++++++++++++++++
.../src/protocols/Aws_restJson1.ts | 25 +++
codegen/sdk-codegen/aws-models/braket.json | 196 +++++++++++++++++-
6 files changed, 417 insertions(+), 2 deletions(-)
diff --git a/clients/client-braket/src/commands/GetDeviceCommand.ts b/clients/client-braket/src/commands/GetDeviceCommand.ts
index 75f93f3a3755..074c27c1425e 100644
--- a/clients/client-braket/src/commands/GetDeviceCommand.ts
+++ b/clients/client-braket/src/commands/GetDeviceCommand.ts
@@ -65,6 +65,13 @@ export interface GetDeviceCommandOutput extends GetDeviceResponse, __MetadataBea
* // deviceType: "STRING_VALUE", // required
* // deviceStatus: "STRING_VALUE", // required
* // deviceCapabilities: "STRING_VALUE", // required
+ * // deviceQueueInfo: [ // DeviceQueueInfoList
+ * // { // DeviceQueueInfo
+ * // queue: "STRING_VALUE", // required
+ * // queueSize: "STRING_VALUE", // required
+ * // queuePriority: "STRING_VALUE",
+ * // },
+ * // ],
* // };
*
* ```
diff --git a/clients/client-braket/src/commands/GetJobCommand.ts b/clients/client-braket/src/commands/GetJobCommand.ts
index 9c45d852488c..d60bc2294f34 100644
--- a/clients/client-braket/src/commands/GetJobCommand.ts
+++ b/clients/client-braket/src/commands/GetJobCommand.ts
@@ -46,6 +46,9 @@ export interface GetJobCommandOutput extends GetJobResponse, __MetadataBearer {}
* const client = new BraketClient(config);
* const input = { // GetJobRequest
* jobArn: "STRING_VALUE", // required
+ * additionalAttributeNames: [ // HybridJobAdditionalAttributeNamesList
+ * "STRING_VALUE",
+ * ],
* };
* const command = new GetJobCommand(input);
* const response = await client.send(command);
@@ -112,6 +115,11 @@ export interface GetJobCommandOutput extends GetJobResponse, __MetadataBearer {}
* // tags: { // TagsMap
* // "": "STRING_VALUE",
* // },
+ * // queueInfo: { // HybridJobQueueInfo
+ * // queue: "STRING_VALUE", // required
+ * // position: "STRING_VALUE", // required
+ * // message: "STRING_VALUE",
+ * // },
* // };
*
* ```
diff --git a/clients/client-braket/src/commands/GetQuantumTaskCommand.ts b/clients/client-braket/src/commands/GetQuantumTaskCommand.ts
index 8eb79dc5a7fa..060bec326812 100644
--- a/clients/client-braket/src/commands/GetQuantumTaskCommand.ts
+++ b/clients/client-braket/src/commands/GetQuantumTaskCommand.ts
@@ -46,6 +46,9 @@ export interface GetQuantumTaskCommandOutput extends GetQuantumTaskResponse, __M
* const client = new BraketClient(config);
* const input = { // GetQuantumTaskRequest
* quantumTaskArn: "STRING_VALUE", // required
+ * additionalAttributeNames: [ // QuantumTaskAdditionalAttributeNamesList
+ * "STRING_VALUE",
+ * ],
* };
* const command = new GetQuantumTaskCommand(input);
* const response = await client.send(command);
@@ -64,6 +67,12 @@ export interface GetQuantumTaskCommandOutput extends GetQuantumTaskResponse, __M
* // "": "STRING_VALUE",
* // },
* // jobArn: "STRING_VALUE",
+ * // queueInfo: { // QuantumTaskQueueInfo
+ * // queue: "STRING_VALUE", // required
+ * // position: "STRING_VALUE", // required
+ * // queuePriority: "STRING_VALUE",
+ * // message: "STRING_VALUE",
+ * // },
* // };
*
* ```
diff --git a/clients/client-braket/src/models/models_0.ts b/clients/client-braket/src/models/models_0.ts
index 35119bac60a4..5bf65a25509b 100644
--- a/clients/client-braket/src/models/models_0.ts
+++ b/clients/client-braket/src/models/models_0.ts
@@ -109,6 +109,59 @@ export interface GetDeviceRequest {
deviceArn: string | undefined;
}
+/**
+ * @public
+ * @enum
+ */
+export const QueueName = {
+ JOBS_QUEUE: "JOBS_QUEUE",
+ QUANTUM_TASKS_QUEUE: "QUANTUM_TASKS_QUEUE",
+} as const;
+
+/**
+ * @public
+ */
+export type QueueName = (typeof QueueName)[keyof typeof QueueName];
+
+/**
+ * @public
+ * @enum
+ */
+export const QueuePriority = {
+ NORMAL: "Normal",
+ PRIORITY: "Priority",
+} as const;
+
+/**
+ * @public
+ */
+export type QueuePriority = (typeof QueuePriority)[keyof typeof QueuePriority];
+
+/**
+ * @public
+ * Information about tasks and jobs queued on a device.
+ */
+export interface DeviceQueueInfo {
+ /**
+ * @public
+ * The name of the queue.
+ */
+ queue: QueueName | string | undefined;
+
+ /**
+ * @public
+ * The number of jobs or tasks in the queue for a given device.
+ */
+ queueSize: string | undefined;
+
+ /**
+ * @public
+ * Optional. Specifies the priority of the queue. Tasks in a priority queue
+ * are processed before the tasks in a normal queue.
+ */
+ queuePriority?: QueuePriority | string;
+}
+
/**
* @public
* @enum
@@ -177,6 +230,12 @@ export interface GetDeviceResponse {
* Details about the capabilities of the device.
*/
deviceCapabilities: __LazyJsonString | string | undefined;
+
+ /**
+ * @public
+ * List of information about tasks and jobs queued on a device.
+ */
+ deviceQueueInfo?: DeviceQueueInfo[];
}
/**
@@ -753,6 +812,20 @@ export class ServiceQuotaExceededException extends __BaseException {
}
}
+/**
+ * @public
+ * @enum
+ */
+export const HybridJobAdditionalAttributeName = {
+ QUEUE_INFO: "QueueInfo",
+} as const;
+
+/**
+ * @public
+ */
+export type HybridJobAdditionalAttributeName =
+ (typeof HybridJobAdditionalAttributeName)[keyof typeof HybridJobAdditionalAttributeName];
+
/**
* @public
*/
@@ -762,6 +835,12 @@ export interface GetJobRequest {
* The ARN of the job to retrieve.
*/
jobArn: string | undefined;
+
+ /**
+ * @public
+ * A list of attributes to return information for.
+ */
+ additionalAttributeNames?: (HybridJobAdditionalAttributeName | string)[];
}
/**
@@ -811,6 +890,32 @@ export interface JobEventDetails {
message?: string;
}
+/**
+ * @public
+ * Information about the queue for a specified job.
+ */
+export interface HybridJobQueueInfo {
+ /**
+ * @public
+ * The name of the queue.
+ */
+ queue: QueueName | string | undefined;
+
+ /**
+ * @public
+ * Current position of the job in the jobs queue.
+ */
+ position: string | undefined;
+
+ /**
+ * @public
+ * Optional. Provides more information about the queue position. For example,
+ * if the job is complete and no longer in the queue, the message field contains
+ * that information.
+ */
+ message?: string;
+}
+
/**
* @public
* @enum
@@ -955,6 +1060,14 @@ export interface GetJobResponse {
* Amazon Braket resources.
*/
tags?: Record;
+
+ /**
+ * @public
+ * Queue information for the requested job. Only returned if
+ * QueueInfo
is specified in the additionalAttributeNames"
+ * field in the GetJob
API request.
+ */
+ queueInfo?: HybridJobQueueInfo;
}
/**
@@ -1246,6 +1359,20 @@ export class DeviceOfflineException extends __BaseException {
}
}
+/**
+ * @public
+ * @enum
+ */
+export const QuantumTaskAdditionalAttributeName = {
+ QUEUE_INFO: "QueueInfo",
+} as const;
+
+/**
+ * @public
+ */
+export type QuantumTaskAdditionalAttributeName =
+ (typeof QuantumTaskAdditionalAttributeName)[keyof typeof QuantumTaskAdditionalAttributeName];
+
/**
* @public
*/
@@ -1255,6 +1382,45 @@ export interface GetQuantumTaskRequest {
* the ARN of the task to retrieve.
*/
quantumTaskArn: string | undefined;
+
+ /**
+ * @public
+ * A list of attributes to return information for.
+ */
+ additionalAttributeNames?: (QuantumTaskAdditionalAttributeName | string)[];
+}
+
+/**
+ * @public
+ * Information about the queue for the specified quantum task.
+ */
+export interface QuantumTaskQueueInfo {
+ /**
+ * @public
+ * The name of the queue.
+ */
+ queue: QueueName | string | undefined;
+
+ /**
+ * @public
+ * Current position of the task in the quantum tasks queue.
+ */
+ position: string | undefined;
+
+ /**
+ * @public
+ * Optional. Specifies the priority of the queue. Quantum tasks in a priority queue
+ * are processed before the tasks in a normal queue.
+ */
+ queuePriority?: QueuePriority | string;
+
+ /**
+ * @public
+ * Optional. Provides more information about the queue position. For example,
+ * if the task is complete and no longer in the queue, the message field contains
+ * that information.
+ */
+ message?: string;
}
/**
@@ -1351,6 +1517,14 @@ export interface GetQuantumTaskResponse {
* The ARN of the Amazon Braket job associated with the quantum task.
*/
jobArn?: string;
+
+ /**
+ * @public
+ * Queue information for the requested quantum task. Only returned if
+ * QueueInfo
is specified in the additionalAttributeNames"
+ * field in the GetQuantumTask
API request.
+ */
+ queueInfo?: QuantumTaskQueueInfo;
}
/**
diff --git a/clients/client-braket/src/protocols/Aws_restJson1.ts b/clients/client-braket/src/protocols/Aws_restJson1.ts
index dd2ab40a7443..3e37ee04476a 100644
--- a/clients/client-braket/src/protocols/Aws_restJson1.ts
+++ b/clients/client-braket/src/protocols/Aws_restJson1.ts
@@ -239,6 +239,12 @@ export const se_GetJobCommand = async (input: GetJobCommandInput, context: __Ser
const headers: any = {};
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/job/{jobArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "jobArn", () => input.jobArn!, "{jobArn}", false);
+ const query: any = map({
+ additionalAttributeNames: [
+ () => input.additionalAttributeNames !== void 0,
+ () => (input.additionalAttributeNames! || []).map((_entry) => _entry as any),
+ ],
+ });
let body: any;
return new __HttpRequest({
protocol,
@@ -247,6 +253,7 @@ export const se_GetJobCommand = async (input: GetJobCommandInput, context: __Ser
method: "GET",
headers,
path: resolvedPath,
+ query,
body,
});
};
@@ -270,6 +277,12 @@ export const se_GetQuantumTaskCommand = async (
"{quantumTaskArn}",
false
);
+ const query: any = map({
+ additionalAttributeNames: [
+ () => input.additionalAttributeNames !== void 0,
+ () => (input.additionalAttributeNames! || []).map((_entry) => _entry as any),
+ ],
+ });
let body: any;
return new __HttpRequest({
protocol,
@@ -278,6 +291,7 @@ export const se_GetQuantumTaskCommand = async (
method: "GET",
headers,
path: resolvedPath,
+ query,
body,
});
};
@@ -732,6 +746,7 @@ export const de_GetDeviceCommand = async (
deviceArn: __expectString,
deviceCapabilities: (_) => new __LazyJsonString(_),
deviceName: __expectString,
+ deviceQueueInfo: _json,
deviceStatus: __expectString,
deviceType: __expectString,
providerName: __expectString,
@@ -807,6 +822,7 @@ export const de_GetJobCommand = async (
jobArn: __expectString,
jobName: __expectString,
outputDataConfig: _json,
+ queueInfo: _json,
roleArn: __expectString,
startedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
status: __expectString,
@@ -876,6 +892,7 @@ export const de_GetQuantumTaskCommand = async (
outputS3Bucket: __expectString,
outputS3Directory: __expectString,
quantumTaskArn: __expectString,
+ queueInfo: _json,
shots: __expectLong,
status: __expectString,
tags: _json,
@@ -1466,10 +1483,16 @@ const de_ValidationExceptionRes = async (parsedOutput: any, context: __SerdeCont
// de_DeviceConfig omitted.
+// de_DeviceQueueInfo omitted.
+
+// de_DeviceQueueInfoList omitted.
+
// de_DeviceSummary omitted.
// de_DeviceSummaryList omitted.
+// de_HybridJobQueueInfo omitted.
+
// de_HyperParameters omitted.
// de_InputConfigList omitted.
@@ -1535,6 +1558,8 @@ const de_JobSummaryList = (output: any, context: __SerdeContext): JobSummary[] =
return retVal;
};
+// de_QuantumTaskQueueInfo omitted.
+
/**
* deserializeAws_restJson1QuantumTaskSummary
*/
diff --git a/codegen/sdk-codegen/aws-models/braket.json b/codegen/sdk-codegen/aws-models/braket.json
index 8f59f4ba9972..aa329a7c45ee 100644
--- a/codegen/sdk-codegen/aws-models/braket.json
+++ b/codegen/sdk-codegen/aws-models/braket.json
@@ -1297,6 +1297,40 @@
"smithy.api#httpError": 424
}
},
+ "com.amazonaws.braket#DeviceQueueInfo": {
+ "type": "structure",
+ "members": {
+ "queue": {
+ "target": "com.amazonaws.braket#QueueName",
+ "traits": {
+ "smithy.api#documentation": "The name of the queue.
",
+ "smithy.api#required": {}
+ }
+ },
+ "queueSize": {
+ "target": "smithy.api#String",
+ "traits": {
+ "smithy.api#documentation": "The number of jobs or tasks in the queue for a given device.
",
+ "smithy.api#required": {}
+ }
+ },
+ "queuePriority": {
+ "target": "com.amazonaws.braket#QueuePriority",
+ "traits": {
+ "smithy.api#documentation": "Optional. Specifies the priority of the queue. Tasks in a priority queue\n are processed before the tasks in a normal queue.
"
+ }
+ }
+ },
+ "traits": {
+ "smithy.api#documentation": "Information about tasks and jobs queued on a device.
"
+ }
+ },
+ "com.amazonaws.braket#DeviceQueueInfoList": {
+ "type": "list",
+ "member": {
+ "target": "com.amazonaws.braket#DeviceQueueInfo"
+ }
+ },
"com.amazonaws.braket#DeviceResource": {
"type": "resource",
"identifiers": {
@@ -1504,6 +1538,12 @@
"smithy.api#documentation": "Details about the capabilities of the device.
",
"smithy.api#required": {}
}
+ },
+ "deviceQueueInfo": {
+ "target": "com.amazonaws.braket#DeviceQueueInfoList",
+ "traits": {
+ "smithy.api#documentation": "List of information about tasks and jobs queued on a device.
"
+ }
}
}
},
@@ -1551,6 +1591,13 @@
"smithy.api#httpLabel": {},
"smithy.api#required": {}
}
+ },
+ "additionalAttributeNames": {
+ "target": "com.amazonaws.braket#HybridJobAdditionalAttributeNamesList",
+ "traits": {
+ "smithy.api#documentation": "A list of attributes to return information for.
",
+ "smithy.api#httpQuery": "additionalAttributeNames"
+ }
}
}
},
@@ -1686,6 +1733,12 @@
"traits": {
"smithy.api#documentation": "A tag object that consists of a key and an optional value, used to manage metadata for\n Amazon Braket resources.
"
}
+ },
+ "queueInfo": {
+ "target": "com.amazonaws.braket#HybridJobQueueInfo",
+ "traits": {
+ "smithy.api#documentation": "Queue information for the requested job. Only returned if \n QueueInfo
is specified in the additionalAttributeNames\"
\n field in the GetJob
API request.
"
+ }
}
}
},
@@ -1733,6 +1786,13 @@
"smithy.api#httpLabel": {},
"smithy.api#required": {}
}
+ },
+ "additionalAttributeNames": {
+ "target": "com.amazonaws.braket#QuantumTaskAdditionalAttributeNamesList",
+ "traits": {
+ "smithy.api#documentation": "A list of attributes to return information for.
",
+ "smithy.api#httpQuery": "additionalAttributeNames"
+ }
}
}
},
@@ -1820,7 +1880,58 @@
"traits": {
"smithy.api#documentation": "The ARN of the Amazon Braket job associated with the quantum task.
"
}
+ },
+ "queueInfo": {
+ "target": "com.amazonaws.braket#QuantumTaskQueueInfo",
+ "traits": {
+ "smithy.api#documentation": "Queue information for the requested quantum task. Only returned if \n QueueInfo
is specified in the additionalAttributeNames\"
\n field in the GetQuantumTask
API request.
"
+ }
+ }
+ }
+ },
+ "com.amazonaws.braket#HybridJobAdditionalAttributeName": {
+ "type": "string",
+ "traits": {
+ "smithy.api#enum": [
+ {
+ "value": "QueueInfo",
+ "name": "QUEUE_INFO"
+ }
+ ]
+ }
+ },
+ "com.amazonaws.braket#HybridJobAdditionalAttributeNamesList": {
+ "type": "list",
+ "member": {
+ "target": "com.amazonaws.braket#HybridJobAdditionalAttributeName"
+ }
+ },
+ "com.amazonaws.braket#HybridJobQueueInfo": {
+ "type": "structure",
+ "members": {
+ "queue": {
+ "target": "com.amazonaws.braket#QueueName",
+ "traits": {
+ "smithy.api#documentation": "The name of the queue.
",
+ "smithy.api#required": {}
+ }
+ },
+ "position": {
+ "target": "smithy.api#String",
+ "traits": {
+ "smithy.api#documentation": "Current position of the job in the jobs queue.
",
+ "smithy.api#required": {}
+ }
+ },
+ "message": {
+ "target": "smithy.api#String",
+ "traits": {
+ "smithy.api#documentation": "Optional. Provides more information about the queue position. For example,\n if the job is complete and no longer in the queue, the message field contains\n that information.
"
+ }
}
+ },
+ "traits": {
+ "smithy.api#documentation": "Information about the queue for a specified job.
"
}
},
"com.amazonaws.braket#HyperParameters": {
@@ -2449,6 +2560,23 @@
}
}
},
+ "com.amazonaws.braket#QuantumTaskAdditionalAttributeName": {
+ "type": "string",
+ "traits": {
+ "smithy.api#enum": [
+ {
+ "value": "QueueInfo",
+ "name": "QUEUE_INFO"
+ }
+ ]
+ }
+ },
+ "com.amazonaws.braket#QuantumTaskAdditionalAttributeNamesList": {
+ "type": "list",
+ "member": {
+ "target": "com.amazonaws.braket#QuantumTaskAdditionalAttributeName"
+ }
+ },
"com.amazonaws.braket#QuantumTaskArn": {
"type": "string",
"traits": {
@@ -2457,11 +2585,45 @@
"resource": "com.amazonaws.braket#QuantumTaskResource"
},
"smithy.api#length": {
- "min": 1,
+ "min": 0,
"max": 256
}
}
},
+ "com.amazonaws.braket#QuantumTaskQueueInfo": {
+ "type": "structure",
+ "members": {
+ "queue": {
+ "target": "com.amazonaws.braket#QueueName",
+ "traits": {
+ "smithy.api#documentation": "The name of the queue.
",
+ "smithy.api#required": {}
+ }
+ },
+ "position": {
+ "target": "smithy.api#String",
+ "traits": {
+ "smithy.api#documentation": "Current position of the task in the quantum tasks queue.
",
+ "smithy.api#required": {}
+ }
+ },
+ "queuePriority": {
+ "target": "com.amazonaws.braket#QueuePriority",
+ "traits": {
+ "smithy.api#documentation": "Optional. Specifies the priority of the queue. Quantum tasks in a priority queue\n are processed before the tasks in a normal queue.
"
+ }
+ },
+ "message": {
+ "target": "smithy.api#String",
+ "traits": {
+ "smithy.api#documentation": "Optional. Provides more information about the queue position. For example,\n if the task is complete and no longer in the queue, the message field contains\n that information.
"
+ }
+ }
+ },
+ "traits": {
+ "smithy.api#documentation": "Information about the queue for the specified quantum task.
"
+ }
+ },
"com.amazonaws.braket#QuantumTaskResource": {
"type": "resource",
"identifiers": {
@@ -2600,6 +2762,36 @@
"target": "com.amazonaws.braket#QuantumTaskSummary"
}
},
+ "com.amazonaws.braket#QueueName": {
+ "type": "string",
+ "traits": {
+ "smithy.api#enum": [
+ {
+ "value": "QUANTUM_TASKS_QUEUE",
+ "name": "QUANTUM_TASKS_QUEUE"
+ },
+ {
+ "value": "JOBS_QUEUE",
+ "name": "JOBS_QUEUE"
+ }
+ ]
+ }
+ },
+ "com.amazonaws.braket#QueuePriority": {
+ "type": "string",
+ "traits": {
+ "smithy.api#enum": [
+ {
+ "value": "Normal",
+ "name": "NORMAL"
+ },
+ {
+ "value": "Priority",
+ "name": "PRIORITY"
+ }
+ ]
+ }
+ },
"com.amazonaws.braket#ResourceNotFoundException": {
"type": "structure",
"members": {
@@ -3331,4 +3523,4 @@
}
}
}
-}
\ No newline at end of file
+}