Skip to content

start_session async

start_session(
    application_id: ApplicationId,
    client_token: ClientToken,
    execution_role_arn: IAMRoleArn,
    *,
    config_overrides: Optional[AsyncEMRServerlessClientConfig] = None,
    configuration_overrides: Optional[SessionConfigurationOverrides] = None,
    tags: Optional[TagMap] = None,
    idle_timeout_minutes: Optional[Duration] = None,
    name: Optional[String256] = None,
) -> StartSessionResponse

Creates and starts a new session on the specified application. The application must be in the STARTED state or have AutoStart enabled, and have interactive sessions enabled. This operation is supported for EMR release 7.13.0 and later.

Parameters:

  • application_id (ApplicationId) –

    The ID of the application on which to start the session.

  • client_token (ClientToken) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request that completed successfully using the same client token, the server returns the successful response without performing the operation again.

  • execution_role_arn (IAMRoleArn) –

    The execution role ARN for the session. Amazon EMR Serverless uses this role to access Amazon Web Services resources on your behalf during session execution.

  • configuration_overrides (Optional[SessionConfigurationOverrides], default: None ) –

    The configuration overrides for the session. Only runtime configuration overrides are supported.

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

    The tags to assign to the session.

  • idle_timeout_minutes (Optional[Duration], default: None ) –

    The idle timeout in minutes for the session. After the session remains idle for this duration, Amazon EMR Serverless automatically terminates it.

  • name (Optional[String256], default: None ) –

    The optional name for the session.

Raises:

Source code in docs_src/capo_emr_serverless/_services/async_emr_serverless.py
async def start_session(
    self,
    application_id: "capo_emr_serverless.types.application_id.ApplicationId",
    client_token: "capo_emr_serverless.types.client_token.ClientToken",
    execution_role_arn: "capo_emr_serverless.types.iam_role_arn.IAMRoleArn",
    *,
    config_overrides: Optional[AsyncEMRServerlessClientConfig] = None,
    configuration_overrides: Optional[
        "capo_emr_serverless.types.session_configuration_overrides.SessionConfigurationOverrides"
    ] = None,
    tags: Optional["capo_emr_serverless.types.tag_map.TagMap"] = None,
    idle_timeout_minutes: Optional[
        "capo_emr_serverless.types.duration.Duration"
    ] = None,
    name: Optional["capo_emr_serverless.types.string256.String256"] = None,
) -> "capo_emr_serverless.types.start_session_response.StartSessionResponse":
    """<p>Creates and starts a new session on the specified application. The application must be in the <code>STARTED</code> state or have <code>AutoStart</code> enabled, and have interactive sessions enabled. This operation is supported for EMR release 7.13.0 and later.</p>

    Args:
        application_id: <p>The ID of the application on which to start the session.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request that completed successfully using the same client token, the server returns the successful response without performing the operation again.</p>
        execution_role_arn: <p>The execution role ARN for the session. Amazon EMR Serverless uses this role to access Amazon Web Services resources on your behalf during session execution.</p>
        configuration_overrides: <p>The configuration overrides for the session. Only runtime configuration overrides are supported.</p>
        tags: <p>The tags to assign to the session.</p>
        idle_timeout_minutes: <p>The idle timeout in minutes for the session. After the session remains idle for this duration, Amazon EMR Serverless automatically terminates it.</p>
        name: <p>The optional name for the session.</p>

    Raises:
        capo_emr_serverless.errors.conflict_exception.ConflictException: <p>The request could not be processed because of conflict in the current state of the resource.</p>
        capo_emr_serverless.errors.internal_server_exception.InternalServerException: <p>Request processing failed because of an error or failure with the service.</p>
        capo_emr_serverless.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_emr_serverless.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The maximum number of resources per account has been reached.</p>
        capo_emr_serverless.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_emr_serverless.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_emr_serverless.types.start_session_request.StartSessionRequest]",
    ) -> AsyncOperationResponse[
        "capo_emr_serverless.types.start_session_response.StartSessionResponse"
    ]:
        import capo_emr_serverless._operations.aws_toledo_web_service.start_session

        (
            output,
            http_response,
        ) = await capo_emr_serverless._operations.aws_toledo_web_service.start_session.async_start_session(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_emr_serverless.types.start_session_request.StartSessionRequest",
    ) -> dict[str, Any]:
        import capo_emr_serverless.types.start_session_request

        return capo_emr_serverless.types.start_session_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("StartSession", redact_input=_redact_input),
    )
    input_: capo_emr_serverless.types.start_session_request.StartSessionRequest = {
        "application_id": application_id,
        "client_token": client_token,
        "execution_role_arn": execution_role_arn,
    }
    if configuration_overrides is not None:
        input_["configuration_overrides"] = configuration_overrides
    if tags is not None:
        input_["tags"] = tags
    if idle_timeout_minutes is not None:
        input_["idle_timeout_minutes"] = idle_timeout_minutes
    if name is not None:
        input_["name"] = name

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