:doc:`Athena <../../athena>` / Client / terminate_session

*****************
terminate_session
*****************



.. py:method:: Athena.Client.terminate_session(**kwargs)

  

  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``.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/TerminateSession>`_  


  **Request Syntax**
  ::

    response = client.terminate_session(
        SessionId='string'
    )
    
  :type SessionId: string
  :param SessionId: **[REQUIRED]** 

    The session ID.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'State': 'CREATING'|'CREATED'|'IDLE'|'BUSY'|'TERMINATING'|'TERMINATED'|'DEGRADED'|'FAILED'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **State** *(string) --* 

        The state of the session. A description of each state follows.

         

        ``CREATING`` - The session is being started, including acquiring resources.

         

        ``CREATED`` - The session has been started.

         

        ``IDLE`` - The session is able to accept a calculation.

         

        ``BUSY`` - The session is processing another task and is unable to accept a calculation.

         

        ``TERMINATING`` - The session is in the process of shutting down.

         

        ``TERMINATED`` - The session and its resources are no longer running.

         

        ``DEGRADED`` - The session has no healthy coordinators.

         

        ``FAILED`` - Due to a failure, the session and its resources are no longer running.

        
  
  **Exceptions**
  
  *   :py:class:`Athena.Client.exceptions.InternalServerException`

  
  *   :py:class:`Athena.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`Athena.Client.exceptions.ResourceNotFoundException`

  