#NEWLINE# def _sync_step_from_queue( self , step ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# item = self . _get_json_response ( step . data [ 'master' ] , '/queue/item/{}' . format ( step . data [ 'item_id' ] ) ) #NEWLINE# #UNINDENT# except NotFound : #NEWLINE# #INDENT# build_no = self . _find_build_no ( step . data [ 'master' ] , step . data [ 'job_name' ] , changes_bid = step . id . hex ) #NEWLINE# if build_no : #NEWLINE# #INDENT# step . data [ 'queued' ] = False #NEWLINE# step . data [ 'build_no' ] = build_no #NEWLINE# db . session . add ( step ) #NEWLINE# self . _sync_step_from_active ( step ) #NEWLINE# return #NEWLINE# #UNINDENT# step . status = Status . finished #NEWLINE# step . result = Result . infra_failed #NEWLINE# db . session . add ( step ) #NEWLINE# self . logger . exception ( 'Queued step not found in queue: {} (build: {})' . format ( step . id , step . job . build_id ) ) #NEWLINE# statsreporter . stats ( ) . incr ( 'jenkins_item_not_found_in_queue' ) #NEWLINE# return #NEWLINE# #UNINDENT# if item . get ( 'executable' ) : #NEWLINE# #INDENT# build_no = item [ 'executable' ] [ 'number' ] #NEWLINE# step . data [ 'queued' ] = False #NEWLINE# step . data [ 'build_no' ] = build_no #NEWLINE# step . data [ 'uri' ] = item [ 'executable' ] [ 'url' ] #NEWLINE# db . session . add ( step ) #NEWLINE# #UNINDENT# if item [ 'blocked' ] : #NEWLINE# #INDENT# step . status = Status . queued #NEWLINE# db . session . add ( step ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( item . get ( 'cancelled' ) and ( not step . data . get ( 'build_no' ) ) ) : #NEWLINE# #INDENT# step . status = Status . finished #NEWLINE# step . result = Result . aborted #NEWLINE# db . session . add ( step ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if item . get ( 'executable' ) : #NEWLINE# #INDENT# self . _sync_step_from_active ( step ) #NEWLINE# return