Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

corrected errors in service cleanup; now log more events

  • Loading branch information...
commit a5e183d6393910ff1418261a7929a96dc332aacb 1 parent daf1c65
@trey0 trey0 authored
View
4 geocamPycroraptor2/bin/pyraptord.py
@@ -7,6 +7,7 @@
import os
+import gevent
import zerorpc
from geocamPycroraptor2.manager import Manager
@@ -30,6 +31,9 @@ def pyraptord(cmd, opts):
m._preQuitHandler = s.stop
m._postQuitHandler = d.removePid
s.run()
+ # we fall out of run() for some reason after receiving
+ # SIGINT, but we still want to do some cleanup
+ gevent.sleep(10000)
else:
d.execute(cmd)
View
3  geocamPycroraptor2/manager.py
@@ -125,8 +125,8 @@ def _cleanupChildren(self):
while 1:
for svc in self._services.itervalues():
svc._cleanup()
+ self._checkForQuitComplete()
gevent.sleep(0.1)
- self._checkForQuitComplete()
def _quitInternal(self):
# leave time to respond to caller before shutting down
@@ -136,6 +136,7 @@ def _quitInternal(self):
self._preQuitHandler()
for svc in self._services.itervalues():
if svc.isActive():
+ self._logger.info('stopping %s' % svc._name)
svc.stop()
self._checkForQuitComplete()
View
4 geocamPycroraptor2/service.py
@@ -186,7 +186,7 @@ def _cleanup(self):
if self._proc and self._proc.poll() != None:
if self._proc.returncode < 0:
sigNum = -self._proc.returncode
- if sigNum in (signal.SIGTERM, signal.SIGHUP):
+ if sigNum in (signal.SIGHUP, signal.SIGINT, signal.SIGTERM):
status0 = statuslib.ABORTED
else:
status0 = statuslib.FAILED
@@ -227,8 +227,8 @@ def _postExitCleanup(self):
self._eventLogger = None
if self._stdinLogger:
self._stdinLogger = None
- self._log.flush()
self._log.close()
+ self._log = None
# note: keep self._logBuffer around in case a client requests old log data.
# it will be reinitialized the next time the task is started.
# self._checkForPendingRestart()
View
3  geocamPycroraptor2/status.py
@@ -26,7 +26,8 @@
FAILED)
ACTIVE_STATUS = (STARTING,
- RUNNING)
+ RUNNING,
+ STOPPING)
def isActive(status):
View
5 geocamPycroraptor2/tests/pycroraptor.json
@@ -5,9 +5,12 @@
"SERVICES": {
"bc": {
"command": "bc -i"
+ },
+ "nohup": {
+ "command": "nohup cat"
}
},
"GROUPS": {
- "startup": ["bc"]
+ "startup": ["bc", "nohup"]
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.