LabelingJob class

Manage an Amazon SageMaker labeling job.

Example Usage

Basic usage:

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

// https://docs.aws.amazon.com/sagemaker/latest/dg/sms-named-entity-recg.html#sms-creating-ner-api.
const test = new aws.sagemaker.LabelingJob("test", {
    humanTaskConfig: {
        uiConfig: {
            humanTaskUiArn: "arn:aws:sagemaker:us-west-2:394669845002:human-task-ui/NamedEntityRecognition",
        },
        annotationConsolidationConfig: {
            annotationConsolidationLambdaArn: "arn:aws:lambda:us-west-2:081040173940:function:ACS-NamedEntityRecognition",
        },
        numberOfHumanWorkersPerDataObject: 1,
        taskDescription: "Apply the labels provided to specific words or phrases within the larger text block.",
        taskTitle: "Named entity Recognition task",
        taskTimeLimitInSeconds: 28800,
        workteamArn: example.arn,
        preHumanTaskLambdaArn: "arn:aws:lambda:us-west-2:081040173940:function:PRE-NamedEntityRecognition",
    },
    inputConfig: {
        dataSource: {
            snsDataSource: {
                snsTopicArn: exampleAwsSnsTopic.arn,
            },
        },
    },
    outputConfig: {
        s3OutputPath: `s3://${exampleAwsS3Bucket.bucket}/`,
    },
    labelAttributeName: "label1",
    labelingJobName: "my-labeling-job",
    roleArn: exampleAwsIamRole.arn,
    labelCategoryConfigS3Uri: `s3://${exampleAwsS3Bucket.bucket}/${exampleAwsS3Object.key}`,
});
import pulumi
import pulumi_aws as aws

# https://docs.aws.amazon.com/sagemaker/latest/dg/sms-named-entity-recg.html#sms-creating-ner-api.
test = aws.sagemaker.LabelingJob("test",
    human_task_config={
        "ui_config": {
            "human_task_ui_arn": "arn:aws:sagemaker:us-west-2:394669845002:human-task-ui/NamedEntityRecognition",
        },
        "annotation_consolidation_config": {
            "annotation_consolidation_lambda_arn": "arn:aws:lambda:us-west-2:081040173940:function:ACS-NamedEntityRecognition",
        },
        "number_of_human_workers_per_data_object": 1,
        "task_description": "Apply the labels provided to specific words or phrases within the larger text block.",
        "task_title": "Named entity Recognition task",
        "task_time_limit_in_seconds": 28800,
        "workteam_arn": example["arn"],
        "pre_human_task_lambda_arn": "arn:aws:lambda:us-west-2:081040173940:function:PRE-NamedEntityRecognition",
    },
    input_config={
        "data_source": {
            "sns_data_source": {
                "sns_topic_arn": example_aws_sns_topic["arn"],
            },
        },
    },
    output_config={
        "s3_output_path": f"s3://{example_aws_s3_bucket['bucket']}/",
    },
    label_attribute_name="label1",
    labeling_job_name="my-labeling-job",
    role_arn=example_aws_iam_role["arn"],
    label_category_config_s3_uri=f"s3://{example_aws_s3_bucket['bucket']}/{example_aws_s3_object['key']}")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    // https://docs.aws.amazon.com/sagemaker/latest/dg/sms-named-entity-recg.html#sms-creating-ner-api.
    var test = new Aws.Sagemaker.LabelingJob("test", new()
    {
        HumanTaskConfig = new Aws.Sagemaker.Inputs.LabelingJobHumanTaskConfigArgs
        {
            UiConfig = new Aws.Sagemaker.Inputs.LabelingJobHumanTaskConfigUiConfigArgs
            {
                HumanTaskUiArn = "arn:aws:sagemaker:us-west-2:394669845002:human-task-ui/NamedEntityRecognition",
            },
            AnnotationConsolidationConfig = new Aws.Sagemaker.Inputs.LabelingJobHumanTaskConfigAnnotationConsolidationConfigArgs
            {
                AnnotationConsolidationLambdaArn = "arn:aws:lambda:us-west-2:081040173940:function:ACS-NamedEntityRecognition",
            },
            NumberOfHumanWorkersPerDataObject = 1,
            TaskDescription = "Apply the labels provided to specific words or phrases within the larger text block.",
            TaskTitle = "Named entity Recognition task",
            TaskTimeLimitInSeconds = 28800,
            WorkteamArn = example.Arn,
            PreHumanTaskLambdaArn = "arn:aws:lambda:us-west-2:081040173940:function:PRE-NamedEntityRecognition",
        },
        InputConfig = new Aws.Sagemaker.Inputs.LabelingJobInputConfigArgs
        {
            DataSource = new Aws.Sagemaker.Inputs.LabelingJobInputConfigDataSourceArgs
            {
                SnsDataSource = new Aws.Sagemaker.Inputs.LabelingJobInputConfigDataSourceSnsDataSourceArgs
                {
                    SnsTopicArn = exampleAwsSnsTopic.Arn,
                },
            },
        },
        OutputConfig = new Aws.Sagemaker.Inputs.LabelingJobOutputConfigArgs
        {
            S3OutputPath = $"s3://{exampleAwsS3Bucket.Bucket}/",
        },
        LabelAttributeName = "label1",
        LabelingJobName = "my-labeling-job",
        RoleArn = exampleAwsIamRole.Arn,
        LabelCategoryConfigS3Uri = $"s3://{exampleAwsS3Bucket.Bucket}/{exampleAwsS3Object.Key}",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sagemaker"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// https://docs.aws.amazon.com/sagemaker/latest/dg/sms-named-entity-recg.html#sms-creating-ner-api.
		_, err := sagemaker.NewLabelingJob(ctx, "test", &sagemaker.LabelingJobArgs{
			HumanTaskConfig: &sagemaker.LabelingJobHumanTaskConfigArgs{
				UiConfig: &sagemaker.LabelingJobHumanTaskConfigUiConfigArgs{
					HumanTaskUiArn: pulumi.String("arn:aws:sagemaker:us-west-2:394669845002:human-task-ui/NamedEntityRecognition"),
				},
				AnnotationConsolidationConfig: &sagemaker.LabelingJobHumanTaskConfigAnnotationConsolidationConfigArgs{
					AnnotationConsolidationLambdaArn: pulumi.String("arn:aws:lambda:us-west-2:081040173940:function:ACS-NamedEntityRecognition"),
				},
				NumberOfHumanWorkersPerDataObject: pulumi.Int(1),
				TaskDescription:                   pulumi.String("Apply the labels provided to specific words or phrases within the larger text block."),
				TaskTitle:                         pulumi.String("Named entity Recognition task"),
				TaskTimeLimitInSeconds:            pulumi.Int(28800),
				WorkteamArn:                       pulumi.Any(example.Arn),
				PreHumanTaskLambdaArn:             pulumi.String("arn:aws:lambda:us-west-2:081040173940:function:PRE-NamedEntityRecognition"),
			},
			InputConfig: &sagemaker.LabelingJobInputConfigArgs{
				DataSource: &sagemaker.LabelingJobInputConfigDataSourceArgs{
					SnsDataSource: &sagemaker.LabelingJobInputConfigDataSourceSnsDataSourceArgs{
						SnsTopicArn: pulumi.Any(exampleAwsSnsTopic.Arn),
					},
				},
			},
			OutputConfig: &sagemaker.LabelingJobOutputConfigArgs{
				S3OutputPath: pulumi.Sprintf("s3://%v/", exampleAwsS3Bucket.Bucket),
			},
			LabelAttributeName:       pulumi.String("label1"),
			LabelingJobName:          pulumi.String("my-labeling-job"),
			RoleArn:                  pulumi.Any(exampleAwsIamRole.Arn),
			LabelCategoryConfigS3Uri: pulumi.Sprintf("s3://%v/%v", exampleAwsS3Bucket.Bucket, exampleAwsS3Object.Key),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

# https://docs.aws.amazon.com/sagemaker/latest/dg/sms-named-entity-recg.html#sms-creating-ner-api.
resource "aws_sagemaker_labelingjob" "test" {
  human_task_config = {
    ui_config = {
      human_task_ui_arn = "arn:aws:sagemaker:us-west-2:394669845002:human-task-ui/NamedEntityRecognition"
    }
    annotation_consolidation_config = {
      annotation_consolidation_lambda_arn = "arn:aws:lambda:us-west-2:081040173940:function:ACS-NamedEntityRecognition"
    }
    number_of_human_workers_per_data_object = 1
    task_description                        = "Apply the labels provided to specific words or phrases within the larger text block."
    task_title                              = "Named entity Recognition task"
    task_time_limit_in_seconds              = 28800
    workteam_arn                            = example.arn
    pre_human_task_lambda_arn               = "arn:aws:lambda:us-west-2:081040173940:function:PRE-NamedEntityRecognition"
  }
  input_config = {
    data_source = {
      sns_data_source = {
        sns_topic_arn = exampleAwsSnsTopic.arn
      }
    }
  }
  output_config = {
    s3_output_path ="s3://${exampleAwsS3Bucket.bucket}/"
  }
  label_attribute_name         = "label1"
  labeling_job_name            = "my-labeling-job"
  role_arn                     = exampleAwsIamRole.arn
  label_category_config_s3_uri ="s3://${exampleAwsS3Bucket.bucket}/${exampleAwsS3Object.key}"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sagemaker.LabelingJob;
import com.pulumi.aws.sagemaker.LabelingJobArgs;
import com.pulumi.aws.sagemaker.inputs.LabelingJobHumanTaskConfigArgs;
import com.pulumi.aws.sagemaker.inputs.LabelingJobHumanTaskConfigUiConfigArgs;
import com.pulumi.aws.sagemaker.inputs.LabelingJobHumanTaskConfigAnnotationConsolidationConfigArgs;
import com.pulumi.aws.sagemaker.inputs.LabelingJobInputConfigArgs;
import com.pulumi.aws.sagemaker.inputs.LabelingJobInputConfigDataSourceArgs;
import com.pulumi.aws.sagemaker.inputs.LabelingJobInputConfigDataSourceSnsDataSourceArgs;
import com.pulumi.aws.sagemaker.inputs.LabelingJobOutputConfigArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        // https://docs.aws.amazon.com/sagemaker/latest/dg/sms-named-entity-recg.html#sms-creating-ner-api.
        var test = new LabelingJob("test", LabelingJobArgs.builder()
            .humanTaskConfig(LabelingJobHumanTaskConfigArgs.builder()
                .uiConfig(LabelingJobHumanTaskConfigUiConfigArgs.builder()
                    .humanTaskUiArn("arn:aws:sagemaker:us-west-2:394669845002:human-task-ui/NamedEntityRecognition")
                    .build())
                .annotationConsolidationConfig(LabelingJobHumanTaskConfigAnnotationConsolidationConfigArgs.builder()
                    .annotationConsolidationLambdaArn("arn:aws:lambda:us-west-2:081040173940:function:ACS-NamedEntityRecognition")
                    .build())
                .numberOfHumanWorkersPerDataObject(1)
                .taskDescription("Apply the labels provided to specific words or phrases within the larger text block.")
                .taskTitle("Named entity Recognition task")
                .taskTimeLimitInSeconds(28800)
                .workteamArn(example.arn())
                .preHumanTaskLambdaArn("arn:aws:lambda:us-west-2:081040173940:function:PRE-NamedEntityRecognition")
                .build())
            .inputConfig(LabelingJobInputConfigArgs.builder()
                .dataSource(LabelingJobInputConfigDataSourceArgs.builder()
                    .snsDataSource(LabelingJobInputConfigDataSourceSnsDataSourceArgs.builder()
                        .snsTopicArn(exampleAwsSnsTopic.arn())
                        .build())
                    .build())
                .build())
            .outputConfig(LabelingJobOutputConfigArgs.builder()
                .s3OutputPath(String.format("s3://%s/", exampleAwsS3Bucket.bucket()))
                .build())
            .labelAttributeName("label1")
            .labelingJobName("my-labeling-job")
            .roleArn(exampleAwsIamRole.arn())
            .labelCategoryConfigS3Uri(String.format("s3://%s/%s", exampleAwsS3Bucket.bucket(),exampleAwsS3Object.key()))
            .build());

    }
}
resources:
  # https://docs.aws.amazon.com/sagemaker/latest/dg/sms-named-entity-recg.html#sms-creating-ner-api.
  test:
    type: aws:sagemaker:LabelingJob
    properties:
      humanTaskConfig:
        uiConfig:
          humanTaskUiArn: arn:aws:sagemaker:us-west-2:394669845002:human-task-ui/NamedEntityRecognition
        annotationConsolidationConfig:
          annotationConsolidationLambdaArn: arn:aws:lambda:us-west-2:081040173940:function:ACS-NamedEntityRecognition
        numberOfHumanWorkersPerDataObject: 1
        taskDescription: Apply the labels provided to specific words or phrases within the larger text block.
        taskTitle: Named entity Recognition task
        taskTimeLimitInSeconds: 28800
        workteamArn: ${example.arn}
        preHumanTaskLambdaArn: arn:aws:lambda:us-west-2:081040173940:function:PRE-NamedEntityRecognition
      inputConfig:
        dataSource:
          snsDataSource:
            snsTopicArn: ${exampleAwsSnsTopic.arn}
      outputConfig:
        s3OutputPath: s3://${exampleAwsS3Bucket.bucket}/
      labelAttributeName: label1
      labelingJobName: my-labeling-job
      roleArn: ${exampleAwsIamRole.arn}
      labelCategoryConfigS3Uri: s3://${exampleAwsS3Bucket.bucket}/${exampleAwsS3Object.key}

Import

Using pulumi import, import labeling jobs using the labelingJobName. For example:

$ pulumi import aws:sagemaker/labelingJob:LabelingJob example my-labeling-job

Constructors

LabelingJob(String name, {LabelingJobArgs? args, CustomResourceOptions? options})
Creates a new LabelingJob. name The Pulumi resource name. args Arguments used to configure this LabelingJob. The set of arguments for LabelingJob. options Resource options controlling this resource's behavior.
LabelingJob.reference(String urn)
Creates a typed reference to an existing LabelingJob resource.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
failureReason ↔ Output<String>
If the job failed, the reason that it failed.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
humanTaskConfig ↔ Output<LabelingJobHumanTaskConfig>
Configuration information required for human workers to complete a labeling task. Fields are documented below.
latefinal
id ↔ Output<String>
getter/setter pairinherited
inputConfig ↔ Output<LabelingJobInputConfig>
Input data for the labeling job. Fields are documented below.
latefinal
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
jobReferenceCode ↔ Output<String>
Unique identifier for work done as part of a labeling job.
latefinal
labelAttributeName ↔ Output<String>
Attribute name to use for the label in the output manifest file.
latefinal
labelCategoryConfigS3Uri ↔ Output<String?>
S3 URI of the file that defines the categories used to label the data objects.
latefinal
labelCounters ↔ Output<List<LabelingJobLabelCounter>>
A breakdown of the number of objects labeled.
latefinal
labelingJobAlgorithmsConfig ↔ Output<LabelingJobLabelingJobAlgorithmsConfig?>
Information required to perform automated data labeling.. Fields are documented below.
latefinal
labelingJobArn ↔ Output<String>
ARN of the labeling job.
latefinal
labelingJobName ↔ Output<String>
Name of the labeling job.
latefinal
labelingJobStatus ↔ Output<String>
Processing status of the labeling job.
latefinal
outputConfig ↔ Output<LabelingJobOutputConfig>
Location of the output data. Fields are documented below.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
roleArn ↔ Output<String>
ARN of IAM role that Amazon SageMaker assumes to perform tasks during data labeling.
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stoppingConditions ↔ Output<List<LabelingJobStoppingCondition>>
Conditions for stopping a labeling job. If any of the conditions are met, the job is automatically stopped. Fields are documented below.
latefinal
tags ↔ Output<Map<String, String>?>
A mapping of tags to assign to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {LabelingJobState? state, CustomResourceOptions? options}) → LabelingJob
Gets an existing LabelingJob resource's state with the given name and id.