mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-31 18:21:14 +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 logging
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import warnings
|
||||
|
||||
@ -41,6 +42,9 @@ def load_commands(subparsers):
|
||||
for command in ext_loader.list_commands():
|
||||
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():
|
||||
try:
|
||||
@ -62,6 +66,7 @@ def main():
|
||||
settings.update(args.config)
|
||||
init_logging(settings.verbosity)
|
||||
|
||||
signal.signal(signal.SIGTERM, convert_TERM_into_INT_handler)
|
||||
command = settings.commands[args.command]
|
||||
sys.exit(command.execute(args))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user