Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding signal handler module #227

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions core/redant_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
2) Tests-to-run list preparation (by test_list_builder).
3) Invocation of the test_runner.
"""

import signal
import sys
import time
import datetime
import argparse
from signal_handler import signal_handler
from parsing.params_handler import ParamsHandler
from test_list_builder import TestListBuilder
from test_runner import TestRunner
Expand Down Expand Up @@ -104,4 +107,8 @@ def main():


if __name__ == '__main__':

signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTSTP, signal_handler)

main()
18 changes: 18 additions & 0 deletions core/signal_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
This file consists of functions for handling
signals. Signal handling is required for the
graceful exit of the test framework
"""

def signal_handler(signalNumber, frame):
"""
Function for handling signal and raising the
SystemExit call for graceful exit of the test
framework
Args:
signalNumber (int): The signal number of the signal caught
frame: current stack frame, None or stack frame object.
"""
print("Signal Received",signalNumber)
raise SystemExit('Exiting...')
return