Skip to content
Snippets Groups Projects
Commit 730cba12 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[scripts] Ignore further signals in case of a forced stop

parent 620d6a1e
No related branches found
No related tags found
1 merge request!194Scheduler
......@@ -116,19 +116,17 @@ def main(user_input=None):
# installs SIGTERM handler
def handler(signum, frame):
#ignore further signals
signal.signal(signal.SIGTERM, signal.SIG_IGN)
signal.signal(signal.SIGINT, signal.SIG_IGN)
logger.info("Signal %d caught, terminating...", signum)
stop()
signal.signal(signal.SIGTERM, handler)
signal.signal(signal.SIGINT, handler)
try:
split.process(
execute=arguments['<execute>'],
cpulimit=arguments['--cpulimit'],
)
except KeyboardInterrupt:
logger.info("CTRL-c caught, terminating...")
stop()
split.process(
execute=arguments['<execute>'],
cpulimit=arguments['--cpulimit'],
)
......@@ -89,9 +89,14 @@ def main(user_input=None):
# installs SIGTERM handler
def handler(signum, frame):
#ignore further signals
signal.signal(signal.SIGTERM, signal.SIG_IGN)
signal.signal(signal.SIGINT, signal.SIG_IGN)
logger.info("Signal %d caught, terminating...", signum)
global stop
stop = True
signal.signal(signal.SIGTERM, handler)
signal.signal(signal.SIGINT, handler)
......
......@@ -101,9 +101,14 @@ def main(user_input=None):
# installs SIGTERM handler
def handler(signum, frame):
#ignore further signals
signal.signal(signal.SIGTERM, signal.SIG_IGN)
signal.signal(signal.SIGINT, signal.SIG_IGN)
logger.info("Signal %d caught, terminating...", signum)
global stop
stop = True
signal.signal(signal.SIGTERM, handler)
signal.signal(signal.SIGINT, handler)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment