This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1278757 - [RFE] - handle SIGTERM in rteval as end of run
[RFE] - handle SIGTERM in rteval as end of run
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rteval (Show other bugs)
7.3
Unspecified Unspecified
unspecified Severity unspecified
: rc
: 7.3
Assigned To: Luis Claudio R. Goncalves
Jiri Kastner
Maxim Svistunov
: FutureFeature
Depends On:
Blocks: 1313485 1274397 RT7.3-Prio
  Show dependency treegraph
 
Reported: 2015-11-06 06:07 EST by Jiri Kastner
Modified: 2016-11-03 21:34 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
The rteval program program now treats both SIGINT and SIGTERM as stop events and preserves all the data that has been gathered up to the event.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 21:34:06 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jiri Kastner 2015-11-06 06:07:21 EST
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):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:
[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
^C[root@mrg-qe-14 ~]# 


Expected results:
when ctrl+c is pressed, or rteval receive sigkill or sigterm signal, we should see results

Additional info:
Comment 3 Clark Williams 2016-03-29 13:42:30 EDT
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
--- a/rteval/__init__.py
+++ b/rteval/__init__.py
@@ -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 ***"
+    else:
+        raise RuntimeError("SIGNAL received! (%d)" % signum)
 
 class RtEval(rtevalReport):
     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:
                 time.sleep(60.0)
                 if not measure_profile.isAlive():
                     stoptime = currtime
Comment 8 errata-xmlrpc 2016-11-03 21:34:06 EDT
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.

https://rhn.redhat.com/errata/RHBA-2016-2244.html

Note You need to log in before you can comment on or make changes to this bug.