Skip to content

Commit

Permalink
mgr/dashboard: tasks: only unblock controller thread after TaskManage…
Browse files Browse the repository at this point in the history
…r thread

Fixes: https://tracker.ceph.com/issues/42187

Signed-off-by: Ricardo Dias <[email protected]>
  • Loading branch information
rjfd committed Oct 7, 2019
1 parent 20c8007 commit f6dd9a9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/pybind/mgr/dashboard/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ def __repr__(self):
return str(self)

def _run(self):
NotificationQueue.register(self._handle_task_finished, 'cd_task_finished', 100)
with self.lock:
assert not self.running
self.executor.init(self)
Expand All @@ -610,10 +611,14 @@ def _complete(self, ret_value, exception=None):
if not self.exception:
self.set_progress(100, True)
NotificationQueue.new_notification('cd_task_finished', self)
self.event.set()
logger.debug("TK: execution of %s finished in: %s s", self,
self.duration)

def _handle_task_finished(self, task):
if self == task:
NotificationQueue.deregister(self._handle_task_finished)
self.event.set()

def wait(self, timeout=None):
with self.lock:
assert self.running, "wait cannot be called before _run"
Expand Down

0 comments on commit f6dd9a9

Please sign in to comment.