#NEWLINE# def pipelineDaemon( pipeline , options , programName = None ) : #NEWLINE# #INDENT# 'Launches Pyro server and (if specified by options) pipeline executors' #NEWLINE# if ( options . urifile is None ) : #NEWLINE# #INDENT# options . urifile = os . path . abspath ( os . path . join ( os . curdir , ( options . pipeline_name + '_uri' ) ) ) #NEWLINE# #UNINDENT# if options . restart : #NEWLINE# #INDENT# logger . debug ( 'Examining filesystem to determine skippable stages...' ) #NEWLINE# pipeline . skip_completed_stages ( ) #NEWLINE# #UNINDENT# if ( len ( pipeline . runnable ) == 0 ) : #NEWLINE# #INDENT# print ( 'Pipeline has no runnable stages. Exiting...' ) #NEWLINE# sys . exit ( ) #NEWLINE# #UNINDENT# logger . debug ( 'Prior to starting server, total stages %i. Number processed: %i.' , len ( pipeline . stages ) , pipeline . num_finished_stages ) #NEWLINE# logger . debug ( 'Number of stages in runnable queue: %i' , len ( pipeline . runnable ) ) #NEWLINE# pipeline . programName = programName #NEWLINE# try : #NEWLINE# #INDENT# with open ( pipeline . backupFileLocation , 'a' ) as fh : #NEWLINE# #INDENT# pipeline . finished_stages_fh = fh #NEWLINE# logger . debug ( 'Starting server...' ) #NEWLINE# launchServer ( pipeline , options ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# logger . exception ( 'Exception (=> quitting): ' ) #NEWLINE# raise