#NEWLINE# def add_engines( n = 1 , profile = 'iptest' ) : #NEWLINE# #INDENT# rc = Client ( profile = profile ) #NEWLINE# base = len ( rc ) #NEWLINE# eps = [ ] #NEWLINE# for i in range ( n ) : #NEWLINE# #INDENT# ep = TestProcessLauncher ( ) #NEWLINE# ep . cmd_and_args = ( ipengine_cmd_argv + [ ( '--profile=%s' % profile ) , '--log-level=50' ] ) #NEWLINE# ep . start ( ) #NEWLINE# launchers . append ( ep ) #NEWLINE# eps . append ( n ) #NEWLINE# #UNINDENT# tic = time . time ( ) #NEWLINE# while ( len ( rc ) < ( base + n ) ) : #NEWLINE# #INDENT# if any ( [ ( ep . poll ( ) is not None ) for ep in eps ] ) : #NEWLINE# #INDENT# raise RuntimeError ( 'A test engine failed to start.' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( time . time ( ) - tic ) > 10 ) : #NEWLINE# #INDENT# raise RuntimeError ( 'Timeout waiting for engines to connect.' ) #NEWLINE# #UNINDENT# #UNINDENT# time . sleep ( 0.1 ) #NEWLINE# rc . spin ( ) #NEWLINE# #UNINDENT# rc . close ( ) #NEWLINE# return eps