@@ -103,7 +103,8 @@ def getIdleExecutor(self, eType):
103
103
idleId = None
104
104
maxFreeSlots = 0
105
105
try :
106
- for eId in self .__typeToId [eType ]:
106
+ # Work on a copy of self.__typeToId[eType] to race conditions causing it's size to change while iterating
107
+ for eId in list (self .__typeToId [eType ]):
107
108
freeSlots = self .freeSlots (eId )
108
109
if freeSlots > maxFreeSlots :
109
110
maxFreeSlots = freeSlots
@@ -425,7 +426,7 @@ def addExecutor(self, eId, eTypes, maxTasks=1):
425
426
self .__fillExecutors (eType )
426
427
427
428
def removeExecutor (self , eId ):
428
- self .__log .verbose ("Removing executor %s" % eId )
429
+ self .__log .info ("Removing executor %s" % eId )
429
430
self .__executorsLock .acquire ()
430
431
try :
431
432
if eId not in self .__idMap :
@@ -439,8 +440,8 @@ def removeExecutor(self, eId):
439
440
eTask = self .__tasks [taskId ]
440
441
except KeyError :
441
442
# Task already removed
442
- pass
443
- if eTask .eType :
443
+ eTask = None
444
+ if eTask and eTask .eType :
444
445
self .__queues .pushTask (eTask .eType , taskId , ahead = True )
445
446
else :
446
447
self .__dispatchTask (taskId )
@@ -844,6 +845,8 @@ def __msgTaskToExecutor(self, taskId, eId, eType):
844
845
errMsg = "Send task callback did not send back an S_OK/S_ERROR structure"
845
846
self .__log .fatal (errMsg )
846
847
raise ValueError (errMsg )
848
+ if not result ["OK" ]:
849
+ self .__log .error ("Failed to cbSendTask" , "%r" % result )
847
850
848
851
849
852
class UnrecoverableTaskException (Exception ):
0 commit comments