Skip to content

Commit 2270498

Browse files
author
awstools
committed
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.
1 parent 0558bb4 commit 2270498

File tree

6 files changed

+417
-2
lines changed

6 files changed

+417
-2
lines changed

clients/client-braket/src/commands/GetDeviceCommand.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ export interface GetDeviceCommandOutput extends GetDeviceResponse, __MetadataBea
6565
* // deviceType: "STRING_VALUE", // required
6666
* // deviceStatus: "STRING_VALUE", // required
6767
* // deviceCapabilities: "STRING_VALUE", // required
68+
* // deviceQueueInfo: [ // DeviceQueueInfoList
69+
* // { // DeviceQueueInfo
70+
* // queue: "STRING_VALUE", // required
71+
* // queueSize: "STRING_VALUE", // required
72+
* // queuePriority: "STRING_VALUE",
73+
* // },
74+
* // ],
6875
* // };
6976
*
7077
* ```

clients/client-braket/src/commands/GetJobCommand.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export interface GetJobCommandOutput extends GetJobResponse, __MetadataBearer {}
4646
* const client = new BraketClient(config);
4747
* const input = { // GetJobRequest
4848
* jobArn: "STRING_VALUE", // required
49+
* additionalAttributeNames: [ // HybridJobAdditionalAttributeNamesList
50+
* "STRING_VALUE",
51+
* ],
4952
* };
5053
* const command = new GetJobCommand(input);
5154
* const response = await client.send(command);
@@ -112,6 +115,11 @@ export interface GetJobCommandOutput extends GetJobResponse, __MetadataBearer {}
112115
* // tags: { // TagsMap
113116
* // "<keys>": "STRING_VALUE",
114117
* // },
118+
* // queueInfo: { // HybridJobQueueInfo
119+
* // queue: "STRING_VALUE", // required
120+
* // position: "STRING_VALUE", // required
121+
* // message: "STRING_VALUE",
122+
* // },
115123
* // };
116124
*
117125
* ```

