createJob method
- required JobCommand command,
- required String name,
- required String role,
- int? allocatedCapacity,
- Map<
String, CodeGenConfigurationNode> ? codeGenConfigurationNodes, - ConnectionsList? connections,
- Map<
String, String> ? defaultArguments, - String? description,
- ExecutionClass? executionClass,
- ExecutionProperty? executionProperty,
- String? glueVersion,
- JobMode? jobMode,
- bool? jobRunQueuingEnabled,
- String? logUri,
- String? maintenanceWindow,
- double? maxCapacity,
- int? maxRetries,
- Map<
String, String> ? nonOverridableArguments, - NotificationProperty? notificationProperty,
- int? numberOfWorkers,
- String? securityConfiguration,
- SourceControlDetails? sourceControlDetails,
- Map<
String, String> ? tags, - int? timeout,
- WorkerType? workerType,
Creates a new job definition.
May throw AlreadyExistsException.
May throw ConcurrentModificationException.
May throw IdempotentParameterMismatchException.
May throw InternalServiceException.
May throw InvalidInputException.
May throw OperationTimeoutException.
May throw ResourceNumberLimitExceededException.
Parameter command :
The JobCommand that runs this job.
Parameter name :
The name you assign to this job definition. It must be unique in your
account.
Parameter role :
The name or Amazon Resource Name (ARN) of the IAM role associated with
this job.
Parameter allocatedCapacity :
This parameter is deprecated. Use MaxCapacity instead.
The number of Glue data processing units (DPUs) to allocate to this Job. You can allocate a minimum of 2 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.
Parameter codeGenConfigurationNodes :
The representation of a directed acyclic graph on which both the Glue
Studio visual component and Glue Studio code generation is based.
Parameter connections :
The connections used for this job.
Parameter defaultArguments :
The default arguments for every run of this job, specified as name-value
pairs.
You can specify arguments here that your own job-execution script consumes, as well as arguments that Glue itself consumes.
Job arguments may be logged. Do not pass plaintext secrets as arguments. Retrieve secrets from a Glue Connection, Secrets Manager or other secret management mechanism if you intend to keep them within the Job.
For information about how to specify and consume your own Job arguments, see the Calling Glue APIs in Python topic in the developer guide.
For information about the arguments you can provide to this field when configuring Spark jobs, see the Special Parameters Used by Glue topic in the developer guide.
For information about the arguments you can provide to this field when configuring Ray jobs, see Using job parameters in Ray jobs in the developer guide.
Parameter description :
Description of the job being defined.
Parameter executionClass :
Indicates whether the job is run with a standard or flexible execution
class. The standard execution-class is ideal for time-sensitive workloads
that require fast job startup and dedicated resources.
The flexible execution class is appropriate for time-insensitive jobs whose start and completion times may vary.
Only jobs with Glue version 3.0 and above and command type
glueetl will be allowed to set ExecutionClass to
FLEX. The flexible execution class is available for Spark
jobs.
Parameter executionProperty :
An ExecutionProperty specifying the maximum number of
concurrent runs allowed for this job.
Parameter glueVersion :
In Spark jobs, GlueVersion determines the versions of Apache
Spark and Python that Glue available in a job. The Python version
indicates the version supported for jobs of type Spark.
Ray jobs should set GlueVersion to 4.0 or
greater. However, the versions of Ray, Python and additional libraries
available in your Ray job are determined by the Runtime
parameter of the Job command.
For more information about the available Glue versions and corresponding Spark and Python versions, see Glue version in the developer guide.
Jobs that are created without specifying a Glue version default to Glue 5.1.
Parameter jobMode :
A mode that describes how a job was created. Valid values are:
-
SCRIPT- The job was created using the Glue Studio script editor. -
VISUAL- The job was created using the Glue Studio visual editor. -
NOTEBOOK- The job was created using an interactive sessions notebook.
JobMode field is missing or null,
SCRIPT is assigned as the default value.
Parameter jobRunQueuingEnabled :
Specifies whether job run queuing is enabled for the job runs for this
job.
A value of true means job run queuing is enabled for the job runs. If false or not populated, the job runs will not be considered for queueing.
If this field does not match the value set in the job run, then the value from the job run field will be used.
Parameter logUri :
This field is reserved for future use.
Parameter maintenanceWindow :
This field specifies a day of the week and hour for a maintenance window
for streaming jobs. Glue periodically performs maintenance activities.
During these maintenance windows, Glue will need to restart your streaming
jobs.
Glue will restart the job within 3 hours of the specified maintenance window. For instance, if you set up the maintenance window for Monday at 10:00AM GMT, your jobs will be restarted between 10:00AM GMT to 1:00PM GMT.
Parameter maxCapacity :
For Glue version 1.0 or earlier jobs, using the standard worker type, the
number of Glue data processing units (DPUs) that can be allocated when
this job runs. 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.
For Glue version 2.0+ jobs, you cannot specify a Maximum
capacity. Instead, you should specify a Worker type
and the Number of workers.
Do not set MaxCapacity if using WorkerType and
NumberOfWorkers.
The value that can be allocated for MaxCapacity depends on
whether you are running a Python shell job, an Apache Spark ETL job, or an
Apache Spark streaming ETL job:
-
When you specify a Python shell job
(
JobCommand.Name="pythonshell"), you can allocate either 0.0625 or 1 DPU. The default is 0.0625 DPU. -
When you specify an Apache Spark ETL job
(
JobCommand.Name="glueetl") or Apache Spark streaming ETL job (JobCommand.Name="gluestreaming"), you can allocate from 2 to 100 DPUs. The default is 10 DPUs. This job type cannot have a fractional DPU allocation.
Parameter maxRetries :
The maximum number of times to retry this job if it fails.
Parameter nonOverridableArguments :
Arguments for this job that are not overridden when providing job
arguments in a job run, specified as name-value pairs.
Parameter notificationProperty :
Specifies configuration properties of a job notification.
Parameter numberOfWorkers :
The number of workers of a defined workerType that are
allocated when a job runs.
Parameter securityConfiguration :
The name of the SecurityConfiguration structure to be used
with this job.
Parameter sourceControlDetails :
The details for a source control configuration for a job, allowing
synchronization of job artifacts to or from a remote repository.
Parameter tags :
The tags to use with this job. You may use tags to limit access to the
job. For more information about tags in Glue, see Amazon
Web Services Tags in Glue in the developer guide.
Parameter timeout :
The job timeout in minutes. This is the maximum time that a job run can
consume resources before it is terminated and enters TIMEOUT
status.
Jobs must have timeout values less than 7 days or 10080 minutes. Otherwise, the jobs will throw an exception.
When the value is left blank, the timeout is defaulted to 2,880 minutes for Glue version 4.0 and earlier, or 480 minutes for Glue version 5.0 and later.
Any existing Glue jobs that had a timeout value greater than 7 days will be defaulted to 7 days. For instance if you have specified a timeout of 20 days for a batch job, it will be stopped on the 7th day.
For streaming jobs, if you have set up a maintenance window, it will be restarted during the maintenance window after 7 days.
Parameter workerType :
The type of predefined worker that is allocated when a job runs. Accepts a
value of G.1X, G.2X, G.4X, G.8X or G.025X for Spark jobs. Accepts the
value Z.2X for Ray jobs.
-
For the
G.1Xworker type, each worker maps to 1 DPU (4 vCPUs, 16 GB of memory) with 94GB disk, and provides 1 executor per worker. We recommend this worker type for workloads such as data transforms, joins, and queries, to offers a scalable and cost effective way to run most jobs. -
For the
G.2Xworker type, each worker maps to 2 DPU (8 vCPUs, 32 GB of memory) with 138GB disk, and provides 1 executor per worker. We recommend this worker type for workloads such as data transforms, joins, and queries, to offers a scalable and cost effective way to run most jobs. -
For the
G.4Xworker type, each worker maps to 4 DPU (16 vCPUs, 64 GB of memory) with 256GB disk, and provides 1 executor per worker. We recommend this worker type for jobs whose workloads contain your most demanding transforms, aggregations, joins, and queries. This worker type is available only for Glue version 3.0 or later Spark ETL jobs in the following Amazon Web Services Regions: US East (Ohio), US East (N. Virginia), US West (N. California), US West (Oregon), Asia Pacific (Mumbai), Asia Pacific (Seoul), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), Canada (Central), Europe (Frankfurt), Europe (Ireland), Europe (London), Europe (Spain), Europe (Stockholm), and South America (São Paulo). -
For the
G.8Xworker type, each worker maps to 8 DPU (32 vCPUs, 128 GB of memory) with 512GB disk, and provides 1 executor per worker. We recommend this worker type for jobs whose workloads contain your most demanding transforms, aggregations, joins, and queries. This worker type is available only for Glue version 3.0 or later Spark ETL jobs, in the same Amazon Web Services Regions as supported for theG.4Xworker type. -
For the
G.025Xworker type, each worker maps to 0.25 DPU (2 vCPUs, 4 GB of memory) with 84GB disk, and provides 1 executor per worker. We recommend this worker type for low volume streaming jobs. This worker type is only available for Glue version 3.0 or later streaming jobs. -
For the
Z.2Xworker type, each worker maps to 2 M-DPU (8vCPUs, 64 GB of memory) with 128 GB disk, and provides up to 8 Ray workers based on the autoscaler.
Implementation
Future<CreateJobResponse> createJob({
required JobCommand command,
required String name,
required String role,
int? allocatedCapacity,
Map<String, CodeGenConfigurationNode>? codeGenConfigurationNodes,
ConnectionsList? connections,
Map<String, String>? defaultArguments,
String? description,
ExecutionClass? executionClass,
ExecutionProperty? executionProperty,
String? glueVersion,
JobMode? jobMode,
bool? jobRunQueuingEnabled,
String? logUri,
String? maintenanceWindow,
double? maxCapacity,
int? maxRetries,
Map<String, String>? nonOverridableArguments,
NotificationProperty? notificationProperty,
int? numberOfWorkers,
String? securityConfiguration,
SourceControlDetails? sourceControlDetails,
Map<String, String>? tags,
int? timeout,
WorkerType? workerType,
}) async {
_s.validateNumRange(
'timeout',
timeout,
1,
1152921504606846976,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSGlue.CreateJob'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Command': command,
'Name': name,
'Role': role,
if (allocatedCapacity != null) 'AllocatedCapacity': allocatedCapacity,
if (codeGenConfigurationNodes != null)
'CodeGenConfigurationNodes': codeGenConfigurationNodes,
if (connections != null) 'Connections': connections,
if (defaultArguments != null) 'DefaultArguments': defaultArguments,
if (description != null) 'Description': description,
if (executionClass != null) 'ExecutionClass': executionClass.value,
if (executionProperty != null) 'ExecutionProperty': executionProperty,
if (glueVersion != null) 'GlueVersion': glueVersion,
if (jobMode != null) 'JobMode': jobMode.value,
if (jobRunQueuingEnabled != null)
'JobRunQueuingEnabled': jobRunQueuingEnabled,
if (logUri != null) 'LogUri': logUri,
if (maintenanceWindow != null) 'MaintenanceWindow': maintenanceWindow,
if (maxCapacity != null) 'MaxCapacity': maxCapacity,
if (maxRetries != null) 'MaxRetries': maxRetries,
if (nonOverridableArguments != null)
'NonOverridableArguments': nonOverridableArguments,
if (notificationProperty != null)
'NotificationProperty': notificationProperty,
if (numberOfWorkers != null) 'NumberOfWorkers': numberOfWorkers,
if (securityConfiguration != null)
'SecurityConfiguration': securityConfiguration,
if (sourceControlDetails != null)
'SourceControlDetails': sourceControlDetails,
if (tags != null) 'Tags': tags,
if (timeout != null) 'Timeout': timeout,
if (workerType != null) 'WorkerType': workerType.value,
},
);
return CreateJobResponse.fromJson(jsonResponse.body);
}