Skip to content

Commit

Permalink
fix PARTSEG-J7
Browse files Browse the repository at this point in the history
  • Loading branch information
Czaki committed Apr 13, 2022
1 parent e44b74c commit c6b1574
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 4 additions & 2 deletions package/PartSeg/_roi_analysis/batch_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,14 @@ def task_selection_change(self, new, old):

def task_cancel_remove(self):
index = self.task_view.selectionModel().currentIndex()
task: CalculationProcessItem = self.task_que.item(index.row(), index.column())
task: CalculationProcessItem = typing.cast(
CalculationProcessItem, self.task_que.item(index.row(), index.column())
)
if task.is_finished():
self.calculation_manager.remove_calculation(task.calculation)
self.task_que.takeRow(index.row())
else:
self.calculation_manager.cancel_calculation(task.calculation)
self.task_que.takeRow(index.row())
print(task)

def new_task(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ def _change_process_num(self, process_diff):
self.join_all()

def cancel_work(self, global_parameters):
del self.calculation_dict[global_parameters.uuid]
with suppress(KeyError):
del self.calculation_dict[global_parameters.uuid]

def join_all(self):
logging.debug(f"Join begin {len(self.process_list)} {self.number_off_process}")
Expand All @@ -175,10 +176,10 @@ def join_all(self):
# FIXME self.number_off_alive_process, self.number_off_process negative values
if len(self.process_list) > self.number_off_process and len(self.process_list) > 0:
logging.info(
"Wait on process, time {}, {}, {}, {}".format(
time.time(), self.number_off_alive_process, len(self.process_list), self.number_off_process
)
f"Wait on process, time {time.time()}, {self.number_off_alive_process},"
f" {len(self.process_list)}, {self.number_off_process}"
)

Timer(1, self.join_all).start()

@property
Expand Down

0 comments on commit c6b1574

Please sign in to comment.