Red Hat Bugzilla – Bug 1278757
[RFE] - handle SIGTERM in rteval as end of run
Last modified: 2016-11-03 21:34:06 EDT
Description of problem:
when ctrl+c is pressed, rteval return traceback and all gathered data are lost. currently
Version-Release number of selected component (if applicable):
Steps to Reproduce:
[root@mrg-qe-14 ~]# date
Fri Nov 6 11:41:16 CET 2015
[root@mrg-qe-14 ~]# rteval -d 20m
rteval run on 3.10.0-327.rt56.204.el7.x86_64 started at Fri Nov 6 11:41:29 2015
started 2 loads on 6 cores
Run duration: 1200.0 seconds
when ctrl+c is pressed, or rteval receive sigkill or sigterm signal, we should see results
This proposed patch changes run behavior to treat both SIGINT and SIGTERM as stop events. Is this what you're looking for?
diff --git a/rteval/__init__.py b/rteval/__init__.py
index 8ff8429277de..15209da2e7b2 100644
@@ -24,7 +24,7 @@
-Copyright (c) 2008-2013 Red Hat Inc.
+Copyright (c) 2008-2016 Red Hat Inc.
Realtime verification utility
@@ -44,17 +44,15 @@ import version
RTEVAL_VERSION = version.RTEVAL_VERSION
-sigint_received = False
+stopsig_received = False
def sig_handler(signum, frame):
- if signum == signal.SIGINT:
- global sigint_received
- sigint_received = True
- print "*** SIGINT received - stopping rteval run ***"
- elif signum == signal.SIGTERM:
- raise RuntimeError("SIGTERM received!")
+ if signum == signal.SIGINT or signum == signal.SIGTERM:
+ global stopsig_received
+ stopsig_received = True
+ print "*** stop signal received - stopping rteval run ***"
+ raise RuntimeError("SIGNAL received! (%d)" % signum)
def __init__(self, config, loadmods, measuremods, logger):
@@ -209,7 +207,7 @@ sigint_received = False
currtime = time.time()
rpttime = currtime + report_interval
load_avg_checked = 5
- while (currtime <= stoptime) and not sigint_received:
+ while (currtime <= stoptime) and not stopsig_received:
if not measure_profile.isAlive():
stoptime = currtime
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.