Author: tmckay Date: 2012-03-05 16:05:35 +0000 (Mon, 05 Mar 2012) New Revision: 5235
Modified: trunk/cumin/bin/cumin trunk/cumin/bin/cumin-data trunk/cumin/bin/cumin-web trunk/parsley/python/parsley/loggingex.py Log: Change initial shutdown signal from cumin master to SIGTERM instead of SIGINT. Get rid of traceback call in loggingex.py
Modified: trunk/cumin/bin/cumin =================================================================== --- trunk/cumin/bin/cumin 2012-03-02 16:25:36 UTC (rev 5234) +++ trunk/cumin/bin/cumin 2012-03-05 16:05:35 UTC (rev 5235) @@ -187,7 +187,7 @@ complete = len(apps) break else: - log.warn("Subprocess (%s) exited with status %s (%s), %s"\ + log.info("Subprocess (%s) exited with status %s (%s), %s"\ % (app[PROCESS].pid, poll, err[0], err[1])) if poll != 0: log.info("Subprocess logs may contain more details.") @@ -198,12 +198,12 @@ start(app, "Restart") finally: # Try a ctrl-C first - log.info("Send SIGINT to all children") + log.info("Send SIGTERM to all children") complete = 0 for app in apps: if app[PROCESS]: complete += 1 - os.kill(app[PROCESS].pid, signal.SIGINT) + os.kill(app[PROCESS].pid, signal.SIGTERM)
# Give children 10 seconds to exit, then bail then = datetime.now() @@ -211,6 +211,7 @@ for app in apps: poll = app[PROCESS] and app[PROCESS].poll() if poll is not None: + log.info("Subprocess (%s) exited", app[PROCESS].pid) app[PROCESS] = None complete -= 1
@@ -220,9 +221,12 @@
sleep(0.25) if datetime.now() - then > timedelta(seconds=10): - for app in apps: # just to be paranoid - app[PROCESS] and os.kill(app[PROCESS].pid, signal.SIGKILL) - log.info("Timed out waiting for children, exited") + log.warn("Timed out waiting for children, send SIGKILL") + for app in apps: # just to be paranoid + if app[PROCESS]: + log.warn("Send SIGKILL to subprocess (%s)"\ + % app[PROCESS].pid) + os.kill(app[PROCESS].pid, signal.SIGKILL) break
return return_code
Modified: trunk/cumin/bin/cumin-data =================================================================== --- trunk/cumin/bin/cumin-data 2012-03-02 16:25:36 UTC (rev 5234) +++ trunk/cumin/bin/cumin-data 2012-03-05 16:05:35 UTC (rev 5235) @@ -263,11 +263,17 @@ mint.stop() if pipeThread: pipeThread.stop() + log.info("about to call logging shutdown") logging.shutdown() return adjust_return(passed_init, return_code)
+def make_ctrl_c(sig, frame): + raise KeyboardInterrupt + if __name__ == "__main__": try: + import signal + signal.signal(signal.SIGTERM, make_ctrl_c) sys.exit(main()) except KeyboardInterrupt: sys.exit(0)
Modified: trunk/cumin/bin/cumin-web =================================================================== --- trunk/cumin/bin/cumin-web 2012-03-02 16:25:36 UTC (rev 5234) +++ trunk/cumin/bin/cumin-web 2012-03-05 16:05:35 UTC (rev 5235) @@ -201,11 +201,17 @@ cumin.stop() if pipeThread: pipeThread.stop() + log.info("about to call logging shutdown") logging.shutdown() return adjust_return(passed_init, return_code)
+def make_ctrl_c(sig, frame): + raise KeyboardInterrupt + if __name__ == "__main__": try: + import signal + signal.signal(signal.SIGTERM, make_ctrl_c) sys.exit(main()) except KeyboardInterrupt: sys.exit(0)
Modified: trunk/parsley/python/parsley/loggingex.py =================================================================== --- trunk/parsley/python/parsley/loggingex.py 2012-03-02 16:25:36 UTC (rev 5234) +++ trunk/parsley/python/parsley/loggingex.py 2012-03-05 16:05:35 UTC (rev 5235) @@ -3,7 +3,6 @@ import sys from stat import ST_DEV, ST_INO
-import traceback import select from logging.handlers import RotatingFileHandler from collectionsex import defaultdict @@ -223,7 +222,6 @@ except Exception, e: if callable(self.call_on_fail): self.call_on_fail() - traceback.print_exc()
finally: for key, value in self.files.items():
cumin-developers@lists.fedorahosted.org