#NEWLINE# def main( ) : #NEWLINE# #INDENT# parser = argparse . ArgumentParser ( "luigi-grep is used to search for workflows using the luigi scheduler's json api" ) #NEWLINE# parser . add_argument ( '--scheduler-host' , default = 'localhost' , help = 'hostname of the luigi scheduler' ) #NEWLINE# parser . add_argument ( '--scheduler-port' , default = '8082' , help = 'port of the luigi scheduler' ) #NEWLINE# parser . add_argument ( '--prefix' , help = 'prefix of a task query to search for' , default = None ) #NEWLINE# parser . add_argument ( '--status' , help = 'search for jobs with the given status' , default = None ) #NEWLINE# args = parser . parse_args ( ) #NEWLINE# grep = LuigiGrep ( args . scheduler_host , args . scheduler_port ) #NEWLINE# results = [ ] #NEWLINE# if args . prefix : #NEWLINE# #INDENT# results = grep . prefix_search ( args . prefix ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if args . status : #NEWLINE# #INDENT# results = grep . status_search ( args . status ) #NEWLINE# #UNINDENT# #UNINDENT# for job in results : #NEWLINE# #INDENT# print ( '{name}: {status}, Dependencies:' . format ( name = job [ 'name' ] , status = job [ 'status' ] ) ) #NEWLINE# for ( status , jobs ) in six . iteritems ( job [ 'deps_by_status' ] ) : #NEWLINE# #INDENT# print ( '  status={status}' . format ( status = status ) ) #NEWLINE# for job in jobs : #NEWLINE# #INDENT# print ( '    {job}' . format ( job = job ) )