SparkJobProps Struct
Common properties for different types of Spark jobs.
| Source | aws-glue/lib/jobs/spark-job.ts |
|---|---|
| Type last changed |
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_glue as glue } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_logs as logs } from 'aws-cdk-lib';
import { aws_s3 as s3 } from 'aws-cdk-lib';
declare const bucket: s3.Bucket;
declare const code: glue.Code;
declare const connection: glue.Connection;
declare const logGroup: logs.LogGroup;
declare const role: iam.Role;
declare const securityConfiguration: glue.SecurityConfiguration;
const sparkJobProps: glue.SparkJobProps = {
role: role,
script: code,
// the properties below are optional
connections: [connection],
continuousLogging: {
enabled: false,
// the properties below are optional
conversionPattern: 'conversionPattern',
logGroup: logGroup,
logStreamPrefix: 'logStreamPrefix',
quiet: false,
},
defaultArguments: {
defaultArgumentsKey: 'defaultArguments',
},
description: 'description',
enableMetrics: false,
enableObservabilityMetrics: false,
glueVersion: glue.GlueVersion.V0_9,
jobName: 'jobName',
maxConcurrentRuns: 123,
maxRetries: 123,
securityConfiguration: securityConfiguration,
sparkUI: {
bucket: bucket,
prefix: 'prefix',
},
tags: {
tagsKey: 'tags',
},
timeout: cdk.Duration.minutes(30),
workerConfiguration: {
numberOfWorkers: 123,
workerType: glue.WorkerType.STANDARD,
},
};
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_glue as glue
from aws_cdk import aws_iam as iam
from aws_cdk import aws_logs as logs
from aws_cdk import aws_s3 as s3
# bucket: s3.Bucket
# code: glue.Code
# connection: glue.Connection
# log_group: logs.LogGroup
# role: iam.Role
# security_configuration: glue.SecurityConfiguration
spark_job_props = glue.SparkJobProps(
role=role,
script=code,
# the properties below are optional
connections=[connection],
continuous_logging=glue.ContinuousLoggingProps(
enabled=False,
# the properties below are optional
conversion_pattern="conversionPattern",
log_group=log_group,
log_stream_prefix="logStreamPrefix",
quiet=False
),
default_arguments={
"default_arguments_key": "defaultArguments"
},
description="description",
enable_metrics=False,
enable_observability_metrics=False,
glue_version=glue.GlueVersion.V0_9,
job_name="jobName",
max_concurrent_runs=123,
max_retries=123,
security_configuration=security_configuration,
spark_ui=glue.SparkUIProps(
bucket=bucket,
prefix="prefix"
),
tags={
"tags_key": "tags"
},
timeout=cdk.Duration.minutes(30),
worker_configuration=glue.WorkerConfiguration(
number_of_workers=123,
worker_type=glue.WorkerType.STANDARD
)
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.glue.*;
import software.amazon.awscdk.services.iam.*;
import software.amazon.awscdk.services.logs.*;
import software.amazon.awscdk.services.s3.*;
Bucket bucket;
Code code;
Connection connection;
LogGroup logGroup;
Role role;
SecurityConfiguration securityConfiguration;
SparkJobProps sparkJobProps = SparkJobProps.builder()
.role(role)
.script(code)
// the properties below are optional
.connections(List.of(connection))
.continuousLogging(ContinuousLoggingProps.builder()
.enabled(false)
// the properties below are optional
.conversionPattern("conversionPattern")
.logGroup(logGroup)
.logStreamPrefix("logStreamPrefix")
.quiet(false)
.build())
.defaultArguments(Map.of(
"defaultArgumentsKey", "defaultArguments"))
.description("description")
.enableMetrics(false)
.enableObservabilityMetrics(false)
.glueVersion(GlueVersion.V0_9)
.jobName("jobName")
.maxConcurrentRuns(123)
.maxRetries(123)
.securityConfiguration(securityConfiguration)
.sparkUI(SparkUIProps.builder()
.bucket(bucket)
.prefix("prefix")
.build())
.tags(Map.of(
"tagsKey", "tags"))
.timeout(Duration.minutes(30))
.workerConfiguration(WorkerConfiguration.builder()
.numberOfWorkers(123)
.workerType(WorkerType.STANDARD)
.build())
.build();
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.Glue;
using Amazon.CDK.AWS.IAM;
using Amazon.CDK.AWS.Logs;
using Amazon.CDK.AWS.S3;
Bucket bucket;
Code code;
Connection connection;
LogGroup logGroup;
Role role;
SecurityConfiguration securityConfiguration;
var sparkJobProps = new SparkJobProps {
Role = role,
Script = code,
// the properties below are optional
Connections = new [] { connection },
ContinuousLogging = new ContinuousLoggingProps {
Enabled = false,
// the properties below are optional
ConversionPattern = "conversionPattern",
LogGroup = logGroup,
LogStreamPrefix = "logStreamPrefix",
Quiet = false
},
DefaultArguments = new Dictionary<string, string> {
{ "defaultArgumentsKey", "defaultArguments" }
},
Description = "description",
EnableMetrics = false,
EnableObservabilityMetrics = false,
GlueVersion = GlueVersion.V0_9,
JobName = "jobName",
MaxConcurrentRuns = 123,
MaxRetries = 123,
SecurityConfiguration = securityConfiguration,
SparkUI = new SparkUIProps {
Bucket = bucket,
Prefix = "prefix"
},
Tags = new Dictionary<string, string> {
{ "tagsKey", "tags" }
},
Timeout = Duration.Minutes(30),
WorkerConfiguration = new WorkerConfiguration {
NumberOfWorkers = 123,
WorkerType = WorkerType.STANDARD
}
};
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var bucket Bucket
var code Code
var connection Connection
var logGroup LogGroup
var role Role
var securityConfiguration SecurityConfiguration
sparkJobProps := &SparkJobProps{
Role: role,
Script: code,
// the properties below are optional
Connections: []IConnection{
connection,
},
ContinuousLogging: &ContinuousLoggingProps{
Enabled: jsii.Boolean(false),
// the properties below are optional
ConversionPattern: jsii.String("conversionPattern"),
LogGroup: logGroup,
LogStreamPrefix: jsii.String("logStreamPrefix"),
Quiet: jsii.Boolean(false),
},
DefaultArguments: map[string]*string{
"defaultArgumentsKey": jsii.String("defaultArguments"),
},
Description: jsii.String("description"),
EnableMetrics: jsii.Boolean(false),
EnableObservabilityMetrics: jsii.Boolean(false),
GlueVersion: awscdk.Aws_glue.GlueVersion_V0_9,
JobName: jsii.String("jobName"),
MaxConcurrentRuns: jsii.Number(123),
MaxRetries: jsii.Number(123),
SecurityConfiguration: securityConfiguration,
SparkUI: &SparkUIProps{
Bucket: bucket,
Prefix: jsii.String("prefix"),
},
Tags: map[string]*string{
"tagsKey": jsii.String("tags"),
},
Timeout: cdk.Duration_Minutes(jsii.Number(30)),
WorkerConfiguration: &WorkerConfiguration{
NumberOfWorkers: jsii.Number(123),
WorkerType: awscdk.*Aws_glue.WorkerType_STANDARD,
},
}
Properties
connectionsoptionalIConnection[]connectionsoptionaltyping.List[IConnection]connectionsoptionalList<IConnection>ConnectionsoptionalIConnection[]Connectionsoptional*[]IConnection #Default: [] - no connections are added to the job
continuousLoggingoptionalContinuousLoggingPropscontinuous_loggingoptionalContinuousLoggingPropscontinuousLoggingoptionalContinuousLoggingPropsContinuousLoggingoptionalContinuousLoggingPropsContinuousLoggingoptionalContinuousLoggingProps #Default: continuous logging is enabled.
defaultArgumentsoptional{ [key: string]: string }default_argumentsoptionaltyping.Mapping[str, str]defaultArgumentsoptionalMap<String, String>DefaultArgumentsoptionalIDictionary<string, string>DefaultArgumentsoptional*map[string]*string #Default: no arguments
notes
This map is the escape hatch for Glue job arguments that this construct does not model. It MUST NOT be used to set arguments that already have a dedicated prop — configure those through the corresponding prop instead (continuousLogging, enableMetrics, enableObservabilityMetrics, sparkUI, className, extraJars, extraJarsFirst, extraPythonFiles, extraFiles). Passing a construct-managed argument (e.g. --enable-continuous-cloudwatch-log, --enable-metrics, --enable-spark-ui, --job-language) or a Glue-reserved argument (--debug, --mode, --JOB_NAME, --endpoint) here throws at synthesis time, so there is exactly one way to express each intent.
Also note that these are emitted verbatim into the CloudFormation template, so avoid placing secrets here in plaintext. Pass secrets to the job at runtime through AWS Secrets Manager instead. A synthesis-time warning is emitted when an argument key looks like a credential and holds a plaintext literal.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #Default: no value
enableMetricsoptionalbooleanenable_metricsoptionalboolenableMetricsoptionalBooleanEnableMetricsoptionalboolEnableMetricsoptional*bool = true #When enabled, adds '--enable-metrics' to job arguments.
enableObservabilityMetricsoptionalbooleanenable_observability_metricsoptionalboolenableObservabilityMetricsoptionalBooleanEnableObservabilityMetricsoptionalboolEnableObservabilityMetricsoptional*bool = true #When enabled, adds '--enable-observability-metrics': 'true' to job arguments.
glueVersionoptionalGlueVersionglue_versionoptionalGlueVersionglueVersionoptionalGlueVersionGlueVersionoptionalGlueVersionGlueVersionoptionalGlueVersion #Default: determined by the job type: 4.0 for ETL and Streaming, 5.0 for Flex, 3.0 for Python Shell
jobNameoptionalstringjob_nameoptionalstrjobNameoptionalStringJobNameoptionalstringJobNameoptional*string #Default: a name is automatically generated
maxConcurrentRunsoptionalnumbermax_concurrent_runsoptionalint | floatmaxConcurrentRunsoptionalNumberMaxConcurrentRunsoptionaldoubleMaxConcurrentRunsoptional*float64 = 1 #An error is returned when this threshold is reached. The maximum value you can specify is controlled by a service limit.
maxRetriesoptionalnumbermax_retriesoptionalint | floatmaxRetriesoptionalNumberMaxRetriesoptionaldoubleMaxRetriesoptional*float64 = 0 #Can be uploaded from the local directory structure using fromAsset or referenced via S3 location using fromBucket
securityConfigurationoptionalISecurityConfigurationsecurity_configurationoptionalISecurityConfigurationsecurityConfigurationoptionalISecurityConfigurationSecurityConfigurationoptionalISecurityConfigurationSecurityConfigurationoptionalISecurityConfiguration #Default: no security configuration.
sparkUIoptionalSparkUIPropsspark_uioptionalSparkUIPropssparkUIoptionalSparkUIPropsSparkUIoptionalSparkUIPropsSparkUIoptionalSparkUIProps #Default: Spark UI debugging and monitoring is disabled.
tagsoptional{ [key: string]: string }tagsoptionaltyping.Mapping[str, str]tagsoptionalMap<String, String>TagsoptionalIDictionary<string, string>Tagsoptional*map[string]*string #Default: {} - no tags
timeoutoptionalDurationtimeoutoptionalDurationtimeoutoptionalDurationTimeoutoptionalDurationTimeoutoptionalDuration #Default: no value set; Glue applies its service default (2880 minutes for non-streaming jobs)
Specified in minutes.
workerConfigurationoptionalWorkerConfigurationworker_configurationoptionalWorkerConfigurationworkerConfigurationoptionalWorkerConfigurationWorkerConfigurationoptionalWorkerConfigurationWorkerConfigurationoptionalWorkerConfiguration #Default: the job runs with the G_1X worker type and 10 workers.