mirror of
https://github.com/norohind/jubilant-system-core.git
synced 2025-06-05 09:53:11 +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)
|
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):
|
def discover(back_count: int = 0):
|
||||||
"""Discover new squads
|
"""Discover new squads
|
||||||
:param back_count: int how many squads back we should check, it is helpful to recheck newly created 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
|
global can_be_shutdown
|
||||||
signal.signal(signal.SIGTERM, shutdown_callback)
|
signal.signal(signal.SIGTERM, shutdown_callback)
|
||||||
signal.signal(signal.SIGINT, shutdown_callback)
|
signal.signal(signal.SIGINT, shutdown_callback)
|
||||||
|
signal.signal(signal.SIGUSR1, threads_dump)
|
||||||
|
|
||||||
def help_cli() -> str:
|
def help_cli() -> str:
|
||||||
return """Possible arguments:
|
return """Possible arguments:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user