Skip to content

create_session async

create_session(
    id: NameString,
    role: OrchestrationRoleArn,
    command: SessionCommand,
    *,
    config_overrides: Optional[AsyncGlueClientConfig] = None,
    description: Optional[DescriptionString] = None,
    timeout: Optional[Timeout] = None,
    idle_timeout: Optional[Timeout] = None,
    default_arguments: Optional[OrchestrationArgumentsMap] = None,
    connections: Optional[ConnectionsList] = None,
    max_capacity: Optional[NullableDouble] = None,
    number_of_workers: Optional[NullableInteger] = None,
    worker_type: Optional[WorkerType] = None,
    security_configuration: Optional[NameString] = None,
    glue_version: Optional[GlueVersionString] = None,
    tags: Optional[TagsMap] = None,
    request_origin: Optional[OrchestrationNameString] = None,
    session_type: Optional[SessionType] = None,
) -> CreateSessionResponse

Creates a new session.

Parameters:

  • id (NameString) –

    The ID of the session request.

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

    The description of the session.

  • role (OrchestrationRoleArn) –

    The IAM Role ARN

  • command (SessionCommand) –

    The SessionCommand that runs the job.

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

    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.

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

    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.

  • default_arguments (Optional[OrchestrationArgumentsMap], default: None ) –

    A map array of key-value pairs. Max is 75 pairs.

  • connections (Optional[ConnectionsList], default: None ) –

    The number of connections to use for the session.

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

    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.

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

    The number of workers of a defined WorkerType to use for the session.

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

    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.1X worker 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.2X worker 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.4X worker 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.8X worker 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 the G.4X worker type.

    • For the Z.2X worker 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.

  • security_configuration (Optional[NameString], default: None ) –

    The name of the SecurityConfiguration structure to be used with the session

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

    The Glue version determines the versions of Apache Spark and Python that Glue supports. The GlueVersion must be greater than 2.0.

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

    The map of key value pairs (tags) belonging to the session.

  • request_origin (Optional[OrchestrationNameString], default: None ) –

    The origin of the request.

  • session_type (Optional[SessionType], default: None ) –

    The type of session to create.

Raises:

Source code in docs_src/capo_glue/_services/async_glue.py
async def create_session(
    self,
    id: "capo_glue.types.name_string.NameString",
    role: "capo_glue.types.orchestration_role_arn.OrchestrationRoleArn",
    command: "capo_glue.types.session_command.SessionCommand",
    *,
    config_overrides: Optional[AsyncGlueClientConfig] = None,
    description: Optional[
        "capo_glue.types.description_string.DescriptionString"
    ] = None,
    timeout: Optional["capo_glue.types.timeout.Timeout"] = None,
    idle_timeout: Optional["capo_glue.types.timeout.Timeout"] = None,
    default_arguments: Optional[
        "capo_glue.types.orchestration_arguments_map.OrchestrationArgumentsMap"
    ] = None,
    connections: Optional[
        "capo_glue.types.connections_list.ConnectionsList"
    ] = None,
    max_capacity: Optional["capo_glue.types.nullable_double.NullableDouble"] = None,
    number_of_workers: Optional[
        "capo_glue.types.nullable_integer.NullableInteger"
    ] = None,
    worker_type: Optional["capo_glue.types.worker_type.WorkerType"] = None,
    security_configuration: Optional[
        "capo_glue.types.name_string.NameString"
    ] = None,
    glue_version: Optional[
        "capo_glue.types.glue_version_string.GlueVersionString"
    ] = None,
    tags: Optional["capo_glue.types.tags_map.TagsMap"] = None,
    request_origin: Optional[
        "capo_glue.types.orchestration_name_string.OrchestrationNameString"
    ] = None,
    session_type: Optional["capo_glue.types.session_type.SessionType"] = None,
) -> "capo_glue.types.create_session_response.CreateSessionResponse":
    """<p>Creates a new session.</p>

    Args:
        id: <p>The ID of the session request. </p>
        description: <p>The description of the session. </p>
        role: <p>The IAM Role ARN </p>
        command: <p>The <code>SessionCommand</code> that runs the job. </p>
        timeout: <p> 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. </p>
        idle_timeout: <p> 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. </p>
        default_arguments: <p>A map array of key-value pairs. Max is 75 pairs. </p>
        connections: <p>The number of connections to use for the session. </p>
        max_capacity: <p>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. </p>
        number_of_workers: <p>The number of workers of a defined <code>WorkerType</code> to use for the session. </p>
        worker_type: <p>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.</p> <ul> <li> <p>For the <code>G.1X</code> worker 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.</p> </li> <li> <p>For the <code>G.2X</code> worker 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.</p> </li> <li> <p>For the <code>G.4X</code> worker 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).</p> </li> <li> <p>For the <code>G.8X</code> worker 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 the <code>G.4X</code> worker type.</p> </li> <li> <p>For the <code>Z.2X</code> worker 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.</p> </li> </ul>
        security_configuration: <p>The name of the SecurityConfiguration structure to be used with the session </p>
        glue_version: <p>The Glue version determines the versions of Apache Spark and Python that Glue supports. The GlueVersion must be greater than 2.0. </p>
        tags: <p>The map of key value pairs (tags) belonging to the session.</p>
        request_origin: <p>The origin of the request. </p>
        session_type: <p>The type of session to create.</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_not_supported_exception.OperationNotSupportedException: <p>The operation is not available in the region.</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.validation_exception.ValidationException: <p>A value could not be validated.</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_session_request.CreateSessionRequest]",
    ) -> AsyncOperationResponse[
        "capo_glue.types.create_session_response.CreateSessionResponse"
    ]:
        import capo_glue._operations.aws_glue.create_session

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateSession")
    )
    input_: capo_glue.types.create_session_request.CreateSessionRequest = {
        "id": id,
        "role": role,
        "command": command,
    }
    if description is not None:
        input_["description"] = description
    if timeout is not None:
        input_["timeout"] = timeout
    if idle_timeout is not None:
        input_["idle_timeout"] = idle_timeout
    if default_arguments is not None:
        input_["default_arguments"] = default_arguments
    if connections is not None:
        input_["connections"] = connections
    if max_capacity is not None:
        input_["max_capacity"] = max_capacity
    if number_of_workers is not None:
        input_["number_of_workers"] = number_of_workers
    if worker_type is not None:
        input_["worker_type"] = worker_type
    if security_configuration is not None:
        input_["security_configuration"] = security_configuration
    if glue_version is not None:
        input_["glue_version"] = glue_version
    if tags is not None:
        input_["tags"] = tags
    if request_origin is not None:
        input_["request_origin"] = request_origin
    if session_type is not None:
        input_["session_type"] = session_type

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