Skip to content

terminate_session

terminate_session(
    session_id: SessionId, *, config_overrides: Optional[AthenaClientConfig] = None
) -> TerminateSessionResponse

Terminates an active session. A TerminateSession call on a session that is already inactive (for example, in a FAILED, TERMINATED or TERMINATING state) succeeds but has no effect. Calculations running in the session when TerminateSession is called are forcefully stopped, but may display as FAILED instead of STOPPED.

Parameters:

Raises:

Source code in docs_src/capo_athena/_services/athena.py
def terminate_session(
    self,
    session_id: "capo_athena.types.session_id.SessionId",
    *,
    config_overrides: Optional[AthenaClientConfig] = None,
) -> "capo_athena.types.terminate_session_response.TerminateSessionResponse":
    """<p>Terminates an active session. A <code>TerminateSession</code> call on a session that is already inactive (for example, in a <code>FAILED</code>, <code>TERMINATED</code> or <code>TERMINATING</code> state) succeeds but has no effect. Calculations running in the session when <code>TerminateSession</code> is called are forcefully stopped, but may display as <code>FAILED</code> instead of <code>STOPPED</code>.</p>

    Args:
        session_id: <p>The session ID.</p>

    Raises:
        capo_athena.errors.internal_server_exception.InternalServerException: <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
        capo_athena.errors.invalid_request_exception.InvalidRequestException: <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
        capo_athena.errors.resource_not_found_exception.ResourceNotFoundException: <p>A resource, such as a workgroup, was not found.</p>
        capo_athena.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_athena.types.terminate_session_request.TerminateSessionRequest]",
    ) -> OperationResponse[
        "capo_athena.types.terminate_session_response.TerminateSessionResponse"
    ]:
        import capo_athena._operations.amazon_athena.terminate_session

        output, http_response = (
            capo_athena._operations.amazon_athena.terminate_session.terminate_session(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TerminateSession")
    )
    input_: capo_athena.types.terminate_session_request.TerminateSessionRequest = {
        "session_id": session_id
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output