Braket

2023/12/04 - Braket - 4 updated api methods

Changes  This release enhances service support to create quantum tasks and hybrid jobs associated with Braket Direct Reservations.

CreateJob (updated) Link ¶
Changes (request)
{'associations': [{'arn': 'string', 'type': 'RESERVATION_TIME_WINDOW_ARN'}]}

Creates an Amazon Braket job.

See also: AWS API Documentation

Request Syntax

client.create_job(
    algorithmSpecification={
        'containerImage': {
            'uri': 'string'
        },
        'scriptModeConfig': {
            'compressionType': 'NONE'|'GZIP',
            'entryPoint': 'string',
            's3Uri': 'string'
        }
    },
    associations=[
        {
            'arn': 'string',
            'type': 'RESERVATION_TIME_WINDOW_ARN'
        },
    ],
    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'
    }
)
type algorithmSpecification

dict

param algorithmSpecification

[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.

type associations

list

param associations

The list of Amazon Braket resources associated with the hybrid job.

  • (dict) --

    The Amazon Braket resource and the association type.

    • arn (string) -- [REQUIRED]

      The Amazon Braket resource arn.

    • type (string) -- [REQUIRED]

      The association type for the specified Amazon Braket resource arn.

type checkpointConfig

dict

param checkpointConfig

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 .

type clientToken

string

param clientToken

[REQUIRED]

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

This field is autopopulated if not provided.

type deviceConfig

dict

param deviceConfig

[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.

type hyperParameters

dict

param hyperParameters

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) --

type inputDataConfig

list

param inputDataConfig

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.

type instanceConfig

dict

param instanceConfig

[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.

type jobName

string

param jobName

[REQUIRED]

The name of the Amazon Braket job.

type outputDataConfig

dict

param outputDataConfig

[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 .

type roleArn

string

param roleArn

[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.

type stoppingCondition

dict

param stoppingCondition

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.

type tags

dict

param tags

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

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{
    'jobArn': 'string'
}

Response Structure

  • (dict) --

    • jobArn (string) --

      The ARN of the Amazon Braket job created.

CreateQuantumTask (updated) Link ¶
Changes (request)
{'associations': [{'arn': 'string', 'type': 'RESERVATION_TIME_WINDOW_ARN'}]}

Creates a quantum task.

See also: AWS API Documentation

Request Syntax

client.create_quantum_task(
    action='string',
    associations=[
        {
            'arn': 'string',
            'type': 'RESERVATION_TIME_WINDOW_ARN'
        },
    ],
    clientToken='string',
    deviceArn='string',
    deviceParameters='string',
    jobToken='string',
    outputS3Bucket='string',
    outputS3KeyPrefix='string',
    shots=123,
    tags={
        'string': 'string'
    }
)
type action

string

param action

[REQUIRED]

The action associated with the task.

type associations

list

param associations

The list of Amazon Braket resources associated with the quantum task.

  • (dict) --

    The Amazon Braket resource and the association type.

    • arn (string) -- [REQUIRED]

      The Amazon Braket resource arn.

    • type (string) -- [REQUIRED]

      The association type for the specified Amazon Braket resource arn.

type clientToken

string

param clientToken

[REQUIRED]

The client token associated with the request.

This field is autopopulated if not provided.

type deviceArn

string

param deviceArn

[REQUIRED]

The ARN of the device to run the task on.

type deviceParameters

string

param deviceParameters

The parameters for the device to run the task on.

type jobToken

string

param jobToken

The token for an Amazon Braket job that associates it with the quantum task.

type outputS3Bucket

string

param outputS3Bucket

[REQUIRED]

The S3 bucket to store task result files in.

type outputS3KeyPrefix

string

param outputS3KeyPrefix

[REQUIRED]

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

type shots

integer

param shots

[REQUIRED]

The number of shots to use for the task.

type tags

dict

param tags

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

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{
    'quantumTaskArn': 'string'
}

Response Structure

  • (dict) --

    • quantumTaskArn (string) --

      The ARN of the task created by the request.

GetJob (updated) Link ¶
Changes (response)
{'associations': [{'arn': 'string', 'type': 'RESERVATION_TIME_WINDOW_ARN'}]}

Retrieves the specified Amazon Braket job.

See also: AWS API Documentation

Request Syntax

client.get_job(
    additionalAttributeNames=[
        'QueueInfo',
    ],
    jobArn='string'
)
type additionalAttributeNames

list

param additionalAttributeNames

A list of attributes to return information for.

  • (string) --

type jobArn

string

param jobArn

[REQUIRED]

The ARN of the job to retrieve.

rtype

dict

returns

Response Syntax

{
    'algorithmSpecification': {
        'containerImage': {
            'uri': 'string'
        },
        'scriptModeConfig': {
            'compressionType': 'NONE'|'GZIP',
            'entryPoint': 'string',
            's3Uri': 'string'
        }
    },
    'associations': [
        {
            'arn': 'string',
            'type': 'RESERVATION_TIME_WINDOW_ARN'
        },
    ],
    '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'
    },
    'queueInfo': {
        'message': 'string',
        'position': 'string',
        'queue': 'QUANTUM_TASKS_QUEUE'|'JOBS_QUEUE'
    },
    '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.

    • associations (list) --

      The list of Amazon Braket resources associated with the hybrid job.

      • (dict) --

        The Amazon Braket resource and the association type.

        • arn (string) --

          The Amazon Braket resource arn.

        • type (string) --

          The association type for the specified Amazon Braket resource arn.

    • 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) --

          The 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 .

    • queueInfo (dict) --

      Queue information for the requested job. Only returned if QueueInfo is specified in the additionalAttributeNames" field in the GetJob API request.

      • message (string) --

        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.

      • position (string) --

        Current position of the job in the jobs queue.

      • queue (string) --

        The name of the queue.

    • 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) --

GetQuantumTask (updated) Link ¶
Changes (response)
{'associations': [{'arn': 'string', 'type': 'RESERVATION_TIME_WINDOW_ARN'}]}

Retrieves the specified quantum task.

See also: AWS API Documentation

Request Syntax

client.get_quantum_task(
    additionalAttributeNames=[
        'QueueInfo',
    ],
    quantumTaskArn='string'
)
type additionalAttributeNames

list

param additionalAttributeNames

A list of attributes to return information for.

  • (string) --

type quantumTaskArn

string

param quantumTaskArn

[REQUIRED]

The ARN of the task to retrieve.

rtype

dict

returns

Response Syntax

{
    'associations': [
        {
            'arn': 'string',
            'type': 'RESERVATION_TIME_WINDOW_ARN'
        },
    ],
    'createdAt': datetime(2015, 1, 1),
    'deviceArn': 'string',
    'deviceParameters': 'string',
    'endedAt': datetime(2015, 1, 1),
    'failureReason': 'string',
    'jobArn': 'string',
    'outputS3Bucket': 'string',
    'outputS3Directory': 'string',
    'quantumTaskArn': 'string',
    'queueInfo': {
        'message': 'string',
        'position': 'string',
        'queue': 'QUANTUM_TASKS_QUEUE'|'JOBS_QUEUE',
        'queuePriority': 'Normal'|'Priority'
    },
    'shots': 123,
    'status': 'CREATED'|'QUEUED'|'RUNNING'|'COMPLETED'|'FAILED'|'CANCELLING'|'CANCELLED',
    'tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    • associations (list) --

      The list of Amazon Braket resources associated with the quantum task.

      • (dict) --

        The Amazon Braket resource and the association type.

        • arn (string) --

          The Amazon Braket resource arn.

        • type (string) --

          The association type for the specified Amazon Braket resource arn.

    • 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.

    • queueInfo (dict) --

      Queue information for the requested quantum task. Only returned if QueueInfo is specified in the additionalAttributeNames" field in the GetQuantumTask API request.

      • message (string) --

        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.

      • position (string) --

        Current position of the task in the quantum tasks queue.

      • queue (string) --

        The name of the queue.

      • queuePriority (string) --

        Optional. Specifies the priority of the queue. Quantum tasks in a priority queue are processed before the tasks in a normal queue.

    • 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) --