clients/client-braket/src/commands/GetQuantumTaskCommand.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export interface GetQuantumTaskCommandOutput extends GetQuantumTaskResponse, __M
4646
* const client = new BraketClient(config);
4747
* const input = { // GetQuantumTaskRequest
4848
* quantumTaskArn: "STRING_VALUE", // required
49+
* additionalAttributeNames: [ // QuantumTaskAdditionalAttributeNamesList
50+
* "STRING_VALUE",
51+
* ],
4952
* };
5053
* const command = new GetQuantumTaskCommand(input);
5154
* const response = await client.send(command);
@@ -64,6 +67,12 @@ export interface GetQuantumTaskCommandOutput extends GetQuantumTaskResponse, __M
6467
* // "<keys>": "STRING_VALUE",
6568
* // },
6669
* // jobArn: "STRING_VALUE",
70+
* // queueInfo: { // QuantumTaskQueueInfo
71+
* // queue: "STRING_VALUE", // required
72+
* // position: "STRING_VALUE", // required
73+
* // queuePriority: "STRING_VALUE",
74+
* // message: "STRING_VALUE",
75+
* // },
6776
* // };
6877
*
6978
* ```

clients/client-braket/src/models/models_0.ts

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,59 @@ export interface GetDeviceRequest {
109109
deviceArn: string | undefined;
110110
}
111111

112+
/**
113+
* @public
114+
* @enum
115+
*/
116+
export const QueueName = {
117+
JOBS_QUEUE: "JOBS_QUEUE",
118+
QUANTUM_TASKS_QUEUE: "QUANTUM_TASKS_QUEUE",
119+
} as const;
120+
121+
/**
122+
* @public
123+
*/
124+
export type QueueName = (typeof QueueName)[keyof typeof QueueName];
125+
126+
/**
127+
* @public
128+
* @enum
129+
*/
130+
export const QueuePriority = {
131+
NORMAL: "Normal",
132+
PRIORITY: "Priority",
133+
} as const;
134+
135+
/**
136+
* @public
137+
*/
138+
export type QueuePriority = (typeof QueuePriority)[keyof typeof QueuePriority];
139+
140+
/**
141+
* @public
142+
* <p>Information about tasks and jobs queued on a device.</p>
143+
*/
144+
export interface DeviceQueueInfo {
145+
/**
146+
* @public
147+
* <p>The name of the queue. </p>
148+
*/
149+
queue: QueueName | string | undefined;
150+
151+
/**
152+
* @public
153+
* <p>The number of jobs or tasks in the queue for a given device. </p>
154+
*/
155+
queueSize: string | undefined;
156+
157+
/**
158+
* @public
159+
* <p>Optional. Specifies the priority of the queue. Tasks in a priority queue
160+
* are processed before the tasks in a normal queue.</p>
161+
*/
162+
queuePriority?: QueuePriority | string;
163+
}
164+
112165
/**
113166
* @public
114167
* @enum
@@ -177,6 +230,12 @@ export interface GetDeviceResponse {
177230
* <p>Details about the capabilities of the device.</p>
178231
*/
179232
deviceCapabilities: __LazyJsonString | string | undefined;
233+
234+
/**
235+
* @public
236+
* <p>List of information about tasks and jobs queued on a device.</p>
237+
*/
238+
deviceQueueInfo?: DeviceQueueInfo[];
180239
}
181240

182241
/**
@@ -753,6 +812,20 @@ export class ServiceQuotaExceededException extends __BaseException {
753812
}
754813
}
755814

815+
/**
816+
* @public
817+
* @enum
818+
*/
819+
export const HybridJobAdditionalAttributeName = {
820+
QUEUE_INFO: "QueueInfo",
821+
} as const;
822+
823+
/**
824+
* @public
825+
*/
826+
export type HybridJobAdditionalAttributeName =
827+
(typeof HybridJobAdditionalAttributeName)[keyof typeof HybridJobAdditionalAttributeName];
828+
756829
/**
757830
* @public
758831
*/
@@ -762,6 +835,12 @@ export interface GetJobRequest {
762835
* <p>The ARN of the job to retrieve.</p>
763836
*/
764837
jobArn: string | undefined;
838+
839+
/**
840+
* @public
841+
* <p>A list of attributes to return information for.</p>
842+
*/
843+
additionalAttributeNames?: (HybridJobAdditionalAttributeName | string)[];
765844
}
766845

767846
/**
@@ -811,6 +890,32 @@ export interface JobEventDetails {
811890
message?: string;
812891
}
813892

893+
/**
894+
* @public
895+
* <p>Information about the queue for a specified job.</p>
896+
*/
897+
export interface HybridJobQueueInfo {
898+
/**
899+
* @public
900+
* <p>The name of the queue.</p>
901+
*/
902+
queue: QueueName | string | undefined;
903+
904+
/**
905+
* @public
906+
* <p>Current position of the job in the jobs queue.</p>
907+
*/
908+
position: string | undefined;
909+
910+
/**
911+
* @public
912+
* <p>Optional. Provides more information about the queue position. For example,
913+
* if the job is complete and no longer in the queue, the message field contains
914+
* that information.</p>
915+
*/
916+
message?: string;
917+
}
918+
814919
/**
815920
* @public
816921
* @enum
@@ -955,6 +1060,14 @@ export interface GetJobResponse {
9551060
* Amazon Braket resources.</p>
9561061
*/
9571062
tags?: Record<string, string>;
1063+
1064+
/**
1065+
* @public
1066+
* <p>Queue information for the requested job. Only returned if
1067+
* <code>QueueInfo</code> is specified in the <code>additionalAttributeNames"</code>
1068+
* field in the <code>GetJob</code> API request.</p>
1069+
*/
1070+
queueInfo?: HybridJobQueueInfo;
9581071
}
9591072

9601073
/**
@@ -1246,6 +1359,20 @@ export class DeviceOfflineException extends __BaseException {
12461359
}
12471360
}
12481361

1362+
/**
1363+
* @public
1364+
* @enum
1365+
*/
1366+
export const QuantumTaskAdditionalAttributeName = {
1367+
QUEUE_INFO: "QueueInfo",
1368+
} as const;
1369+
1370+
/**
1371+
* @public
1372+
*/
1373+
export type QuantumTaskAdditionalAttributeName =
1374+
(typeof QuantumTaskAdditionalAttributeName)[keyof typeof QuantumTaskAdditionalAttributeName];
1375+
12491376
/**
12501377
* @public
12511378
*/
@@ -1255,6 +1382,45 @@ export interface GetQuantumTaskRequest {
12551382
* <p>the ARN of the task to retrieve.</p>
12561383
*/
12571384
quantumTaskArn: string | undefined;
1385+
1386+
/**
1387+
* @public
1388+
* <p>A list of attributes to return information for.</p>
1389+
*/
1390+
additionalAttributeNames?: (QuantumTaskAdditionalAttributeName | string)[];
1391+
}
1392+
1393+
/**
1394+
* @public
1395+
* <p>Information about the queue for the specified quantum task.</p>
1396+
*/
1397+
export interface QuantumTaskQueueInfo {
1398+
/**
1399+
* @public
1400+
* <p>The name of the queue. </p>
1401+
*/
1402+
queue: QueueName | string | undefined;
1403+
1404+
/**
1405+
* @public
1406+
* <p>Current position of the task in the quantum tasks queue.</p>
1407+
*/
1408+
position: string | undefined;
1409+
1410+
/**
1411+
* @public
1412+
* <p>Optional. Specifies the priority of the queue. Quantum tasks in a priority queue
1413+
* are processed before the tasks in a normal queue.</p>
1414+
*/
1415+
queuePriority?: QueuePriority | string;
1416+
1417+
/**
1418+
* @public
1419+
* <p>Optional. Provides more information about the queue position. For example,
1420+
* if the task is complete and no longer in the queue, the message field contains
1421+
* that information.</p>
1422+
*/
1423+
message?: string;
12581424
}
12591425

12601426
/**
@@ -1351,6 +1517,14 @@ export interface GetQuantumTaskResponse {
13511517
* <p>The ARN of the Amazon Braket job associated with the quantum task.</p>
13521518
*/
13531519
jobArn?: string;
1520+
1521+
/**
1522+
* @public
1523+
* <p>Queue information for the requested quantum task. Only returned if
1524+
* <code>QueueInfo</code> is specified in the <code>additionalAttributeNames"</code>
1525+
* field in the <code>GetQuantumTask</code> API request.</p>
1526+
*/
1527+
queueInfo?: QuantumTaskQueueInfo;
13541528
}
13551529

13561530
/**

clients/client-braket/src/protocols/Aws_restJson1.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ export const se_GetJobCommand = async (input: GetJobCommandInput, context: __Ser
239239
const headers: any = {};
240240
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/job/{jobArn}";
241241
resolvedPath = __resolvedPath(resolvedPath, input, "jobArn", () => input.jobArn!, "{jobArn}", false);
242+
const query: any = map({
243+
additionalAttributeNames: [
244+
() => input.additionalAttributeNames !== void 0,
245+
() => (input.additionalAttributeNames! || []).map((_entry) => _entry as any),
246+
],
247+
});
242248
let body: any;
243249
return new __HttpRequest({
244250
protocol,
@@ -247,6 +253,7 @@ export const se_GetJobCommand = async (input: GetJobCommandInput, context: __Ser
247253
method: "GET",
248254
headers,
249255
path: resolvedPath,
256+
query,
250257
body,
251258
});
252259
};
@@ -270,6 +277,12 @@ export const se_GetQuantumTaskCommand = async (
270277
"{quantumTaskArn}",
271278
false
272279
);
280+
const query: any = map({
281+
additionalAttributeNames: [
282+
() => input.additionalAttributeNames !== void 0,
283+
() => (input.additionalAttributeNames! || []).map((_entry) => _entry as any),
284+
],
285+
});
273286
let body: any;
274287
return new __HttpRequest({
275288
protocol,
@@ -278,6 +291,7 @@ export const se_GetQuantumTaskCommand = async (
278291
method: "GET",
279292
headers,
280293
path: resolvedPath,
294+
query,
281295
body,
282296
});
283297
};
@@ -732,6 +746,7 @@ export const de_GetDeviceCommand = async (
732746
deviceArn: __expectString,
733747
deviceCapabilities: (_) => new __LazyJsonString(_),
734748
deviceName: __expectString,
749+
deviceQueueInfo: _json,
735750
deviceStatus: __expectString,
736751
deviceType: __expectString,
737752
providerName: __expectString,
@@ -807,6 +822,7 @@ export const de_GetJobCommand = async (
807822
jobArn: __expectString,
808823
jobName: __expectString,
809824
outputDataConfig: _json,
825+
queueInfo: _json,
810826
roleArn: __expectString,
811827
startedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
812828
status: __expectString,
@@ -876,6 +892,7 @@ export const de_GetQuantumTaskCommand = async (
876892
outputS3Bucket: __expectString,
877893
outputS3Directory: __expectString,
878894
quantumTaskArn: __expectString,
895+
queueInfo: _json,
879896
shots: __expectLong,
880897
status: __expectString,
881898
tags: _json,
@@ -1466,10 +1483,16 @@ const de_ValidationExceptionRes = async (parsedOutput: any, context: __SerdeCont
14661483

14671484
// de_DeviceConfig omitted.
14681485

1486+
// de_DeviceQueueInfo omitted.
1487+
1488+
// de_DeviceQueueInfoList omitted.
1489+
14691490
// de_DeviceSummary omitted.
14701491

14711492
// de_DeviceSummaryList omitted.
14721493

1494+
// de_HybridJobQueueInfo omitted.
1495+
14731496
// de_HyperParameters omitted.
14741497

14751498
// de_InputConfigList omitted.
@@ -1535,6 +1558,8 @@ const de_JobSummaryList = (output: any, context: __SerdeContext): JobSummary[] =
15351558
return retVal;
15361559
};
15371560

1561+
// de_QuantumTaskQueueInfo omitted.
1562+
15381563
/**
15391564
* deserializeAws_restJson1QuantumTaskSummary
15401565
*/

0 commit comments

Comments
 (0)