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): ...@@ -116,19 +116,17 @@ def main(user_input=None):
# installs SIGTERM handler # installs SIGTERM handler
def handler(signum, frame): 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) logger.info("Signal %d caught, terminating...", signum)
stop() stop()
signal.signal(signal.SIGTERM, handler) signal.signal(signal.SIGTERM, handler)
signal.signal(signal.SIGINT, handler) signal.signal(signal.SIGINT, handler)
try: split.process(
execute=arguments['<execute>'],
split.process( cpulimit=arguments['--cpulimit'],
execute=arguments['<execute>'], )
cpulimit=arguments['--cpulimit'],
)
except KeyboardInterrupt:
logger.info("CTRL-c caught, terminating...")
stop()
...@@ -89,9 +89,14 @@ def main(user_input=None): ...@@ -89,9 +89,14 @@ def main(user_input=None):
# installs SIGTERM handler # installs SIGTERM handler
def handler(signum, frame): 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) logger.info("Signal %d caught, terminating...", signum)
global stop global stop
stop = True stop = True
signal.signal(signal.SIGTERM, handler) signal.signal(signal.SIGTERM, handler)
signal.signal(signal.SIGINT, handler) signal.signal(signal.SIGINT, handler)
......
...@@ -101,9 +101,14 @@ def main(user_input=None): ...@@ -101,9 +101,14 @@ def main(user_input=None):
# installs SIGTERM handler # installs SIGTERM handler
def handler(signum, frame): 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) logger.info("Signal %d caught, terminating...", signum)
global stop global stop
stop = True stop = True
signal.signal(signal.SIGTERM, handler) signal.signal(signal.SIGTERM, handler)
signal.signal(signal.SIGINT, 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