#NEWLINE# @ classmethod #NEWLINE# def task_in_orchestrator( cls , **kwargs ) : #NEWLINE# #INDENT# logger . info ( 'RPC method task_in_orchestrator received: %s' , jsonutils . dumps ( kwargs ) ) #NEWLINE# task_uuid = kwargs . get ( 'task_uuid' ) #NEWLINE# try : #NEWLINE# #INDENT# task = objects . Task . get_by_uuid ( task_uuid , fail_if_not_found = True , lock_for_update = True ) #NEWLINE# if ( task . status == consts . TASK_STATUSES . pending ) : #NEWLINE# #INDENT# objects . Task . update ( task , { #NEWLINE# #INDENT# 'status' : consts . TASK_STATUSES . running , #NEWLINE# #UNINDENT# } ) #NEWLINE# logger . debug ( "Task '%s' is acknowledged as running" , task_uuid ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . debug ( "Task '%s' in status '%s' can not be acknowledged as running" , task_uuid , task . status ) #NEWLINE# #UNINDENT# #UNINDENT# except nailgun_errors . ObjectNotFound : #NEWLINE# #INDENT# logger . warning ( "Task '%s' acknowledgement as running failed due to task doesn't exist in DB" , task_uuid )