Skip to content

Commit

Permalink
owlouvainclustering: Delete task state after completion
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-erjavec committed Oct 22, 2018
1 parent a3a5bfb commit 31bccbd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Orange/widgets/unsupervised/owlouvainclustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def commit(self):
louvain = Louvain()
self.preprocessed_data = louvain.preprocess(self.data)

state = TaskState()
state = TaskState(self)

# Prepare/assemble the task(s) to run; reuse partial results
if self.apply_pca:
Expand Down Expand Up @@ -269,6 +269,8 @@ def __on_done(self, future):
assert self.__task is not None
assert self.__task.future is future
assert self.__task.watcher.future() is future
self.__task.deleteLater()
self.__task.setParent(None)
self.__task = None
self.__set_state_ready()
try:
Expand Down Expand Up @@ -315,11 +317,12 @@ def __cancel_task(self, wait=True):
state.status_changed.disconnect(self.setStatusMessage)
state.progress_changed.disconnect(self.progressBarSet)
state.watcher.done.disconnect(self.__on_done)
if state.parent() is self:
state.setParent(None)

if wait and state.future is not None:
futures.wait([state.future])
state.deleteLater()
elif state.future is not None:
w = FutureWatcher(state.future, parent=state)
w.done.connect(state.deleteLater)

def __set_results(self, results):
# type: ('Results') -> None
Expand Down

0 comments on commit 31bccbd

Please sign in to comment.