IoTSiteWise / Client / create_task

create_task

IoTSiteWise.Client.create_task(**kwargs)

Creates a new task in the specified workspace. A task defines a reusable containerized compute workload that can be referenced by one or more pipeline compute nodes.

Specify a containerTaskConfiguration for custom container workloads with configurable ECR image, processing type, processing unit, and environment variables.

See also: AWS API Documentation

Request Syntax

response = client.create_task(
    workspaceName='string',
    taskName='string',
    description='string',
    taskConfiguration={
        'containerTaskConfiguration': {
            'ecrUri': 'string',
            'taskExecutionRole': 'string',
            'processingType': 'GENERIC_COMPUTE_PROCESSING'|'HARDWARE_ACCELERATED_PROCESSING',
            'processingUnit': 'UNITS_2'|'UNITS_4'|'UNITS_8'|'UNITS_12'|'UNITS_16'|'UNITS_24'|'UNITS_32'|'UNITS_36'|'UNITS_48'|'UNITS_60'|'UNITS_64'|'UNITS_72'|'UNITS_84'|'UNITS_96',
            'ephemeralStorageConfiguration': {
                'storageClass': 'STANDARD_1'|'STANDARD_2'|'THROUGHPUT_1'|'THROUGHPUT_2',
                'storageSizeInGiB': 123
            },
            'command': [
                'string',
            ],
            'timeoutSeconds': 123,
            'environmentVariables': {
                'string': 'string'
            },
            'mounts': [
                {
                    'name': 'string',
                    'relativePath': 'string',
                    'source': {
                        's3AccessPoint': {
                            'accessPointArn': 'string',
                            'prefix': 'string'
                        }
                    },
                    'storageType': 'SHARED_STORAGE'
                },
            ]
        }
    },
    tags={
        'string': 'string'
    },
    clientToken='string'
)
Parameters:
  • workspaceName (string) –

    [REQUIRED]

    The name of the workspace.

  • taskName (string) –

    [REQUIRED]

    The name of the task to create. Must be unique within the workspace.

  • description (string) – A description of the task.

  • taskConfiguration (dict) –

    [REQUIRED]

    The task execution configuration. Specify a containerTaskConfiguration for custom container workloads.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: containerTaskConfiguration.

    • containerTaskConfiguration (dict) –

      Configuration for running a custom container image on managed compute.

      • ecrUri (string) – [REQUIRED]

        The Amazon ECR image URI for the task container.

      • taskExecutionRole (string) – [REQUIRED]

        The ARN of the IAM role that grants the containerized workload permissions to access AWS resources.

      • processingType (string) – [REQUIRED]

        The processing type for compute resources.

      • processingUnit (string) – [REQUIRED]

        The processing unit allocation that determines the vCPU, memory, and GPU resources.

      • ephemeralStorageConfiguration (dict) –

        Ephemeral storage configuration for the container task.

        • storageClass (string) – [REQUIRED]

          Storage type that determines I/O performance family and level.

        • storageSizeInGiB (integer) – [REQUIRED]

          Storage volume size in GiB.

      • command (list) –

        The command to execute in the container.

        • (string) –

      • timeoutSeconds (integer) –

        The timeout in seconds for task execution. Default: 3600 (1 hour).

      • environmentVariables (dict) –

        Environment variables passed to the container at runtime.

        • (string) –

          Environment variable name following POSIX naming rules Must not start with AWS_ prefix (case-insensitive)

          • (string) –

            Environment variable value

      • mounts (list) –

        Mounts attached to the container filesystem. Each mount exposes an external data source as a local directory inside the container. The service assigns each mount a container path based on the mount name. The container reads files through that path as if the data were on the local filesystem.

        • (dict) –

          Attaches a data source to the container filesystem for a task at a customer-supplied relative path under the service-owned mount root.

          • name (string) – [REQUIRED]

            A unique name for the mount within the task.

          • relativePath (string) – [REQUIRED]

            The relative path under the service-owned mount root where this mount is attached inside the container.

          • source (dict) – [REQUIRED]

            The data source for the mount.

            Note

            This is a Tagged Union structure. Only one of the following top level keys can be set: s3AccessPoint.

            • s3AccessPoint (dict) –

              Configuration for a mount that reads from an Amazon S3 access point.

              • accessPointArn (string) – [REQUIRED]

                The Amazon Resource Name (ARN) of the S3 access point.

              • prefix (string) –

                An optional key prefix to scope the mount to a subset of objects at the access point.

          • storageType (string) – [REQUIRED]

            The type of storage used for the mount.

  • tags (dict) –

    A list of key-value pairs that contain metadata for the task. For more information, see Tagging your AWS IoT SiteWise resources in the AWS IoT SiteWise User Guide.

    • (string) –

      • (string) –

  • clientToken (string) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request that completed successfully using the same client token, the server returns the cached result from the original successful request without performing the operation again.

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'taskName': 'string',
    'taskArn': 'string',
    'version': 'string',
    'status': {
        'error': {
            'code': 'VALIDATION_ERROR'|'INTERNAL_FAILURE',
            'message': 'string'
        },
        'state': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'FAILED'
    }
}

Response Structure

  • (dict) –

    Response structure for CreateTask operation.

    • taskName (string) –

      The name of the created task.

    • taskArn (string) –

      The ARN of the created task.

    • version (string) –

      The version of the newly created task.

    • status (dict) –

      The current lifecycle status of the task.

      • error (dict) –

        Contains associated error information, if any.

        • code (string) –

          The error code.

        • message (string) –

          The error message.

      • state (string) –

        The current status of the resource.

Exceptions