##// END OF EJS Templates
wait for controller to start, before starting engines.
wait for controller to start, before starting engines.

File last commit:

r3677:5fe1471e
r3677:5fe1471e
Show More
__init__.py
70 lines | 1.9 KiB | text/x-python | PythonLexer
MinRK
some initial tests for newparallel
r3637 """toplevel setup/teardown for parallel tests."""
MinRK
update API after sagedays29...
r3664 #-------------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Imports
#-------------------------------------------------------------------------------
MinRK
add message tracking to client, add/improve tests
r3654 import tempfile
MinRK
added preliminary tests for zmq.parallel
r3595 import time
MinRK
add message tracking to client, add/improve tests
r3654 from subprocess import Popen, PIPE, STDOUT
MinRK
added preliminary tests for zmq.parallel
r3595
MinRK
organize IPython.parallel into subpackages
r3673 from IPython.parallel import Client
MinRK
added preliminary tests for zmq.parallel
r3595
MinRK
some initial tests for newparallel
r3637 processes = []
MinRK
add message tracking to client, add/improve tests
r3654 blackhole = tempfile.TemporaryFile()
MinRK
some initial tests for newparallel
r3637
# nose setup/teardown
MinRK
added preliminary tests for zmq.parallel
r3595
def setup():
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 cp = Popen('ipcontroller --profile iptest -r --log-level 10 --log-to-file'.split(), stdout=blackhole, stderr=STDOUT)
MinRK
wait for controller to start, before starting engines.
r3677 time.sleep(1)
MinRK
some initial tests for newparallel
r3637 processes.append(cp)
time.sleep(.5)
MinRK
update API after sagedays29...
r3664 add_engines(1)
MinRK
organize IPython.parallel into subpackages
r3673 c = Client(profile='iptest')
MinRK
reflect revised apply_bound pattern
r3655 while not c.ids:
time.sleep(.1)
c.spin()
MinRK
update API after sagedays29...
r3664 c.close()
MinRK
added preliminary tests for zmq.parallel
r3595
MinRK
update API after sagedays29...
r3664 def add_engines(n=1, profile='iptest'):
MinRK
organize IPython.parallel into subpackages
r3673 rc = Client(profile=profile)
MinRK
update API after sagedays29...
r3664 base = len(rc)
eps = []
for i in range(n):
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 ep = Popen(['ipengine']+ ['--profile', profile, '--log-level', '10', '--log-to-file'], stdout=blackhole, stderr=STDOUT)
MinRK
update API after sagedays29...
r3664 # ep.start()
processes.append(ep)
eps.append(ep)
while len(rc) < base+n:
time.sleep(.1)
rc.spin()
rc.close()
return eps
MinRK
added preliminary tests for zmq.parallel
r3595
def teardown():
time.sleep(1)
while processes:
p = processes.pop()
if p.poll() is None:
try:
p.terminate()
except Exception, e:
print e
pass
if p.poll() is None:
time.sleep(.25)
if p.poll() is None:
try:
print 'killing'
p.kill()
except:
MinRK
reflect revised apply_bound pattern
r3655 print "couldn't shutdown process: ", p
MinRK
added preliminary tests for zmq.parallel
r3595