Table of Contents
A low-level client representing Braket
The Amazon Braket API Reference provides information about the operations and structures supported in Amazon Braket.
import boto3
client = boto3.client('braket')
These are the available methods:
Check if an operation can be paginated.
Cancels the specified task.
See also: AWS API Documentation
Request Syntax
response = client.cancel_quantum_task(
clientToken='string',
quantumTaskArn='string'
)
[REQUIRED]
The client token associated with the request.
This field is autopopulated if not provided.
[REQUIRED]
The ARN of the task to cancel.
dict
Response Syntax
{
'cancellationStatus': 'CANCELLING'|'CANCELLED',
'quantumTaskArn': 'string'
}
Response Structure
(dict) --
cancellationStatus (string) --
The status of the cancellation request.
quantumTaskArn (string) --
The ARN of the task.
Exceptions
Creates a quantum task.
See also: AWS API Documentation
Request Syntax
response = client.create_quantum_task(
action='string',
clientToken='string',
deviceArn='string',
deviceParameters='string',
outputS3Bucket='string',
outputS3KeyPrefix='string',
shots=123,
tags={
'string': 'string'
}
)
[REQUIRED]
The action associated with the task.
[REQUIRED]
The client token associated with the request.
This field is autopopulated if not provided.
[REQUIRED]
The ARN of the device to run the task on.
[REQUIRED]
The S3 bucket to store task result files in.
[REQUIRED]
The key prefix for the location in the S3 bucket to store task results in.
[REQUIRED]
The number of shots to use for the task.
Tags to be added to the quantum task you're creating.
dict
Response Syntax
{
'quantumTaskArn': 'string'
}
Response Structure
(dict) --
quantumTaskArn (string) --
The ARN of the task created by the request.
Exceptions
Retrieves the devices available in Amazon Braket.
See also: AWS API Documentation
Request Syntax
response = client.get_device(
deviceArn='string'
)
[REQUIRED]
The ARN of the device to retrieve.
{
'deviceArn': 'string',
'deviceCapabilities': 'string',
'deviceName': 'string',
'deviceStatus': 'ONLINE'|'OFFLINE'|'RETIRED',
'deviceType': 'QPU'|'SIMULATOR',
'providerName': 'string'
}
Response Structure
The ARN of the device.
Details about the capabilities of the device.
The name of the device.
The status of the device.
The type of the device.
The name of the partner company for the device.
Exceptions
Create a paginator for an operation.
Retrieves the specified quantum task.
See also: AWS API Documentation
Request Syntax
response = client.get_quantum_task(
quantumTaskArn='string'
)
[REQUIRED]
the ARN of the task to retrieve.
{
'createdAt': datetime(2015, 1, 1),
'deviceArn': 'string',
'deviceParameters': 'string',
'endedAt': datetime(2015, 1, 1),
'failureReason': 'string',
'outputS3Bucket': 'string',
'outputS3Directory': 'string',
'quantumTaskArn': 'string',
'shots': 123,
'status': 'CREATED'|'QUEUED'|'RUNNING'|'COMPLETED'|'FAILED'|'CANCELLING'|'CANCELLED',
'tags': {
'string': 'string'
}
}
Response Structure
The time at which the task was created.
The ARN of the device the task was run on.
The parameters for the device on which the task ran.
The time at which the task ended.
The reason that a task failed.
The S3 bucket where task results are stored.
The folder in the S3 bucket where task results are stored.
The ARN of the task.
The number of shots used in the task.
The status of the task.
The tags that belong to this task.
Exceptions
Returns an object that can wait for some condition.
Shows the tags associated with this resource.
See also: AWS API Documentation
Request Syntax
response = client.list_tags_for_resource(
resourceArn='string'
)
[REQUIRED]
Specify the resourceArn for the resource whose tags to display.
{
'tags': {
'string': 'string'
}
}
Response Structure
Displays the key, value pairs of tags associated with this resource.
Exceptions
Searches for devices using the specified filters.
See also: AWS API Documentation
Request Syntax
response = client.search_devices(
filters=[
{
'name': 'string',
'values': [
'string',
]
},
],
maxResults=123,
nextToken='string'
)
[REQUIRED]
The filter values to use to search for a device.
The filter to use for searching devices.
The name to use to filter results.
The values to use to filter results.
dict
Response Syntax
{
'devices': [
{
'deviceArn': 'string',
'deviceName': 'string',
'deviceStatus': 'ONLINE'|'OFFLINE'|'RETIRED',
'deviceType': 'QPU'|'SIMULATOR',
'providerName': 'string'
},
],
'nextToken': 'string'
}
Response Structure
(dict) --
devices (list) --
An array of DeviceSummary objects for devices that match the specified filter values.
(dict) --
Includes information about the device.
deviceArn (string) --
The ARN of the device.
deviceName (string) --
The name of the device.
deviceStatus (string) --
The status of the device.
deviceType (string) --
The type of the device.
providerName (string) --
The provider of the device.
nextToken (string) --
A token used for pagination of results, or null if there are no additional results. Use the token value in a subsequent request to continue results where the previous request ended.
Exceptions
Searches for tasks that match the specified filter values.
See also: AWS API Documentation
Request Syntax
response = client.search_quantum_tasks(
filters=[
{
'name': 'string',
'operator': 'LT'|'LTE'|'EQUAL'|'GT'|'GTE'|'BETWEEN',
'values': [
'string',
]
},
],
maxResults=123,
nextToken='string'
)
[REQUIRED]
Array of SearchQuantumTasksFilter objects.
A filter to use to search for tasks.
The name of the device used for the task.
An operator to use in the filter.
The values to use for the filter.
dict
Response Syntax
{
'nextToken': 'string',
'quantumTasks': [
{
'createdAt': datetime(2015, 1, 1),
'deviceArn': 'string',
'endedAt': datetime(2015, 1, 1),
'outputS3Bucket': 'string',
'outputS3Directory': 'string',
'quantumTaskArn': 'string',
'shots': 123,
'status': 'CREATED'|'QUEUED'|'RUNNING'|'COMPLETED'|'FAILED'|'CANCELLING'|'CANCELLED',
'tags': {
'string': 'string'
}
},
]
}
Response Structure
(dict) --
nextToken (string) --
A token used for pagination of results, or null if there are no additional results. Use the token value in a subsequent request to continue results where the previous request ended.
quantumTasks (list) --
An array of QuantumTaskSummary objects for tasks that match the specified filters.
(dict) --
Includes information about a quantum task.
createdAt (datetime) --
The time at which the task was created.
deviceArn (string) --
The ARN of the device the task ran on.
endedAt (datetime) --
The time at which the task finished.
outputS3Bucket (string) --
The S3 bucket where the task result file is stored..
outputS3Directory (string) --
The folder in the S3 bucket where the task result file is stored.
quantumTaskArn (string) --
The ARN of the task.
shots (integer) --
The shots used for the task.
status (string) --
The status of the task.
tags (dict) --
Displays the key, value pairs of tags associated with this quantum task.
Exceptions
Add a tag to the specified resource.
See also: AWS API Documentation
Request Syntax
response = client.tag_resource(
resourceArn='string',
tags={
'string': 'string'
}
)
[REQUIRED]
Specify the resourceArn of the resource to which a tag will be added.
[REQUIRED]
Specify the tags to add to the resource.
dict
Response Syntax
{}
Response Structure
Exceptions
Remove tags from a resource.
See also: AWS API Documentation
Request Syntax
response = client.untag_resource(
resourceArn='string',
tagKeys=[
'string',
]
)
[REQUIRED]
Specify the resourceArn for the resource from which to remove the tags.
[REQUIRED]
Specify the keys for the tags to remove from the resource.
dict
Response Syntax
{}
Response Structure
Exceptions
The available paginators are:
paginator = client.get_paginator('search_devices')
Creates an iterator that will paginate through responses from Braket.Client.search_devices().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
filters=[
{
'name': 'string',
'values': [
'string',
]
},
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
[REQUIRED]
The filter values to use to search for a device.
The filter to use for searching devices.
The name to use to filter results.
The values to use to filter results.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'devices': [
{
'deviceArn': 'string',
'deviceName': 'string',
'deviceStatus': 'ONLINE'|'OFFLINE'|'RETIRED',
'deviceType': 'QPU'|'SIMULATOR',
'providerName': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
devices (list) --
An array of DeviceSummary objects for devices that match the specified filter values.
(dict) --
Includes information about the device.
deviceArn (string) --
The ARN of the device.
deviceName (string) --
The name of the device.
deviceStatus (string) --
The status of the device.
deviceType (string) --
The type of the device.
providerName (string) --
The provider of the device.
NextToken (string) --
A token to resume pagination.
paginator = client.get_paginator('search_quantum_tasks')
Creates an iterator that will paginate through responses from Braket.Client.search_quantum_tasks().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
filters=[
{
'name': 'string',
'operator': 'LT'|'LTE'|'EQUAL'|'GT'|'GTE'|'BETWEEN',
'values': [
'string',
]
},
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
[REQUIRED]
Array of SearchQuantumTasksFilter objects.
A filter to use to search for tasks.
The name of the device used for the task.
An operator to use in the filter.
The values to use for the filter.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'quantumTasks': [
{
'createdAt': datetime(2015, 1, 1),
'deviceArn': 'string',
'endedAt': datetime(2015, 1, 1),
'outputS3Bucket': 'string',
'outputS3Directory': 'string',
'quantumTaskArn': 'string',
'shots': 123,
'status': 'CREATED'|'QUEUED'|'RUNNING'|'COMPLETED'|'FAILED'|'CANCELLING'|'CANCELLED',
'tags': {
'string': 'string'
}
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
quantumTasks (list) --
An array of QuantumTaskSummary objects for tasks that match the specified filters.
(dict) --
Includes information about a quantum task.
createdAt (datetime) --
The time at which the task was created.
deviceArn (string) --
The ARN of the device the task ran on.
endedAt (datetime) --
The time at which the task finished.
outputS3Bucket (string) --
The S3 bucket where the task result file is stored..
outputS3Directory (string) --
The folder in the S3 bucket where the task result file is stored.
quantumTaskArn (string) --
The ARN of the task.
shots (integer) --
The shots used for the task.
status (string) --
The status of the task.
tags (dict) --
Displays the key, value pairs of tags associated with this quantum task.
NextToken (string) --
A token to resume pagination.