Skip to content

Commit

Permalink
Fix celery issues when using flower REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
Thierry RAMORASOAVINA authored and thedrow committed Apr 13, 2017
1 parent cb17ab2 commit f521385
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions celery/events/state.py
Expand Up @@ -296,7 +296,7 @@ def __init__(self, uuid=None, cluster_state=None, children=None, **kwargs):
self.children = WeakSet(
self.cluster_state.tasks.get(task_id)
for task_id in children or ()
if task_id in self.cluster_state.tasks
if self.cluster_state is not None and task_id in self.cluster_state.tasks
)
self._serializer_handlers = {
'children': self._serializable_children,
Expand Down Expand Up @@ -384,11 +384,19 @@ def ready(self):

@cached_property
def parent(self):
return self.parent_id and self.cluster_state.tasks[self.parent_id]
# issue github.com/mher/flower/issues/648
try:
return self.parent_id and self.cluster_state.tasks[self.parent_id]
except KeyError:
return None

@cached_property
def root(self):
return self.root_id and self.cluster_state.tasks[self.root_id]
# issue github.com/mher/flower/issues/648
try:
return self.root_id and self.cluster_state.tasks[self.root_id]
except KeyError:
return None


class State(object):
Expand Down

0 comments on commit f521385

Please sign in to comment.