From 4981b600f0241b5a0786a904a631c5d350fdf9b3 Mon Sep 17 00:00:00 2001 From: Stephen Diehl Date: Thu, 12 Jul 2012 16:56:39 -0400 Subject: [PATCH] Minor changes to Zipline for signals. --- zipline/core/host.py | 5 +++++ zipline/core/monitor.py | 2 +- zipline/lines.py | 21 +++++++++++---------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/zipline/core/host.py b/zipline/core/host.py index 804b25e6..ea1ca0aa 100644 --- a/zipline/core/host.py +++ b/zipline/core/host.py @@ -92,6 +92,10 @@ class ComponentHost(object): def unregister_component(self, component_id): del self.components[component_id] + @property + def pids(self): + return [proc.pid for proc in self.subprocesses] + def open(self): assert hasattr(self, 'zmq_flavor'), \ """ You must specify a flavor of ZeroMQ for all Topology @@ -111,6 +115,7 @@ class ComponentHost(object): for component in self.components.itervalues(): self.launch_component(component) + def is_running(self): """ DEPRECATED, left in for compatability for now. diff --git a/zipline/core/monitor.py b/zipline/core/monitor.py index 1edf1927..17d8c651 100644 --- a/zipline/core/monitor.py +++ b/zipline/core/monitor.py @@ -43,7 +43,7 @@ log = logbook.Logger('Controller') # the system. PARAMETERS = ndict(dict( - GENERATIONAL_PERIOD = 1, + GENERATIONAL_PERIOD = 8, ALLOWED_SKIPPED_HEARTBEATS = 3, ALLOWED_INVALID_HEARTBEATS = 3, PRESTART_HEARBEATS = 3, diff --git a/zipline/lines.py b/zipline/lines.py index 23eb8690..2583672c 100644 --- a/zipline/lines.py +++ b/zipline/lines.py @@ -399,16 +399,17 @@ class SimulatedTrading(object): # the supervisory layer # TODO: better way of identifying concurrency substrate - if self.sim.zmq_flavor == 'thread': - log.debug('Blocking') - for thread in self.sim.subthreads: - #log.debug('Waiting on %r' % thread) - log.debug('Waiting on %r' % thread) - thread.join() - log.debug('Yielded on %r' % thread) - else: - for process in self.sim.subprocesses: - process.join() + if blocking: + if self.sim.zmq_flavor == 'thread': + log.debug('Blocking') + for thread in self.sim.subthreads: + #log.debug('Waiting on %r' % thread) + log.debug('Waiting on %r' % thread) + thread.join() + log.debug('Yielded on %r' % thread) + else: + for process in self.sim.subprocesses: + process.join() @property def is_success(self):