Skip to content

MonitoringService

MonitoringService(rest)

Bases: ObjectService

Service to Query and Cancel Threads in TM1

Source code in TM1py/Services/MonitoringService.py
def __init__(self, rest: RestService):
    super().__init__(rest)
    warn("Monitoring Service will be moved to a new location in a future version", DeprecationWarning, 2)
    self.users = UserService(rest)
    self.threads = ThreadService(rest)
    self.session = SessionService(rest)

session = SessionService(rest) instance-attribute

threads = ThreadService(rest) instance-attribute

users = UserService(rest) instance-attribute

cancel_all_running_threads(**kwargs)

Source code in TM1py/Services/MonitoringService.py
def cancel_all_running_threads(self, **kwargs) -> list:
    return self.threads.cancel_all_running(**kwargs)

cancel_thread(thread_id, **kwargs)

Kill a running thread

Parameters:

Name Type Description Default
thread_id int
required

Returns:

Type Description
Response
Source code in TM1py/Services/MonitoringService.py
def cancel_thread(self, thread_id: int, **kwargs) -> Response:
    """Kill a running thread

    :param thread_id:
    :return:
    """
    return self.threads.cancel(thread_id, **kwargs)

close_all_sessions(**kwargs)

Source code in TM1py/Services/MonitoringService.py
@require_admin
def close_all_sessions(self, **kwargs) -> list:
    return self.session.close_all(**kwargs)

close_session(session_id, **kwargs)

Source code in TM1py/Services/MonitoringService.py
def close_session(self, session_id, **kwargs) -> Response:
    return self.session.close(session_id, **kwargs)

disconnect_all_users(**kwargs)

Source code in TM1py/Services/MonitoringService.py
@require_admin
def disconnect_all_users(self, **kwargs) -> list:
    return self.users.disconnect_all(**kwargs)

disconnect_user(user_name, **kwargs)

Disconnect User

Parameters:

Name Type Description Default
user_name str
required

Returns:

Type Description
Response
Source code in TM1py/Services/MonitoringService.py
def disconnect_user(self, user_name: str, **kwargs) -> Response:
    """Disconnect User

    :param user_name:
    :return:
    """
    return self.users.disconnect(user_name, **kwargs)

get_active_session_threads(exclude_idle=True, **kwargs)

Source code in TM1py/Services/MonitoringService.py
def get_active_session_threads(self, exclude_idle: bool = True, **kwargs):
    return self.session.get_threads_for_current(exclude_idle, **kwargs)

get_active_threads(**kwargs)

Return a list of non-idle threads from the TM1 Server

Returns:

Type Description

list: TM1 threads as dict

Source code in TM1py/Services/MonitoringService.py
def get_active_threads(self, **kwargs):
    """Return a list of non-idle threads from the TM1 Server

    :return:
        list: TM1 threads as dict
    """
    return self.threads.get_active(**kwargs)

get_active_users(**kwargs)

Get the activate users in TM1

Returns:

Type Description
List[User]

List of TM1py.User instances

Source code in TM1py/Services/MonitoringService.py
def get_active_users(self, **kwargs) -> List[User]:
    """Get the activate users in TM1

    :return: List of TM1py.User instances
    """
    return self.users.get_active(**kwargs)

get_current_user(**kwargs)

Source code in TM1py/Services/MonitoringService.py
def get_current_user(self, **kwargs):
    return self.users.get_current(**kwargs)

get_sessions(include_user=True, include_threads=True, **kwargs)

Source code in TM1py/Services/MonitoringService.py
def get_sessions(self, include_user: bool = True, include_threads: bool = True, **kwargs) -> List:
    return self.session.get_all(include_user, include_threads, **kwargs)

get_threads(**kwargs)

Return a dict of the currently running threads from the TM1 Server

Returns:

Type Description
List

dict: the response

Source code in TM1py/Services/MonitoringService.py
def get_threads(self, **kwargs) -> List:
    """Return a dict of the currently running threads from the TM1 Server

    :return:
        dict: the response
    """
    return self.threads.get_all(**kwargs)

user_is_active(user_name, **kwargs)

Check if user is currently active in TM1

Parameters:

Name Type Description Default
user_name str
required

Returns:

Type Description
bool

Boolean

Source code in TM1py/Services/MonitoringService.py
def user_is_active(self, user_name: str, **kwargs) -> bool:
    """Check if user is currently active in TM1

    :param user_name:
    :return: Boolean
    """
    return self.users.is_active(user_name, **kwargs)