mirror of
https://github.com/norohind/jubilant-system-core.git
synced 2025-04-14 02:27:13 +03:00
Add dump running threads by SIGUSR1
This commit is contained in:
parent
04cccabfa2
commit
a552fc0361
6
main.py
6
main.py
@ -57,6 +57,11 @@ def shutdown_callback(sig: int, frame) -> None:
|
||||
exit(0)
|
||||
|
||||
|
||||
def threads_dump(sig: int, frame) -> None:
|
||||
running_threads = ', '.join((thread.name for thread in threading.enumerate()))
|
||||
logger.info(f'Running threads: {running_threads}')
|
||||
|
||||
|
||||
def discover(back_count: int = 0):
|
||||
"""Discover new squads
|
||||
:param back_count: int how many squads back we should check, it is helpful to recheck newly created squads
|
||||
@ -153,6 +158,7 @@ def main():
|
||||
global can_be_shutdown
|
||||
signal.signal(signal.SIGTERM, shutdown_callback)
|
||||
signal.signal(signal.SIGINT, shutdown_callback)
|
||||
signal.signal(signal.SIGUSR1, threads_dump)
|
||||
|
||||
def help_cli() -> str:
|
||||
return """Possible arguments:
|
||||
|
Loading…
x
Reference in New Issue
Block a user