Braket

Client

class Braket.Client

A low-level client representing Braket

The Amazon Braket API Reference provides information about the operations and structures supported in Amazon Braket.

Additional Resources:

client = session.create_client('braket')

These are the available methods:

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters:

operation_name (string) – The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you’d normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").

Returns:

True if the operation can be paginated, False otherwise.

cancel_job(**kwargs)

Cancels an Amazon Braket job.

See also: AWS API Documentation

Request Syntax

response = client.cancel_job(
    jobArn='string'
)
Parameters:

jobArn (string) –

[REQUIRED]

The ARN of the Amazon Braket job to cancel.

Return type:

dict

Returns:

Response Syntax

{
    'cancellationStatus': 'CANCELLING'|'CANCELLED',
    'jobArn': 'string'
}

Response Structure

  • (dict) –

    • cancellationStatus (string) –

      The status of the job cancellation request.

    • jobArn (string) –

      The ARN of the Amazon Braket job.

Exceptions

cancel_quantum_task(**kwargs)

Cancels the specified task.

See also: AWS API Documentation

Request Syntax

response = client.cancel_quantum_task(
    clientToken='string',
    quantumTaskArn='string'
)
Parameters:
  • clientToken (string) –

    [REQUIRED]

    The client token associated with the request.

    This field is autopopulated if not provided.

  • quantumTaskArn (string) –

    [REQUIRED]

    The ARN of the task to cancel.

Return type:

dict

Returns:

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

close()

Closes underlying endpoint connections.

create_job(**kwargs)

Creates an Amazon Braket job.

See also: AWS API Documentation

Request Syntax

response = client.create_job(
    algorithmSpecification={
        'containerImage': {
            'uri': 'string'
        },
        'scriptModeConfig': {
            'compressionType': 'NONE'|'GZIP',
            'entryPoint': 'string',
            's3Uri': 'string'
        }
    },
    checkpointConfig={
        'localPath': 'string',
        's3Uri': 'string'
    },
    clientToken='string',
    deviceConfig={
        'device': 'string'
    },
    hyperParameters={
        'string': 'string'
    },
    inputDataConfig=[
        {
            'channelName': 'string',
            'contentType': 'string',
            'dataSource': {
                's3DataSource': {
                    's3Uri': 'string'
                }
            }
        },
    ],
    instanceConfig={
        'instanceCount': 123,
        'instanceType': 'ml.m4.xlarge'|'ml.m4.2xlarge'|'ml.m4.4xlarge'|'ml.m4.10xlarge'|'ml.m4.16xlarge'|'ml.g4dn.xlarge'|'ml.g4dn.2xlarge'|'ml.g4dn.4xlarge'|'ml.g4dn.8xlarge'|'ml.g4dn.12xlarge'|'ml.g4dn.16xlarge'|'ml.m5.large'|'ml.m5.xlarge'|'ml.m5.2xlarge'|'ml.m5.4xlarge'|'ml.m5.12xlarge'|'ml.m5.24xlarge'|'ml.c4.xlarge'|'ml.c4.2xlarge'|'ml.c4.4xlarge'|'ml.c4.8xlarge'|'ml.p2.xlarge'|'ml.p2.8xlarge'|'ml.p2.16xlarge'|'ml.p3.2xlarge'|'ml.p3.8xlarge'|'ml.p3.16xlarge'|'ml.p3dn.24xlarge'|'ml.p4d.24xlarge'|'ml.c5.xlarge'|'ml.c5.2xlarge'|'ml.c5.4xlarge'|'ml.c5.9xlarge'|'ml.c5.18xlarge'|'ml.c5n.xlarge'|'ml.c5n.2xlarge'|'ml.c5n.4xlarge'|'ml.c5n.9xlarge'|'ml.c5n.18xlarge',
        'volumeSizeInGb': 123
    },
    jobName='string',
    outputDataConfig={
        'kmsKeyId': 'string',
        's3Path': 'string'
    },
    roleArn='string',
    stoppingCondition={
        'maxRuntimeInSeconds': 123
    },
    tags={
        'string': 'string'
    }
)
Parameters:
  • algorithmSpecification (dict) –

    [REQUIRED]

    Definition of the Amazon Braket job to be created. Specifies the container image the job uses and information about the Python scripts used for entry and training.

    • containerImage (dict) –

      The container image used to create an Amazon Braket job.

      • uri (string) – [REQUIRED]

        The URI locating the container image.

    • scriptModeConfig (dict) –

      Configures the paths to the Python scripts used for entry and training.

      • compressionType (string) –

        The type of compression used by the Python scripts for an Amazon Braket job.

      • entryPoint (string) – [REQUIRED]

        The path to the Python script that serves as the entry point for an Amazon Braket job.

      • s3Uri (string) – [REQUIRED]

        The URI that specifies the S3 path to the Python script module that contains the training script used by an Amazon Braket job.

  • checkpointConfig (dict) –

    Information about the output locations for job checkpoint data.

    • localPath (string) –

      (Optional) The local directory where checkpoints are written. The default directory is /opt/braket/checkpoints/ .

    • s3Uri (string) – [REQUIRED]

      Identifies the S3 path where you want Amazon Braket to store checkpoints. For example, s3://bucket-name/key-name-prefix .

  • clientToken (string) –

    [REQUIRED]

    A unique token that guarantees that the call to this API is idempotent.

    This field is autopopulated if not provided.

  • deviceConfig (dict) –

    [REQUIRED]

    The quantum processing unit (QPU) or simulator used to create an Amazon Braket job.

    • device (string) – [REQUIRED]

      The primary quantum processing unit (QPU) or simulator used to create and run an Amazon Braket job.

  • hyperParameters (dict) –

    Algorithm-specific parameters used by an Amazon Braket job that influence the quality of the training job. The values are set with a string of JSON key:value pairs, where the key is the name of the hyperparameter and the value is the value of th hyperparameter.

    • (string) –

      • (string) –

  • inputDataConfig (list) –

    A list of parameters that specify the name and type of input data and where it is located.

    • (dict) –

      A list of parameters that specify the input channels, type of input data, and where it is located.

      • channelName (string) – [REQUIRED]

        A named input source that an Amazon Braket job can consume.

      • contentType (string) –

        The MIME type of the data.

      • dataSource (dict) – [REQUIRED]

        The location of the channel data.

        • s3DataSource (dict) – [REQUIRED]

          Information about the data stored in Amazon S3 used by the Amazon Braket job.

          • s3Uri (string) – [REQUIRED]

            Depending on the value specified for the S3DataType , identifies either a key name prefix or a manifest that locates the S3 data source.

  • instanceConfig (dict) –

    [REQUIRED]

    Configuration of the resource instances to use while running the hybrid job on Amazon Braket.

    • instanceCount (integer) –

      Configures the number of resource instances to use while running an Amazon Braket job on Amazon Braket. The default value is 1.

    • instanceType (string) – [REQUIRED]

      Configures the type resource instances to use while running an Amazon Braket hybrid job.

    • volumeSizeInGb (integer) – [REQUIRED]

      The size of the storage volume, in GB, that user wants to provision.

  • jobName (string) –

    [REQUIRED]

    The name of the Amazon Braket job.

  • outputDataConfig (dict) –

    [REQUIRED]

    The path to the S3 location where you want to store job artifacts and the encryption key used to store them.

    • kmsKeyId (string) –

      The AWS Key Management Service (AWS KMS) key that Amazon Braket uses to encrypt the job training artifacts at rest using Amazon S3 server-side encryption.

    • s3Path (string) – [REQUIRED]

      Identifies the S3 path where you want Amazon Braket to store the job training artifacts. For example, s3://bucket-name/key-name-prefix .

  • roleArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of an IAM role that Amazon Braket can assume to perform tasks on behalf of a user. It can access user resources, run an Amazon Braket job container on behalf of user, and output resources to the users’ s3 buckets.

  • stoppingCondition (dict) –

    The user-defined criteria that specifies when a job stops running.

    • maxRuntimeInSeconds (integer) –

      The maximum length of time, in seconds, that an Amazon Braket job can run.

  • tags (dict) –

    A tag object that consists of a key and an optional value, used to manage metadata for Amazon Braket resources.

    • (string) –

      • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'jobArn': 'string'
}

Response Structure

  • (dict) –

    • jobArn (string) –

      The ARN of the Amazon Braket job created.

Exceptions

create_quantum_task(**kwargs)

Creates a quantum task.

See also: AWS API Documentation

Request Syntax

response = client.create_quantum_task(
    action='string',
    clientToken='string',
    deviceArn='string',
    deviceParameters='string',
    jobToken='string',
    outputS3Bucket='string',
    outputS3KeyPrefix='string',
    shots=123,
    tags={
        'string': 'string'
    }
)
Parameters:
  • action (string) –

    [REQUIRED]

    The action associated with the task.

  • clientToken (string) –

    [REQUIRED]

    The client token associated with the request.

    This field is autopopulated if not provided.

  • deviceArn (string) –

    [REQUIRED]

    The ARN of the device to run the task on.

  • deviceParameters (string) – The parameters for the device to run the task on.

  • jobToken (string) – The token for an Amazon Braket job that associates it with the quantum task.

  • outputS3Bucket (string) –

    [REQUIRED]

    The S3 bucket to store task result files in.

  • outputS3KeyPrefix (string) –

    [REQUIRED]

    The key prefix for the location in the S3 bucket to store task results in.

  • shots (integer) –

    [REQUIRED]

    The number of shots to use for the task.

  • tags (dict) –

    Tags to be added to the quantum task you’re creating.

    • (string) –

      • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'quantumTaskArn': 'string'
}

Response Structure

  • (dict) –

    • quantumTaskArn (string) –

      The ARN of the task created by the request.

Exceptions

get_device(**kwargs)

Retrieves the devices available in Amazon Braket.

Note

For backwards compatibility with older versions of BraketSchemas, OpenQASM information is omitted from GetDevice API calls. To get this information the user-agent needs to present a recent version of the BraketSchemas (1.8.0 or later). The Braket SDK automatically reports this for you. If you do not see OpenQASM results in the GetDevice response when using a Braket SDK, you may need to set AWS_EXECUTION_ENV environment variable to configure user-agent. See the code examples provided below for how to do this for the AWS CLI, Boto3, and the Go, Java, and JavaScript/TypeScript SDKs.

See also: AWS API Documentation

Request Syntax

response = client.get_device(
    deviceArn='string'
)
Parameters:

deviceArn (string) –

[REQUIRED]

The ARN of the device to retrieve.

Return type:

dict

Returns:

Response Syntax

{
    'deviceArn': 'string',
    'deviceCapabilities': 'string',
    'deviceName': 'string',
    'deviceStatus': 'ONLINE'|'OFFLINE'|'RETIRED',
    'deviceType': 'QPU'|'SIMULATOR',
    'providerName': 'string'
}

Response Structure

  • (dict) –

    • deviceArn (string) –

      The ARN of the device.

    • deviceCapabilities (string) –

      Details about the capabilities 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 name of the partner company for the device.

Exceptions

get_job(**kwargs)

Retrieves the specified Amazon Braket job.

See also: AWS API Documentation

Request Syntax

response = client.get_job(
    jobArn='string'
)
Parameters:

jobArn (string) –

[REQUIRED]

The ARN of the job to retrieve.

Return type:

dict

Returns:

Response Syntax

