Skip to content

Commit

Permalink
feat(client-braket): This release adds support to view the device que…
Browse files Browse the repository at this point in the history
…ue depth (the number of queued quantum tasks and hybrid jobs on a device) and queue position for a quantum task and hybrid job.
  • Loading branch information
awstools committed Sep 22, 2023
1 parent 0558bb4 commit 2270498
Show file tree
Hide file tree
Showing 6 changed files with 417 additions and 2 deletions.
7 changes: 7 additions & 0 deletions clients/client-braket/src/commands/GetDeviceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
* // },
* // ],
* // };
*
* ```
Expand Down
8 changes: 8 additions & 0 deletions clients/client-braket/src/commands/GetJobCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -112,6 +115,11 @@ export interface GetJobCommandOutput extends GetJobResponse, __MetadataBearer {}
* // tags: { // TagsMap
* // "<keys>": "STRING_VALUE",
* // },
* // queueInfo: { // HybridJobQueueInfo
* // queue: "STRING_VALUE", // required
* // position: "STRING_VALUE", // required
* // message: "STRING_VALUE",
* // },
* // };
*
* ```
Expand Down
9 changes: 9 additions & 0 deletions clients/client-braket/src/commands/GetQuantumTaskCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -64,6 +67,12 @@ export interface GetQuantumTaskCommandOutput extends GetQuantumTaskResponse, __M
* // "<keys>": "STRING_VALUE",
* // },
* // jobArn: "STRING_VALUE",
* // queueInfo: { // QuantumTaskQueueInfo
* // queue: "STRING_VALUE", // required
* // position: "STRING_VALUE", // required
* // queuePriority: "STRING_VALUE",
* // message: "STRING_VALUE",
* // },
* // };
*
* ```
Expand Down
174 changes: 174 additions & 0 deletions clients/client-braket/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <p>Information about tasks and jobs queued on a device.</p>
*/
export interface DeviceQueueInfo {
/**
* @public
* <p>The name of the queue. </p>
*/
queue: QueueName | string | undefined;

/**
* @public
* <p>The number of jobs or tasks in the queue for a given device. </p>
*/
queueSize: string | undefined;

/**
* @public
* <p>Optional. Specifies the priority of the queue. Tasks in a priority queue
* are processed before the tasks in a normal queue.</p>
*/
queuePriority?: QueuePriority | string;
}

/**
* @public
* @enum
Expand Down Expand Up @@ -177,6 +230,12 @@ export interface GetDeviceResponse {
* <p>Details about the capabilities of the device.</p>
*/
deviceCapabilities: __LazyJsonString | string | undefined;

/**
* @public
* <p>List of information about tasks and jobs queued on a device.</p>
*/
deviceQueueInfo?: DeviceQueueInfo[];
}

/**
Expand Down Expand Up @@ -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
*/
Expand All @@ -762,6 +835,12 @@ export interface GetJobRequest {
* <p>The ARN of the job to retrieve.</p>
*/
jobArn: string | undefined;

/**
* @public
* <p>A list of attributes to return information for.</p>
*/
additionalAttributeNames?: (HybridJobAdditionalAttributeName | string)[];
}

/**
Expand Down Expand Up @@ -811,6 +890,32 @@ export interface JobEventDetails {
message?: string;
}

/**
* @public
* <p>Information about the queue for a specified job.</p>
*/
export interface HybridJobQueueInfo {
/**
* @public
* <p>The name of the queue.</p>
*/
queue: QueueName | string | undefined;

/**
* @public
* <p>Current position of the job in the jobs queue.</p>
*/
position: string | undefined;

/**
* @public
* <p>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.</p>
*/
message?: string;
}

/**
* @public
* @enum
Expand Down Expand Up @@ -955,6 +1060,14 @@ export interface GetJobResponse {
* Amazon Braket resources.</p>
*/
tags?: Record<string, string>;

/**
* @public
* <p>Queue information for the requested job. Only returned if
* <code>QueueInfo</code> is specified in the <code>additionalAttributeNames"</code>
* field in the <code>GetJob</code> API request.</p>
*/
queueInfo?: HybridJobQueueInfo;
}

/**
Expand Down Expand Up @@ -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
*/
Expand All @@ -1255,6 +1382,45 @@ export interface GetQuantumTaskRequest {
* <p>the ARN of the task to retrieve.</p>
*/
quantumTaskArn: string | undefined;

/**
* @public
* <p>A list of attributes to return information for.</p>
*/
additionalAttributeNames?: (QuantumTaskAdditionalAttributeName | string)[];
}

/**
* @public
* <p>Information about the queue for the specified quantum task.</p>
*/
export interface QuantumTaskQueueInfo {
/**
* @public
* <p>The name of the queue. </p>
*/
queue: QueueName | string | undefined;

/**
* @public
* <p>Current position of the task in the quantum tasks queue.</p>
*/
position: string | undefined;

/**
* @public
* <p>Optional. Specifies the priority of the queue. Quantum tasks in a priority queue
* are processed before the tasks in a normal queue.</p>
*/
queuePriority?: QueuePriority | string;

/**
* @public
* <p>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.</p>
*/
message?: string;
}

/**
Expand Down Expand Up @@ -1351,6 +1517,14 @@ export interface GetQuantumTaskResponse {
* <p>The ARN of the Amazon Braket job associated with the quantum task.</p>
*/
jobArn?: string;

/**
* @public
* <p>Queue information for the requested quantum task. Only returned if
* <code>QueueInfo</code> is specified in the <code>additionalAttributeNames"</code>
* field in the <code>GetQuantumTask</code> API request.</p>
*/
queueInfo?: QuantumTaskQueueInfo;
}

/**
Expand Down
25 changes: 25 additions & 0 deletions clients/client-braket/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -247,6 +253,7 @@ export const se_GetJobCommand = async (input: GetJobCommandInput, context: __Ser
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
Expand All @@ -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,
Expand All @@ -278,6 +291,7 @@ export const se_GetQuantumTaskCommand = async (
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
Expand Down Expand Up @@ -732,6 +746,7 @@ export const de_GetDeviceCommand = async (
deviceArn: __expectString,
deviceCapabilities: (_) => new __LazyJsonString(_),
deviceName: __expectString,
deviceQueueInfo: _json,
deviceStatus: __expectString,
deviceType: __expectString,
providerName: __expectString,
Expand Down Expand Up @@ -807,6 +822,7 @@ export const de_GetJobCommand = async (
jobArn: __expectString,
jobName: __expectString,
outputDataConfig: _json,
queueInfo: _json,
roleArn: __expectString,
startedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
status: __expectString,
Expand Down Expand Up @@ -876,6 +892,7 @@ export const de_GetQuantumTaskCommand = async (
outputS3Bucket: __expectString,
outputS3Directory: __expectString,
quantumTaskArn: __expectString,
queueInfo: _json,
shots: __expectLong,
status: __expectString,
tags: _json,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -1535,6 +1558,8 @@ const de_JobSummaryList = (output: any, context: __SerdeContext): JobSummary[] =
return retVal;
};

// de_QuantumTaskQueueInfo omitted.

/**
* deserializeAws_restJson1QuantumTaskSummary
*/
Expand Down
Loading

0 comments on commit 2270498

Please sign in to comment.