#NEWLINE# def check( self ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# experiments_per_laboratory = self . coordinator . list_laboratories_addresses ( ) #NEWLINE# broken_resources = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for laboratory_address_str in experiments_per_laboratory : #NEWLINE# #INDENT# self . current_lab = laboratory_address_str #NEWLINE# new_broken_resources = self . check_laboratory ( laboratory_address_str , experiments_per_laboratory [ laboratory_address_str ] ) #NEWLINE# for broken_resource in new_broken_resources : #NEWLINE# #INDENT# if ( broken_resource in broken_resources ) : #NEWLINE# #INDENT# broken_resources [ broken_resource ] += ( ';' + new_broken_resources [ broken_resource ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# broken_resources [ broken_resource ] = new_broken_resources [ broken_resource ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# all_notifications = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for laboratory_address_str in experiments_per_laboratory : #NEWLINE# #INDENT# experiments = experiments_per_laboratory [ laboratory_address_str ] #NEWLINE# for experiment in experiments : #NEWLINE# #INDENT# laboratory_resource = experiments [ experiment ] #NEWLINE# if ( laboratory_resource in broken_resources ) : #NEWLINE# #INDENT# notifications = self . coordinator . mark_resource_as_broken ( laboratory_resource , broken_resources [ laboratory_resource ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# notifications = self . coordinator . mark_resource_as_fixed ( laboratory_resource ) #NEWLINE# #UNINDENT# for recipients in notifications : #NEWLINE# #INDENT# if ( recipients in all_notifications ) : #NEWLINE# #INDENT# all_notifications [ recipients ] . extend ( notifications [ recipients ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# all_notifications [ recipients ] = list ( notifications [ recipients ] ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if all_notifications : #NEWLINE# #INDENT# self . coordinator . notify_status ( all_notifications ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# traceback . print_exc ( ) #NEWLINE# log . log ( ResourcesChecker , log . level . Critical , 'Error checking resources.' ) #NEWLINE# log . log_exc ( ResourcesChecker , log . level . Critical )