{
    'algorithmSpecification': {
        'containerImage': {
            'uri': 'string'
        },
        'scriptModeConfig': {
            'compressionType': 'NONE'|'GZIP',
            'entryPoint': 'string',
            's3Uri': 'string'
        }
    },
    'billableDuration': 123,
    'checkpointConfig': {
        'localPath': 'string',
        's3Uri': 'string'
    },
    'createdAt': datetime(2015, 1, 1),
    'deviceConfig': {
        'device': 'string'
    },
    'endedAt': datetime(2015, 1, 1),
    'events': [
        {
            'eventType': 'WAITING_FOR_PRIORITY'|'QUEUED_FOR_EXECUTION'|'STARTING_INSTANCE'|'DOWNLOADING_DATA'|'RUNNING'|'DEPRIORITIZED_DUE_TO_INACTIVITY'|'UPLOADING_RESULTS'|'COMPLETED'|'FAILED'|'MAX_RUNTIME_EXCEEDED'|'CANCELLED',
            'message': 'string',
            'timeOfEvent': datetime(2015, 1, 1)
        },
    ],
    'failureReason': 'string',
    'hyperParameters': {
        'string': 'string'
    },
    'inputDataConfig': [
        {
            'channelName': 'string',
            'contentType': 'string',
            'dataSource': {
                's3DataSource': {
                    's3Uri': 'string'
                }
            }
        },
    ],
    'instanceConfig': {
        'instanceCount': 123,
        'instanceType': 'ml.m4.xlarge'|'ml.m4.2xlarge'|'ml.m4.4xlarge'|'ml.m4.10xlarge'|'ml.m4.16xlarge'|'ml.g4dn.xlarge'|'ml.g4dn.2xlarge'|'ml.g4dn.4xlarge'|'ml.g4dn.8xlarge'|'ml.g4dn.12xlarge'|'ml.g4dn.16xlarge'|'ml.m5.large'|'ml.m5.xlarge'|'ml.m5.2xlarge'|'ml.m5.4xlarge'|'ml.m5.12xlarge'|'ml.m5.24xlarge'|'ml.c4.xlarge'|'ml.c4.2xlarge'|'ml.c4.4xlarge'|'ml.c4.8xlarge'|'ml.p2.xlarge'|'ml.p2.8xlarge'|'ml.p2.16xlarge'|'ml.p3.2xlarge'|'ml.p3.8xlarge'|'ml.p3.16xlarge'|'ml.p3dn.24xlarge'|'ml.p4d.24xlarge'|'ml.c5.xlarge'|'ml.c5.2xlarge'|'ml.c5.4xlarge'|'ml.c5.9xlarge'|'ml.c5.18xlarge'|'ml.c5n.xlarge'|'ml.c5n.2xlarge'|'ml.c5n.4xlarge'|'ml.c5n.9xlarge'|'ml.c5n.18xlarge',
        'volumeSizeInGb': 123
    },
    'jobArn': 'string',
    'jobName': 'string',
    'outputDataConfig': {
        'kmsKeyId': 'string',
        's3Path': 'string'
    },
    'roleArn': 'string',
    'startedAt': datetime(2015, 1, 1),
    'status': 'QUEUED'|'RUNNING'|'COMPLETED'|'FAILED'|'CANCELLING'|'CANCELLED',
    'stoppingCondition': {
        'maxRuntimeInSeconds': 123
    },
    'tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) –

    • algorithmSpecification (dict) –

      Definition of the Amazon Braket job created. Specifies the container image the job uses, information about the Python scripts used for entry and training, and the user-defined metrics used to evaluation the job.

      • containerImage (dict) –

        The container image used to create an Amazon Braket job.

        • uri (string) –

          The URI locating the container image.

      • scriptModeConfig (dict) –

        Configures the paths to the Python scripts used for entry and training.

        • compressionType (string) –

          The type of compression used by the Python scripts for an Amazon Braket job.

        • entryPoint (string) –

          The path to the Python script that serves as the entry point for an Amazon Braket job.

        • s3Uri (string) –

          The URI that specifies the S3 path to the Python script module that contains the training script used by an Amazon Braket job.

    • billableDuration (integer) –

      The billable time the Amazon Braket job used to complete.

    • checkpointConfig (dict) –

      Information about the output locations for job checkpoint data.

      • localPath (string) –

        (Optional) The local directory where checkpoints are written. The default directory is /opt/braket/checkpoints/ .

      • s3Uri (string) –

        Identifies the S3 path where you want Amazon Braket to store checkpoints. For example, s3://bucket-name/key-name-prefix .

    • createdAt (datetime) –

      The date and time that the Amazon Braket job was created.

    • deviceConfig (dict) –

      The quantum processing unit (QPU) or simulator used to run the Amazon Braket job.

      • device (string) –

        The primary quantum processing unit (QPU) or simulator used to create and run an Amazon Braket job.

    • endedAt (datetime) –

      The date and time that the Amazon Braket job ended.

    • events (list) –

      Details about the type and time events occurred related to the Amazon Braket job.

      • (dict) –

        Details about the type and time events occurred related to the Amazon Braket job.

        • eventType (string) –

          The type of event that occurred related to the Amazon Braket job.

        • message (string) –

          A message describing the event that occurred related to the Amazon Braket job.

        • timeOfEvent (datetime) –

          TThe type of event that occurred related to the Amazon Braket job.

    • failureReason (string) –

      A description of the reason why an Amazon Braket job failed, if it failed.

    • hyperParameters (dict) –

      Algorithm-specific parameters used by an Amazon Braket job that influence the quality of the traiing job. The values are set with a string of JSON key:value pairs, where the key is the name of the hyperparameter and the value is the value of th hyperparameter.

      • (string) –

        • (string) –

    • inputDataConfig (list) –

      A list of parameters that specify the name and type of input data and where it is located.

      • (dict) –

        A list of parameters that specify the input channels, type of input data, and where it is located.

        • channelName (string) –

          A named input source that an Amazon Braket job can consume.

        • contentType (string) –

          The MIME type of the data.

        • dataSource (dict) –

          The location of the channel data.

          • s3DataSource (dict) –

            Information about the data stored in Amazon S3 used by the Amazon Braket job.

            • s3Uri (string) –

              Depending on the value specified for the S3DataType , identifies either a key name prefix or a manifest that locates the S3 data source.

    • instanceConfig (dict) –

      The resource instances to use while running the hybrid job on Amazon Braket.

      • instanceCount (integer) –

        Configures the number of resource instances to use while running an Amazon Braket job on Amazon Braket. The default value is 1.

      • instanceType (string) –

        Configures the type resource instances to use while running an Amazon Braket hybrid job.

      • volumeSizeInGb (integer) –

        The size of the storage volume, in GB, that user wants to provision.

    • jobArn (string) –

      The ARN of the Amazon Braket job.

    • jobName (string) –

      The name of the Amazon Braket job.

    • outputDataConfig (dict) –

      The path to the S3 location where job artifacts are stored and the encryption key used to store them there.

      • kmsKeyId (string) –

        The AWS Key Management Service (AWS KMS) key that Amazon Braket uses to encrypt the job training artifacts at rest using Amazon S3 server-side encryption.

      • s3Path (string) –

        Identifies the S3 path where you want Amazon Braket to store the job training artifacts. For example, s3://bucket-name/key-name-prefix .

    • roleArn (string) –

      The Amazon Resource Name (ARN) of an IAM role that Amazon Braket can assume to perform tasks on behalf of a user. It can access user resources, run an Amazon Braket job container on behalf of user, and output resources to the s3 buckets of a user.

    • startedAt (datetime) –

      The date and time that the Amazon Braket job was started.

    • status (string) –

      The status of the Amazon Braket job.

    • stoppingCondition (dict) –

      The user-defined criteria that specifies when to stop a job running.

      • maxRuntimeInSeconds (integer) –

        The maximum length of time, in seconds, that an Amazon Braket job can run.

    • tags (dict) –

      A tag object that consists of a key and an optional value, used to manage metadata for Amazon Braket resources.

      • (string) –

        • (string) –

Exceptions

get_paginator(operation_name)

Create a paginator for an operation.

Parameters:

operation_name (string) – The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you’d normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").

Raises:

OperationNotPageableError – Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.

Return type:

L{botocore.paginate.Paginator}

Returns:

A paginator object.

get_quantum_task(**kwargs)

Retrieves the specified quantum task.

See also: AWS API Documentation

Request Syntax

response = client.get_quantum_task(
    quantumTaskArn='string'
)
Parameters:

quantumTaskArn (string) –

[REQUIRED]

the ARN of the task to retrieve.

Return type:

dict

Returns:

Response Syntax

{
    'createdAt': datetime(2015, 1, 1),
    'deviceArn': 'string',
    'deviceParameters': 'string',
    'endedAt': datetime(2015, 1, 1),
    'failureReason': 'string',
    'jobArn': 'string',
    'outputS3Bucket': 'string',
    'outputS3Directory': 'string',
    'quantumTaskArn': 'string',
    'shots': 123,
    'status': 'CREATED'|'QUEUED'|'RUNNING'|'COMPLETED'|'FAILED'|'CANCELLING'|'CANCELLED',
    'tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) –

    • createdAt (datetime) –

      The time at which the task was created.

    • deviceArn (string) –

      The ARN of the device the task was run on.

    • deviceParameters (string) –

      The parameters for the device on which the task ran.

    • endedAt (datetime) –

      The time at which the task ended.

    • failureReason (string) –

      The reason that a task failed.

    • jobArn (string) –

      The ARN of the Amazon Braket job associated with the quantum task.

    • outputS3Bucket (string) –

      The S3 bucket where task results are stored.

    • outputS3Directory (string) –

      The folder in the S3 bucket where task results are stored.

    • quantumTaskArn (string) –

      The ARN of the task.

    • shots (integer) –

      The number of shots used in the task.

    • status (string) –

      The status of the task.

    • tags (dict) –

      The tags that belong to this task.

      • (string) –

        • (string) –

Exceptions

get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters:

waiter_name (str) – The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.

Returns:

The specified waiter object.

Return type:

botocore.waiter.Waiter

list_tags_for_resource(**kwargs)

Shows the tags associated with this resource.

See also: AWS API Documentation

Request Syntax

response = client.list_tags_for_resource(
    resourceArn='string'
)
Parameters:

resourceArn (string) –

[REQUIRED]

Specify the resourceArn for the resource whose tags to display.

Return type:

dict

Returns:

Response Syntax

{
    'tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) –

    • tags (dict) –

      Displays the key, value pairs of tags associated with this resource.

      • (string) –

        • (string) –

Exceptions

search_devices(**kwargs)

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'
)
Parameters:
  • filters (list) –

    [REQUIRED]

    The filter values to use to search for a device.

    • (dict) –

      The filter to use for searching devices.

      • name (string) – [REQUIRED]

        The name to use to filter results.

      • values (list) – [REQUIRED]

        The values to use to filter results.

        • (string) –

  • maxResults (integer) – The maximum number of results to return in the response.

  • nextToken (string) – A token used for pagination of results returned in the response. Use the token returned from the previous request continue results where the previous request ended.

Return type:

dict

Returns:

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

search_jobs(**kwargs)

Searches for Amazon Braket jobs that match the specified filter values.

See also: AWS API Documentation

Request Syntax

response = client.search_jobs(
    filters=[
        {
            'name': 'string',
            'operator': 'LT'|'LTE'|'EQUAL'|'GT'|'GTE'|'BETWEEN'|'CONTAINS',
            'values': [
                'string',
            ]
        },
    ],
    maxResults=123,
    nextToken='string'
)
Parameters:
  • filters (list) –

    [REQUIRED]

    The filter values to use when searching for a job.

    • (dict) –

      A filter used to search for Amazon Braket jobs.

      • name (string) – [REQUIRED]

        The name to use for the jobs filter.

      • operator (string) – [REQUIRED]

        An operator to use for the jobs filter.

      • values (list) – [REQUIRED]

        The values to use for the jobs filter.

        • (string) –

  • maxResults (integer) – The maximum number of results to return in the response.

  • nextToken (string) – A token used for pagination of results returned in the response. Use the token returned from the previous request to continue results where the previous request ended.

Return type:

dict

Returns:

Response Syntax

{
    'jobs': [
        {
            'createdAt': datetime(2015, 1, 1),
            'device': 'string',
            'endedAt': datetime(2015, 1, 1),
            'jobArn': 'string',
            'jobName': 'string',
            'startedAt': datetime(2015, 1, 1),
            'status': 'QUEUED'|'RUNNING'|'COMPLETED'|'FAILED'|'CANCELLING'|'CANCELLED',
            'tags': {
                'string': 'string'
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    • jobs (list) –

      An array of JobSummary objects for devices that match the specified filter values.

      • (dict) –

        Provides summary information about an Amazon Braket job.

        • createdAt (datetime) –

          The date and time that the Amazon Braket job was created.

        • device (string) –

          Provides summary information about the primary device used by an Amazon Braket job.

        • endedAt (datetime) –

          The date and time that the Amazon Braket job ended.

        • jobArn (string) –

          The ARN of the Amazon Braket job.

        • jobName (string) –

          The name of the Amazon Braket job.

        • startedAt (datetime) –

          The date and time that the Amazon Braket job was started.

        • status (string) –

          The status of the Amazon Braket job.

        • tags (dict) –

          A tag object that consists of a key and an optional value, used to manage metadata for Amazon Braket resources.

          • (string) –

            • (string) –

    • 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

search_quantum_tasks(**kwargs)

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'
)
Parameters:
  • filters (list) –

    [REQUIRED]

    Array of SearchQuantumTasksFilter objects.

    • (dict) –

      A filter to use to search for tasks.

      • name (string) – [REQUIRED]

        The name of the device used for the task.

      • operator (string) – [REQUIRED]

        An operator to use in the filter.

      • values (list) – [REQUIRED]

        The values to use for the filter.

        • (string) –

  • maxResults (integer) – Maximum number of results to return in the response.

  • nextToken (string) – A token used for pagination of results returned in the response. Use the token returned from the previous request continue results where the previous request ended.

Return type:

dict

Returns:

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.

          • (string) –

            • (string) –

Exceptions

tag_resource(**kwargs)

Add a tag to the specified resource.

See also: AWS API Documentation

Request Syntax

response = client.tag_resource(
    resourceArn='string',
    tags={
        'string': 'string'
    }
)
Parameters:
  • resourceArn (string) –

    [REQUIRED]

    Specify the resourceArn of the resource to which a tag will be added.

  • tags (dict) –

    [REQUIRED]

    Specify the tags to add to the resource.

    • (string) –

      • (string) –

Return type:

dict

Returns:

Response Syntax

{}

Response Structure

  • (dict) –

Exceptions

untag_resource(**kwargs)

Remove tags from a resource.

See also: AWS API Documentation

Request Syntax

response = client.untag_resource(
    resourceArn='string',
    tagKeys=[
        'string',
    ]
)
Parameters:
  • resourceArn (string) –

    [REQUIRED]

    Specify the resourceArn for the resource from which to remove the tags.

  • tagKeys (list) –

    [REQUIRED]

    Specify the keys for the tags to remove from the resource.

    • (string) –

Return type:

dict

Returns:

Response Syntax

{}

Response Structure

  • (dict) –

Exceptions

Client Exceptions

Client exceptions are available on a client instance via the exceptions property. For more detailed instructions and examples on the exact usage of client exceptions, see the error handling user guide.

The available client exceptions are:

class Braket.Client.exceptions.AccessDeniedException

You do not have sufficient access to perform this action.

Example

try:
  ...
except client.exceptions.AccessDeniedException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) –

    You do not have sufficient access to perform this action.

    • message (string) –

    • Error (dict) – Normalized access to common exception attributes.

      • Code (string) – An identifier specifying the exception type.

      • Message (string) – A descriptive message explaining why the exception occured.

class Braket.Client.exceptions.ConflictException

An error occurred due to a conflict.

Example

try:
  ...
except client.exceptions.ConflictException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) –

    An error occurred due to a conflict.

    • message (string) –

    • Error (dict) – Normalized access to common exception attributes.

      • Code (string) – An identifier specifying the exception type.

      • Message (string) – A descriptive message explaining why the exception occured.

class Braket.Client.exceptions.DeviceOfflineException

The specified device is currently offline.

Example

try:
  ...
except client.exceptions.DeviceOfflineException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) –

    The specified device is currently offline.

    • message (string) –

    • Error (dict) – Normalized access to common exception attributes.

      • Code (string) – An identifier specifying the exception type.

      • Message (string) – A descriptive message explaining why the exception occured.

class Braket.Client.exceptions.DeviceRetiredException

The specified device has been retired.

Example

try:
  ...
except client.exceptions.DeviceRetiredException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) –

    The specified device has been retired.

    • message (string) –

    • Error (dict) – Normalized access to common exception attributes.

      • Code (string) – An identifier specifying the exception type.

      • Message (string) – A descriptive message explaining why the exception occured.

class Braket.Client.exceptions.InternalServiceException

The request processing has failed because of an unknown error, exception, or failure.

Example

try:
  ...
except client.exceptions.InternalServiceException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) –

    The request processing has failed because of an unknown error, exception, or failure.

    • message (string) –

    • Error (dict) – Normalized access to common exception attributes.

      • Code (string) – An identifier specifying the exception type.

      • Message (string) – A descriptive message explaining why the exception occured.

