Advertisement
Guest User

2014-05-06, TSergey, sae patch

a guest
May 5th, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. diff -r e10cf60ddb6a sa/sae/sae.py
  2. --- a/sa/sae/sae.py Sun May 04 17:08:21 2014 +0400
  3. +++ b/sa/sae/sae.py Mon May 05 09:08:21 2014 +0400
  4. @@ -24,7 +24,7 @@
  5. ## NOC modules
  6. from noc.sa.sae.service import Service
  7. from noc.sa.sae.sae_socket import SAESocket
  8. -from noc.sa.models import (Activator, ManagedObject, MapTask,
  9. +from noc.sa.models import (Activator, ManagedObject, MapTask, ReduceTask,
  10. script_registry, profile_registry,
  11. ActivatorCapabilitiesCache, FailedScriptLog)
  12. from noc.fm.models import NewEvent
  13. @@ -480,8 +480,14 @@
  14. managed_object__activator__shard__is_active=True,
  15. managed_object__activator__shard__name__in=self.shards
  16. ).select_related().select_for_update():
  17. + # Check reduce task still valid
  18. + is_valid_reduce = True
  19. + try:
  20. + mt.task
  21. + except ReduceTask.DoesNotExist:
  22. + is_valid_reduce = False
  23. # Check for task timeouts
  24. - if mt.task.stop_time < t:
  25. + if mt.task.stop_time < t or not is_valid_reduce:
  26. mt.status = "F"
  27. mt.script_result = dict(code=ERR_TIMEOUT, text="Timed out")
  28. try:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement