Skip to content

create_ml_transform async

create_ml_transform(
    name: NameString,
    input_record_tables: GlueTables,
    parameters: TransformParameters,
    role: RoleString,
    *,
    config_overrides: Optional[AsyncGlueClientConfig] = None,
    description: Optional[DescriptionString] = None,
    glue_version: Optional[GlueVersionString] = None,
    max_capacity: Optional[NullableDouble] = None,
    worker_type: Optional[WorkerType] = None,
    number_of_workers: Optional[NullableInteger] = None,
    timeout: Optional[Timeout] = None,
    max_retries: Optional[NullableInteger] = None,
    tags: Optional[TagsMap] = None,
    transform_encryption: Optional[TransformEncryption] = None,
) -> CreateMLTransformResponse

Creates an Glue machine learning transform. This operation creates the transform and all the necessary parameters to train it.

Call this operation as the first step in the process of using a machine learning transform (such as the FindMatches transform) for deduplicating data. You can provide an optional Description, in addition to the parameters that you want to use for your algorithm.

You must also specify certain parameters for the tasks that Glue runs on your behalf as part of learning from your data and creating a high-quality machine learning transform. These parameters include Role, and optionally, AllocatedCapacity, Timeout, and MaxRetries. For more information, see Jobs.

Parameters:

  • name (NameString) –

    The unique name that you give the transform when you create it.

  • description (Optional[DescriptionString], default: None ) –

    A description of the machine learning transform that is being defined. The default is an empty string.

  • input_record_tables (GlueTables) –

    A list of Glue table definitions used by the transform.

  • parameters (TransformParameters) –

    The algorithmic parameters that are specific to the transform type used. Conditionally dependent on the transform type.

  • role (RoleString) –

    The name or Amazon Resource Name (ARN) of the IAM role with the required permissions. The required permissions include both Glue service role permissions to Glue resources, and Amazon S3 permissions required by the transform.

    • This role needs Glue service role permissions to allow access to resources in Glue. See Attach a Policy to IAM Users That Access Glue.

    • This role needs permission to your Amazon Simple Storage Service (Amazon S3) sources, targets, temporary directory, scripts, and any libraries used by the task run for this transform.

  • glue_version (Optional[GlueVersionString], default: None ) –

    This value determines which version of Glue this machine learning transform is compatible with. Glue 1.0 is recommended for most customers. If the value is not set, the Glue compatibility defaults to Glue 0.9. For more information, see Glue Versions in the developer guide.

  • max_capacity (Optional[NullableDouble], default: None ) –

    The number of Glue data processing units (DPUs) that are allocated to task runs for this transform. You can allocate from 2 to 100 DPUs; the default is 10. A DPU is a relative measure of processing power that consists of 4 vCPUs of compute capacity and 16 GB of memory. For more information, see the Glue pricing page.

    MaxCapacity is a mutually exclusive option with NumberOfWorkers and WorkerType.

    • If either NumberOfWorkers or WorkerType is set, then MaxCapacity cannot be set.

    • If MaxCapacity is set then neither NumberOfWorkers or WorkerType can be set.

    • If WorkerType is set, then NumberOfWorkers is required (and vice versa).

    • MaxCapacity and NumberOfWorkers must both be at least 1.

    When the WorkerType field is set to a value other than Standard, the MaxCapacity field is set automatically and becomes read-only.

    When the WorkerType field is set to a value other than Standard, the MaxCapacity field is set automatically and becomes read-only.

  • worker_type (Optional[WorkerType], default: None ) –

    The type of predefined worker that is allocated when this task runs. Accepts a value of Standard, G.1X, or G.2X.

    • For the Standard worker type, each worker provides 4 vCPU, 16 GB of memory and a 50GB disk, and 2 executors per worker.

    • For the G.1X worker type, each worker provides 4 vCPU, 16 GB of memory and a 64GB disk, and 1 executor per worker.

    • For the G.2X worker type, each worker provides 8 vCPU, 32 GB of memory and a 128GB disk, and 1 executor per worker.

    MaxCapacity is a mutually exclusive option with NumberOfWorkers and WorkerType.

    • If either NumberOfWorkers or WorkerType is set, then MaxCapacity cannot be set.

    • If MaxCapacity is set then neither NumberOfWorkers or WorkerType can be set.

    • If WorkerType is set, then NumberOfWorkers is required (and vice versa).

    • MaxCapacity and NumberOfWorkers must both be at least 1.

  • number_of_workers (Optional[NullableInteger], default: None ) –

    The number of workers of a defined workerType that are allocated when this task runs.

    If WorkerType is set, then NumberOfWorkers is required (and vice versa).

  • timeout (Optional[Timeout], default: None ) –

    The timeout of the task run for this transform in minutes. This is the maximum time that a task run for this transform can consume resources before it is terminated and enters TIMEOUT status. The default is 2,880 minutes (48 hours).

  • max_retries (Optional[NullableInteger], default: None ) –

    The maximum number of times to retry a task for this transform after a task run fails.

  • tags (Optional[TagsMap], default: None ) –

    The tags to use with this machine learning transform. You may use tags to limit access to the machine learning transform. For more information about tags in Glue, see Amazon Web Services Tags in Glue in the developer guide.

  • transform_encryption (Optional[TransformEncryption], default: None ) –

    The encryption-at-rest settings of the transform that apply to accessing user data. Machine learning transforms can access user data encrypted in Amazon S3 using KMS.

Raises:

Source code in docs_src/capo_glue/_services/async_glue.py
async def create_ml_transform(
    self,
    name: "capo_glue.types.name_string.NameString",
    input_record_tables: "capo_glue.types.glue_tables.GlueTables",
    parameters: "capo_glue.types.transform_parameters.TransformParameters",
    role: "capo_glue.types.role_string.RoleString",
    *,
    config_overrides: Optional[AsyncGlueClientConfig] = None,
    description: Optional[
        "capo_glue.types.description_string.DescriptionString"
    ] = None,
    glue_version: Optional[
        "capo_glue.types.glue_version_string.GlueVersionString"
    ] = None,
    max_capacity: Optional["capo_glue.types.nullable_double.NullableDouble"] = None,
    worker_type: Optional["capo_glue.types.worker_type.WorkerType"] = None,
    number_of_workers: Optional[
        "capo_glue.types.nullable_integer.NullableInteger"
    ] = None,
    timeout: Optional["capo_glue.types.timeout.Timeout"] = None,
    max_retries: Optional[
        "capo_glue.types.nullable_integer.NullableInteger"
    ] = None,
    tags: Optional["capo_glue.types.tags_map.TagsMap"] = None,
    transform_encryption: Optional[
        "capo_glue.types.transform_encryption.TransformEncryption"
    ] = None,
) -> "capo_glue.types.create_ml_transform_response.CreateMLTransformResponse":
    """<p>Creates an Glue machine learning transform. This operation creates the transform and all the necessary parameters to train it.</p> <p>Call this operation as the first step in the process of using a machine learning transform (such as the <code>FindMatches</code> transform) for deduplicating data. You can provide an optional <code>Description</code>, in addition to the parameters that you want to use for your algorithm.</p> <p>You must also specify certain parameters for the tasks that Glue runs on your behalf as part of learning from your data and creating a high-quality machine learning transform. These parameters include <code>Role</code>, and optionally, <code>AllocatedCapacity</code>, <code>Timeout</code>, and <code>MaxRetries</code>. For more information, see <a href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-jobs-job.html">Jobs</a>.</p>

    Args:
        name: <p>The unique name that you give the transform when you create it.</p>
        description: <p>A description of the machine learning transform that is being defined. The default is an empty string.</p>
        input_record_tables: <p>A list of Glue table definitions used by the transform.</p>
        parameters: <p>The algorithmic parameters that are specific to the transform type used. Conditionally dependent on the transform type.</p>
        role: <p>The name or Amazon Resource Name (ARN) of the IAM role with the required permissions. The required permissions include both Glue service role permissions to Glue resources, and Amazon S3 permissions required by the transform. </p> <ul> <li> <p>This role needs Glue service role permissions to allow access to resources in Glue. See <a href="https://docs.aws.amazon.com/glue/latest/dg/attach-policy-iam-user.html">Attach a Policy to IAM Users That Access Glue</a>.</p> </li> <li> <p>This role needs permission to your Amazon Simple Storage Service (Amazon S3) sources, targets, temporary directory, scripts, and any libraries used by the task run for this transform.</p> </li> </ul>
        glue_version: <p>This value determines which version of Glue this machine learning transform is compatible with. Glue 1.0 is recommended for most customers. If the value is not set, the Glue compatibility defaults to Glue 0.9. For more information, see <a href="https://docs.aws.amazon.com/glue/latest/dg/release-notes.html#release-notes-versions">Glue Versions</a> in the developer guide.</p>
        max_capacity: <p>The number of Glue data processing units (DPUs) that are allocated to task runs for this transform. You can allocate from 2 to 100 DPUs; the default is 10. A DPU is a relative measure of processing power that consists of 4 vCPUs of compute capacity and 16 GB of memory. For more information, see the <a href="https://aws.amazon.com/glue/pricing/">Glue pricing page</a>. </p> <p> <code>MaxCapacity</code> is a mutually exclusive option with <code>NumberOfWorkers</code> and <code>WorkerType</code>.</p> <ul> <li> <p>If either <code>NumberOfWorkers</code> or <code>WorkerType</code> is set, then <code>MaxCapacity</code> cannot be set.</p> </li> <li> <p>If <code>MaxCapacity</code> is set then neither <code>NumberOfWorkers</code> or <code>WorkerType</code> can be set.</p> </li> <li> <p>If <code>WorkerType</code> is set, then <code>NumberOfWorkers</code> is required (and vice versa).</p> </li> <li> <p> <code>MaxCapacity</code> and <code>NumberOfWorkers</code> must both be at least 1.</p> </li> </ul> <p>When the <code>WorkerType</code> field is set to a value other than <code>Standard</code>, the <code>MaxCapacity</code> field is set automatically and becomes read-only.</p> <p>When the <code>WorkerType</code> field is set to a value other than <code>Standard</code>, the <code>MaxCapacity</code> field is set automatically and becomes read-only.</p>
        worker_type: <p>The type of predefined worker that is allocated when this task runs. Accepts a value of Standard, G.1X, or G.2X.</p> <ul> <li> <p>For the <code>Standard</code> worker type, each worker provides 4 vCPU, 16 GB of memory and a 50GB disk, and 2 executors per worker.</p> </li> <li> <p>For the <code>G.1X</code> worker type, each worker provides 4 vCPU, 16 GB of memory and a 64GB disk, and 1 executor per worker.</p> </li> <li> <p>For the <code>G.2X</code> worker type, each worker provides 8 vCPU, 32 GB of memory and a 128GB disk, and 1 executor per worker.</p> </li> </ul> <p> <code>MaxCapacity</code> is a mutually exclusive option with <code>NumberOfWorkers</code> and <code>WorkerType</code>.</p> <ul> <li> <p>If either <code>NumberOfWorkers</code> or <code>WorkerType</code> is set, then <code>MaxCapacity</code> cannot be set.</p> </li> <li> <p>If <code>MaxCapacity</code> is set then neither <code>NumberOfWorkers</code> or <code>WorkerType</code> can be set.</p> </li> <li> <p>If <code>WorkerType</code> is set, then <code>NumberOfWorkers</code> is required (and vice versa).</p> </li> <li> <p> <code>MaxCapacity</code> and <code>NumberOfWorkers</code> must both be at least 1.</p> </li> </ul>
        number_of_workers: <p>The number of workers of a defined <code>workerType</code> that are allocated when this task runs.</p> <p>If <code>WorkerType</code> is set, then <code>NumberOfWorkers</code> is required (and vice versa).</p>
        timeout: <p>The timeout of the task run for this transform in minutes. This is the maximum time that a task run for this transform can consume resources before it is terminated and enters <code>TIMEOUT</code> status. The default is 2,880 minutes (48 hours).</p>
        max_retries: <p>The maximum number of times to retry a task for this transform after a task run fails.</p>
        tags: <p>The tags to use with this machine learning transform. You may use tags to limit access to the machine learning transform. For more information about tags in Glue, see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">Amazon Web Services Tags in Glue</a> in the developer guide.</p>
        transform_encryption: <p>The encryption-at-rest settings of the transform that apply to accessing user data. Machine learning transforms can access user data encrypted in Amazon S3 using KMS.</p>

    Raises:
        capo_glue.errors.access_denied_exception.AccessDeniedException: <p>Access to a resource was denied.</p>
        capo_glue.errors.already_exists_exception.AlreadyExistsException: <p>A resource to be created or added already exists.</p>
        capo_glue.errors.idempotent_parameter_mismatch_exception.IdempotentParameterMismatchException: <p>The same unique identifier was associated with two different records.</p>
        capo_glue.errors.internal_service_exception.InternalServiceException: <p>An internal service error occurred.</p>
        capo_glue.errors.invalid_input_exception.InvalidInputException: <p>The input provided was not valid.</p>
        capo_glue.errors.operation_timeout_exception.OperationTimeoutException: <p>The operation timed out.</p>
        capo_glue.errors.resource_number_limit_exceeded_exception.ResourceNumberLimitExceededException: <p>A resource numerical limit was exceeded.</p>
        capo_glue.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_glue.types.create_ml_transform_request.CreateMLTransformRequest]",
    ) -> AsyncOperationResponse[
        "capo_glue.types.create_ml_transform_response.CreateMLTransformResponse"
    ]:
        import capo_glue._operations.aws_glue.create_ml_transform

        (
            output,
            http_response,
        ) = await capo_glue._operations.aws_glue.create_ml_transform.async_create_ml_transform(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateMLTransform")
    )
    input_: capo_glue.types.create_ml_transform_request.CreateMLTransformRequest = {
        "name": name,
        "input_record_tables": input_record_tables,
        "parameters": parameters,
        "role": role,
    }
    if description is not None:
        input_["description"] = description
    if glue_version is not None:
        input_["glue_version"] = glue_version
    if max_capacity is not None:
        input_["max_capacity"] = max_capacity
    if worker_type is not None:
        input_["worker_type"] = worker_type
    if number_of_workers is not None:
        input_["number_of_workers"] = number_of_workers
    if timeout is not None:
        input_["timeout"] = timeout
    if max_retries is not None:
        input_["max_retries"] = max_retries
    if tags is not None:
        input_["tags"] = tags
    if transform_encryption is not None:
        input_["transform_encryption"] = transform_encryption

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output