class Braket.Client.exceptions.ResourceNotFoundException

The specified resource was not found.

Example

try:
  ...
except client.exceptions.ResourceNotFoundException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) –

    The specified resource was not found.

    • message (string) –

    • Error (dict) – Normalized access to common exception attributes.

      • Code (string) – An identifier specifying the exception type.

      • Message (string) – A descriptive message explaining why the exception occured.

class Braket.Client.exceptions.ServiceQuotaExceededException

The request failed because a service quota is exceeded.

Example

try:
  ...
except client.exceptions.ServiceQuotaExceededException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) –

    The request failed because a service quota is exceeded.

    • message (string) –

    • Error (dict) – Normalized access to common exception attributes.

      • Code (string) – An identifier specifying the exception type.

      • Message (string) – A descriptive message explaining why the exception occured.

class Braket.Client.exceptions.ThrottlingException

The throttling rate limit is met.

Example

try:
  ...
except client.exceptions.ThrottlingException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) –

    The throttling rate limit is met.

    • message (string) –

    • Error (dict) – Normalized access to common exception attributes.

      • Code (string) – An identifier specifying the exception type.

      • Message (string) – A descriptive message explaining why the exception occured.

class Braket.Client.exceptions.ValidationException

The input fails to satisfy the constraints specified by an AWS service.

