createSession method
- required SessionCommand command,
- required String id,
- required String role,
- ConnectionsList? connections,
- Map<
String, String> ? defaultArguments, - String? description,
- String? glueVersion,
- int? idleTimeout,
- double? maxCapacity,
- int? numberOfWorkers,
- String? requestOrigin,
- String? securityConfiguration,
- SessionType? sessionType,
- Map<
String, String> ? tags, - int? timeout,
- WorkerType? workerType,
Creates a new session.
May throw AccessDeniedException.
May throw AlreadyExistsException.
May throw IdempotentParameterMismatchException.
May throw InternalServiceException.
May throw InvalidInputException.
May throw OperationNotSupportedException.
May throw OperationTimeoutException.
May throw ResourceNumberLimitExceededException.
May throw ValidationException.
Parameter command :
The SessionCommand that runs the job.
Parameter id :
The ID of the session request.
Parameter role :
The IAM Role ARN
Parameter connections :
The number of connections to use for the session.
Parameter defaultArguments :
A map array of key-value pairs. Max is 75 pairs.
Parameter description :
The description of the session.
Parameter glueVersion :
The Glue version determines the versions of Apache Spark and Python that
Glue supports. The GlueVersion must be greater than 2.0.
Parameter idleTimeout :
The number of minutes when idle before session times out. Default for
Spark ETL jobs is value of Timeout. Consult the documentation for other
job types.
Parameter maxCapacity :
The number of Glue data processing units (DPUs) that can be allocated when
the job runs. A DPU is a relative measure of processing power that
consists of 4 vCPUs of compute capacity and 16 GB memory.
Parameter numberOfWorkers :
The number of workers of a defined WorkerType to use for the
session.
Parameter requestOrigin :
The origin of the request.
Parameter securityConfiguration :
The name of the SecurityConfiguration structure to be used with the
session
Parameter sessionType :
The type of session to create.
Parameter tags :
The map of key value pairs (tags) belonging to the session.
Parameter timeout :
The number of minutes before session times out. Default for Spark ETL jobs
is 48 hours (2880 minutes). Consult the documentation for other job types.
Parameter workerType :
The type of predefined worker that is allocated when a job runs. Accepts a
value of G.1X, G.2X, G.4X, or G.8X for Spark jobs. Accepts the value Z.2X
for Ray notebooks.
-
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 (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), Canada (Central), Europe (Frankfurt), Europe (Ireland), and Europe (Stockholm). -
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
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<CreateSessionResponse> createSession({
required SessionCommand command,
required String id,
required String role,
ConnectionsList? connections,
Map<String, String>? defaultArguments,
String? description,
String? glueVersion,
int? idleTimeout,
double? maxCapacity,
int? numberOfWorkers,
String? requestOrigin,
String? securityConfiguration,
SessionType? sessionType,
Map<String, String>? tags,
int? timeout,
WorkerType? workerType,
}) async {
_s.validateNumRange(
'idleTimeout',
idleTimeout,
1,
1152921504606846976,
);
_s.validateNumRange(
'timeout',
timeout,
1,
1152921504606846976,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSGlue.CreateSession'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Command': command,
'Id': id,
'Role': role,
if (connections != null) 'Connections': connections,
if (defaultArguments != null) 'DefaultArguments': defaultArguments,
if (description != null) 'Description': description,
if (glueVersion != null) 'GlueVersion': glueVersion,
if (idleTimeout != null) 'IdleTimeout': idleTimeout,
if (maxCapacity != null)
'MaxCapacity': _s.encodeJsonDouble(maxCapacity),
if (numberOfWorkers != null) 'NumberOfWorkers': numberOfWorkers,
if (requestOrigin != null) 'RequestOrigin': requestOrigin,
if (securityConfiguration != null)
'SecurityConfiguration': securityConfiguration,
if (sessionType != null) 'SessionType': sessionType.value,
if (tags != null) 'Tags': tags,
if (timeout != null) 'Timeout': timeout,
if (workerType != null) 'WorkerType': workerType.value,
},
);
return CreateSessionResponse.fromJson(jsonResponse.body);
}