#NEWLINE# @ safe #NEWLINE# def statusUpdate( self , driver , update ) : #NEWLINE# #INDENT# logger . debug ( ( 'Task %s in state %d' % ( update . task_id . value , update . state ) ) ) #NEWLINE# tid = int ( update . task_id . value . split ( '-' ) [ 0 ] ) #NEWLINE# if ( tid not in self . task_launched ) : #NEWLINE# #INDENT# logger . error ( 'Task %d not in task_launched' , tid ) #NEWLINE# return #NEWLINE# #UNINDENT# t = self . task_launched [ tid ] #NEWLINE# t . state = update . state #NEWLINE# t . state_time = time . time ( ) #NEWLINE# if ( update . state == mesos_pb2 . TASK_RUNNING ) : #NEWLINE# #INDENT# launched = sum ( ( slots for ( hostname , slots ) in self . used_tasks . values ( ) ) ) #NEWLINE# ready = all ( ( ( t . state == mesos_pb2 . TASK_RUNNING ) for t in self . task_launched . values ( ) ) ) #NEWLINE# if ( ( launched == self . options . tasks ) and ready ) : #NEWLINE# #INDENT# logger . debug ( 'all tasks are ready, start to run' ) #NEWLINE# self . start_mpi ( ) #NEWLINE# #UNINDENT# return #NEWLINE# #UNINDENT# del self . task_launched [ tid ] #NEWLINE# sid = next ( ( sid for sid in self . slaveTasks if ( tid in self . slaveTasks [ sid ] ) ) , None ) #NEWLINE# if sid : #NEWLINE# #INDENT# self . slaveTasks [ sid ] . remove ( tid ) #NEWLINE# #UNINDENT# if ( update . state != mesos_pb2 . TASK_FINISHED ) : #NEWLINE# #INDENT# if ( not self . started ) : #NEWLINE# #INDENT# logger . warning ( 'Task %d %s with %d, retry %d' , t . id , ( 'Lost' if ( self . state == mesos_pb2 . TASK_LOST ) else 'Failed' ) , update . state , t . tried ) #NEWLINE# driver . reviveOffers ( ) #NEWLINE# self . used_tasks . pop ( tid ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . error ( 'Task %s failed, cancel all tasks' , tid ) #NEWLINE# self . stop ( 1 ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( not self . started ) : #NEWLINE# #INDENT# logger . warning ( 'Task %s has not started, ignore it %s' , tid , update . state ) #NEWLINE# return #NEWLINE# #UNINDENT# if ( not self . task_launched ) : #NEWLINE# #INDENT# self . stop ( 0 )