Example

try:
  ...
except client.exceptions.ValidationException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) –

    The input fails to satisfy the constraints specified by an AWS service.

    • message (string) –

    • Error (dict) – Normalized access to common exception attributes.

      • Code (string) – An identifier specifying the exception type.

      • Message (string) – A descriptive message explaining why the exception occured.

Paginators

The available paginators are:

class Braket.Paginator.SearchDevices
paginator = client.get_paginator('search_devices')
paginate(**kwargs)

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'
    }
)
Parameters:
  • filters (list) –

    [REQUIRED]

    The filter values to use to search for a device.

    • (dict) –

      The filter to use for searching devices.

      • name (string) – [REQUIRED]

        The name to use to filter results.

      • values (list) – [REQUIRED]

        The values to use to filter results.

        • (string) –

  • PaginationConfig (dict) –

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) –

      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.

    • PageSize (integer) –

      The size of each page.

    • StartingToken (string) –

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type:

dict

Returns:

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.

class Braket.Paginator.SearchJobs
paginator = client.get_paginator('search_jobs')
paginate(**kwargs)

Creates an iterator that will paginate through responses from Braket.Client.search_jobs().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    filters=[
        {
            'name': 'string',
            'operator': 'LT'|'LTE'|'EQUAL'|'GT'|'GTE'|'BETWEEN'|'CONTAINS',
            'values': [
                'string',
            ]
        },
    ],
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters:
  • filters (list) –

    [REQUIRED]

    The filter values to use when searching for a job.

    • (dict) –

      A filter used to search for Amazon Braket jobs.

      • name (string) – [REQUIRED]

        The name to use for the jobs filter.

      • operator (string) – [REQUIRED]

        An operator to use for the jobs filter.

      • values (list) – [REQUIRED]

        The values to use for the jobs filter.

        • (string) –

  • PaginationConfig (dict) –

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) –

      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.

    • PageSize (integer) –

      The size of each page.

    • StartingToken (string) –

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type:

dict

Returns:

Response Syntax

{
    'jobs': [
        {
            'createdAt': datetime(2015, 1, 1),
            'device': 'string',
            'endedAt': datetime(2015, 1, 1),
            'jobArn': 'string',
            'jobName': 'string',
            'startedAt': datetime(2015, 1, 1),
            'status': 'QUEUED'|'RUNNING'|'COMPLETED'|'FAILED'|'CANCELLING'|'CANCELLED',
            'tags': {
                'string': 'string'
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) –

    • jobs (list) –

      An array of JobSummary objects for devices that match the specified filter values.

      • (dict) –

        Provides summary information about an Amazon Braket job.

        • createdAt (datetime) –

          The date and time that the Amazon Braket job was created.

        • device (string) –

          Provides summary information about the primary device used by an Amazon Braket job.

        • endedAt (datetime) –

          The date and time that the Amazon Braket job ended.

        • jobArn (string) –

          The ARN of the Amazon Braket job.

        • jobName (string) –

          The name of the Amazon Braket job.

        • startedAt (datetime) –

          The date and time that the Amazon Braket job was started.

        • status (string) –

          The status of the Amazon Braket job.

        • tags (dict) –

          A tag object that consists of a key and an optional value, used to manage metadata for Amazon Braket resources.

          • (string) –

            • (string) –

    • NextToken (string) –

      A token to resume pagination.

class Braket.Paginator.SearchQuantumTasks
paginator = client.get_paginator('search_quantum_tasks')
paginate(**kwargs)

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'
    }
)
Parameters:
  • filters (list) –

    [REQUIRED]

    Array of SearchQuantumTasksFilter objects.

    • (dict) –

      A filter to use to search for tasks.

      • name (string) – [REQUIRED]

        The name of the device used for the task.

      • operator (string) – [REQUIRED]

        An operator to use in the filter.

      • values (list) – [REQUIRED]

        The values to use for the filter.

        • (string) –

  • PaginationConfig (dict) –

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) –

      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.

    • PageSize (integer) –

      The size of each page.

    • StartingToken (string) –

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type:

dict

Returns:

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.

          • (string) –

            • (string) –

    • NextToken (string) –

      A token to resume pagination.