##// END OF EJS Templates
don't perform costly 'difference_update' on dependencies...
MinRK -
Show More
@@ -223,7 +223,6 b' class TaskScheduler(SessionFactory):'
223 except KeyError:
223 except KeyError:
224 self.log.error("task::Invalid notification msg: %r"%msg)
224 self.log.error("task::Invalid notification msg: %r"%msg)
225
225
226 @logged
227 def _register_engine(self, uid):
226 def _register_engine(self, uid):
228 """New engine with ident `uid` became available."""
227 """New engine with ident `uid` became available."""
229 # head of the line:
228 # head of the line:
@@ -322,16 +321,20 b' class TaskScheduler(SessionFactory):'
322 self.retries[msg_id] = retries
321 self.retries[msg_id] = retries
323
322
324 # time dependencies
323 # time dependencies
325 after = Dependency(header.get('after', []))
324 after = header.get('after', None)
325 if after:
326 after = Dependency(after)
326 if after.all:
327 if after.all:
327 if after.success:
328 if after.success:
328 after.difference_update(self.all_completed)
329 after = after.difference(self.all_completed)
329 if after.failure:
330 if after.failure:
330 after.difference_update(self.all_failed)
331 after = after.difference(self.all_failed)
331 if after.check(self.all_completed, self.all_failed):
332 if after.check(self.all_completed, self.all_failed):
332 # recast as empty set, if `after` already met,
333 # recast as empty set, if `after` already met,
333 # to prevent unnecessary set comparisons
334 # to prevent unnecessary set comparisons
334 after = MET
335 after = MET
336 else:
337 after = MET
335
338
336 # location dependencies
339 # location dependencies
337 follow = Dependency(header.get('follow', []))
340 follow = Dependency(header.get('follow', []))
@@ -345,6 +348,8 b' class TaskScheduler(SessionFactory):'
345
348
346 # validate and reduce dependencies:
349 # validate and reduce dependencies:
347 for dep in after,follow:
350 for dep in after,follow:
351 if not dep: # empty dependency
352 continue
348 # check valid:
353 # check valid:
349 if msg_id in dep or dep.difference(self.all_ids):
354 if msg_id in dep or dep.difference(self.all_ids):
350 self.depending[msg_id] = args
355 self.depending[msg_id] = args
General Comments 0
You need to be logged in to leave comments. Login now