Reenable nose magic.

This commit is contained in:
Stephen Diehl
2012-07-05 14:39:15 -04:00
parent 44cdf60feb
commit c39267eff4
2 changed files with 16 additions and 12 deletions
-4
View File
@@ -119,10 +119,6 @@ class ComponentHost(object):
for component in self.components.itervalues():
self.launch_component(component)
# TODO: no hacks
if hasattr(self, 'con'):
self.con.join()
def is_running(self):
"""
DEPRECATED, left in for compatability for now.
+16 -8
View File
@@ -61,6 +61,7 @@ before invoking simulate.
"""
import inspect
import logbook
import zipline.utils.factory as factory
from zipline.components import DataSource
@@ -72,6 +73,8 @@ from zipline.core.devsimulator import Simulator
from zipline.core.monitor import Controller
from zipline.finance.trading import SIMULATION_STYLE
log = logbook.Logger('Lines')
class SimulatedTrading(object):
"""
Zipline with::
@@ -272,11 +275,11 @@ class SimulatedTrading(object):
zipline.add_source(trade_source)
# Save us from needless debugging
#inside_test = 'nose' in inspect.stack()[-1][1]
#if inside_test and not config.get('devel', False):
#assert False, """
#You need to run the SimulatedTrading inside a test with devel=True
#"""
inside_test = 'nose' in inspect.stack()[-1][1]
if inside_test and not config.get('devel', False):
assert False, """
You need to run the SimulatedTrading inside a test with devel=True
"""
return zipline
@@ -370,12 +373,16 @@ class SimulatedTrading(object):
"""
self.con.manage(self.topology)
def simulate(self, blocking=False):
def simulate(self, blocking=True):
self.setup_controller()
self.started = True
self.sim_context = self.sim.simulate()
# If we're in development mode then flag all the
# components in the topology as devel so as to indicate
# that they won't poll on the control channels for
# anything other than the synchronized start.
if self.devel:
for component in self.components:
component.devel = True
@@ -387,9 +394,10 @@ class SimulatedTrading(object):
# 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)
#print 'Waiting on %r' % thread
log.debug('Waiting on %r' % thread)
print 'Waiting on %r' % thread
thread.join()
else:
for process in self.sim.subprocesses: