mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-08 03:44:29 +08:00
changed logic to take a boolean flag for sighup signaling.
This commit is contained in:
@@ -5,6 +5,7 @@ import sys
|
||||
import time
|
||||
import itertools
|
||||
import logbook
|
||||
import psutil
|
||||
from setproctitle import setproctitle
|
||||
from signal import SIGHUP, SIGINT, SIGKILL, signal
|
||||
|
||||
@@ -69,7 +70,7 @@ class Controller(object):
|
||||
debug = True
|
||||
period = PARAMETERS.GENERATIONAL_PERIOD
|
||||
|
||||
def __init__(self, pub_socket, route_socket):
|
||||
def __init__(self, pub_socket, route_socket, send_sighup=False):
|
||||
|
||||
self.nosignals = False
|
||||
self.context = None
|
||||
@@ -97,10 +98,9 @@ class Controller(object):
|
||||
|
||||
self.missed_beats = Counter()
|
||||
|
||||
# if we are inside a test, we want to skip signalling
|
||||
# back to the parent process.
|
||||
self.inside_test = 'nose' in inspect.stack()[-1][1]
|
||||
|
||||
self.send_sighup = send_sighup
|
||||
if self.send_sighup:
|
||||
log.info("Request to send sighup")
|
||||
|
||||
|
||||
def init_zmq(self):
|
||||
@@ -357,8 +357,8 @@ class Controller(object):
|
||||
we're good. The topology exited cleanly and we can prove
|
||||
it.
|
||||
"""
|
||||
if self.inside_test:
|
||||
log.warning("Skipping SIGHUP because we're in a nosetest")
|
||||
if not self.send_sighup:
|
||||
log.warning("Skipping SIGHUP")
|
||||
return
|
||||
ppid = os.getppid()
|
||||
log.warning("Sending SIGHUP")
|
||||
|
||||
@@ -114,6 +114,7 @@ class SimulatedTrading(object):
|
||||
self.allocator = config['allocator']
|
||||
self.trading_environment = config['trading_environment']
|
||||
self.sim_style = config.get('simulation_style')
|
||||
self.send_sighup = config.get('send_sighup', False)
|
||||
|
||||
|
||||
self.leased_sockets = []
|
||||
@@ -133,6 +134,7 @@ class SimulatedTrading(object):
|
||||
self.con = Controller(
|
||||
sockets[5],
|
||||
sockets[6],
|
||||
self.send_sighup
|
||||
)
|
||||
|
||||
self.started = False
|
||||
|
||||
Reference in New Issue
Block a user