Skip to content

session_manager_interface

interfaces.session_manager_interface

Interface for the session manager endpoint.

Functions

get_configs()

Get the available configurations for the controller.

Returns:

Type Description
list[dict[str, str]]

List of dictionaries indicating the file where the config is contained and the

list[dict[str, str]]

id for the config.

Source code in interfaces/session_manager_interface.py
def get_configs() -> list[dict[str, str]]:
    """Get the available configurations for the controller.

    Returns:
        List of dictionaries indicating the file where the config is contained and the
        id for the config.
    """
    configs = get_session_manager_driver().list_all_configs().data
    return [{"file": c.file, "session_id": c.session_id} for c in configs.config_keys]

get_session_manager_driver()

Get a ProcessManagerDriver instance.

Source code in interfaces/session_manager_interface.py
def get_session_manager_driver() -> SessionManagerDriver:
    """Get a ProcessManagerDriver instance."""
    token = create_dummy_token_from_uname()
    return SessionManagerDriver(
        settings.SESSION_MANAGER_URL, token=token, aio_channel=False
    )

get_sessions()

Get the active sessions in the controller.

Returns:

Type Description
list[dict[str, str]]

List of dictionaries indicating the session name and the actor name (i.e.

list[dict[str, str]]

typically, the user who boots the session).

Source code in interfaces/session_manager_interface.py
def get_sessions() -> list[dict[str, str]]:
    """Get the active sessions in the controller.

    Returns:
        List of dictionaries indicating the session name and the actor name (i.e.
        typically, the user who boots the session).
    """
    sessions = get_session_manager_driver().list_all_sessions().data
    return [{"name": s.name, "actor": s.user} for s in sessions.active_sessions]