mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-07 13:41:24 +00:00
Merge pull request #402 from AnthonyARM/master
Convert TERM signals into INT to allow WA to exit cleanly
This commit is contained in:
commit
389a1ecf76
@ -18,6 +18,7 @@ import sys
|
|||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import signal
|
||||||
import subprocess
|
import subprocess
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
@ -41,6 +42,9 @@ def load_commands(subparsers):
|
|||||||
for command in ext_loader.list_commands():
|
for command in ext_loader.list_commands():
|
||||||
settings.commands[command.name] = ext_loader.get_command(command.name, subparsers=subparsers)
|
settings.commands[command.name] = ext_loader.get_command(command.name, subparsers=subparsers)
|
||||||
|
|
||||||
|
def convert_TERM_into_INT_handler(signal, frame):
|
||||||
|
logger.critical("TERM received, aborting")
|
||||||
|
raise KeyboardInterrupt()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
@ -62,6 +66,7 @@ def main():
|
|||||||
settings.update(args.config)
|
settings.update(args.config)
|
||||||
init_logging(settings.verbosity)
|
init_logging(settings.verbosity)
|
||||||
|
|
||||||
|
signal.signal(signal.SIGTERM, convert_TERM_into_INT_handler)
|
||||||
command = settings.commands[args.command]
|
command = settings.commands[args.command]
|
||||||
sys.exit(command.execute(args))
|
sys.exit(command.execute(args))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user