How to find out which users are logged onto the Dataiku DSS instance

As a Dataiku DSS admin, you might need to restart DSS and want to know which users are logged onto the instance.

You can use the list_users() method in the Dataiku Python API. The list_users method returns a value for activeWebSocketSesssions which indicates the number of DSS sessions a user is logged on. Anything other than 0 indicates that a user is connected to the DSS instance.

Here is a code snippet you can use:

import dataiku
client = dataiku.api_client()
dss_users = client.list_users()

user_list = []
# Grab list of users where they have active web socket sessions
for user in dss_users:
    if user['activeWebSocketSesssions'] != 0: