Browse Source

Events State: Unknown task events are now handled by setting the state to the uppercase last portion of the event type

Ask Solem 14 years ago
parent
commit
aa11892e62
1 changed files with 5 additions and 0 deletions
  1. 5 0
      celery/events/state.py

+ 5 - 0
celery/events/state.py

@@ -146,6 +146,9 @@ class Task(Element):
         self.revoked = timestamp
         self.revoked = timestamp
         self.update(states.REVOKED, timestamp, fields)
         self.update(states.REVOKED, timestamp, fields)
 
 
+    def on_unknown_event(self, type, timestamp=None, **fields):
+        self.update(type.upper(), timestamp, fields)
+
     def info(self, fields=None, extra=[]):
     def info(self, fields=None, extra=[]):
         """Information about this task suitable for on-screen display."""
         """Information about this task suitable for on-screen display."""
         if fields is None:
         if fields is None:
@@ -245,6 +248,8 @@ class State(object):
             self.task_count += 1
             self.task_count += 1
         if handler:
         if handler:
             handler(**fields)
             handler(**fields)
+        else:
+            task.on_unknown_event(type, **fields)
         task.worker = worker
         task.worker = worker
 
 
     def event(self, event):
     def event(self, event):