From 2bd7a6b7e6372583406d91a468a0041cc99b8925 Mon Sep 17 00:00:00 2001 From: peterkeppert <30529458+peterkeppert@users.noreply.github.com> Date: Wed, 20 Nov 2024 19:19:43 +0100 Subject: [PATCH] fix task status evaluation (#96) Co-authored-by: ANASOFT\keppert --- src/schema/task_data.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/schema/task_data.py b/src/schema/task_data.py index 1adbe70..818cf81 100644 --- a/src/schema/task_data.py +++ b/src/schema/task_data.py @@ -61,13 +61,14 @@ def add_and_draw_task_data(self, task_data: TaskData) -> None: # Status label always shows the last newly started task status.update(label=f"""Task: {task_data.name}""") self.current_task_data[task_data.run_id] = task_data + if all(entry.completed() for entry in self.current_task_data.values()): + # Status is "error" if any task has errored + if any(entry.completed_with_error() for entry in self.current_task_data.values()): + state = "error" + # Status is "complete" if all tasks have completed successfully + else: + state = "complete" # Status is "running" until all tasks have completed - if not any(entry.completed() for entry in self.current_task_data.values()): - state = "running" - # Status is "error" if any task has errored - elif any(entry.completed_with_error() for entry in self.current_task_data.values()): - state = "error" - # Status is "complete" if all tasks have completed successfully else: - state = "complete" + state = "running" status.update(state=state)