From 66e09dda5964f6561add3f77751321e93beed643 Mon Sep 17 00:00:00 2001 From: tmaeno Date: Wed, 25 Nov 2026 20:23:51 +0100 Subject: [PATCH] Pass an exhausted parent on in getFinalTaskStatus's partial parent check With all input files processed and the partial parent check, the task now becomes exhausted when its parent is exhausted, and done otherwise. The parent is read on both sides of the flag now, so checkParent is renamed to full_parent_check. The three callers that compare the partial result with "done" keep their code. When the parent is exhausted, doPreCheck now gives the "task was incomplete" error dialog, and merge tasks no longer extend the lifetime of the parent's transient outputs. --- .../jedipprocess/AtlasProdPostProcessor.py | 7 +++++-- pandajedi/jedipprocess/PostProcessorBase.py | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/pandajedi/jedipprocess/AtlasProdPostProcessor.py b/pandajedi/jedipprocess/AtlasProdPostProcessor.py index ed9822ff7..44c3d45ed 100644 --- a/pandajedi/jedipprocess/AtlasProdPostProcessor.py +++ b/pandajedi/jedipprocess/AtlasProdPostProcessor.py @@ -178,10 +178,13 @@ def doFinalProcedure(self, taskSpec: JediTaskSpec, tmpLog: MsgWrapper) -> Intera # set extended lifetime on parent transient datasets for completed merge tasks if taskSpec.processingType in ["merge"] and ( taskSpec.status == "done" - or (taskSpec.status == "finished" and self.getFinalTaskStatus(taskSpec, checkParent=False) == "done") + or (taskSpec.status == "finished" and self.getFinalTaskStatus(taskSpec, full_parent_check=False) == "done") or ( taskSpec.status == "paused" - and (taskSpec.oldStatus == "done" or (taskSpec.oldStatus == "finished" and self.getFinalTaskStatus(taskSpec, checkParent=False) == "done")) + and ( + taskSpec.oldStatus == "done" + or (taskSpec.oldStatus == "finished" and self.getFinalTaskStatus(taskSpec, full_parent_check=False) == "done") + ) ) ): if taskSpec.parent_tid not in [None, taskSpec.jediTaskID]: diff --git a/pandajedi/jedipprocess/PostProcessorBase.py b/pandajedi/jedipprocess/PostProcessorBase.py index 68b4fb192..efb9978f9 100644 --- a/pandajedi/jedipprocess/PostProcessorBase.py +++ b/pandajedi/jedipprocess/PostProcessorBase.py @@ -207,13 +207,15 @@ def isTaskGoalReached(self, taskSpec: JediTaskSpec) -> bool: return taskCompleteness >= taskSpec.goal # get final task status - def getFinalTaskStatus(self, taskSpec: JediTaskSpec, checkParent: bool = True, update_error_dialog: bool = False) -> str: + def getFinalTaskStatus(self, taskSpec: JediTaskSpec, full_parent_check: bool = True, update_error_dialog: bool = False) -> str: """ Get final task status based on the number of files and events, and the status of parent task if needed. Args: - taskSpec: the task specification object - - checkParent: if True, check the status of parent task and set failed if the parent task is failed, broken, or aborted. If False, ignore the parent status. + - full_parent_check: how the parent task status is used when all input files are processed. + If True, set failed if the parent task is failed, broken, or aborted, and finished if the parent task is not done or the master input is mutable. + If False, set exhausted if the parent task is exhausted, and done otherwise. - update_error_dialog: if True, update error dialog for failed tasks """ @@ -232,9 +234,15 @@ def getFinalTaskStatus(self, taskSpec: JediTaskSpec, checkParent: bool = True, u taskSpec.setErrDiag("failed due to no input", True) elif nFiles == nFilesFinished: # check parent status - if checkParent and taskSpec.parent_tid not in [None, taskSpec.jediTaskID]: + if taskSpec.parent_tid not in [None, taskSpec.jediTaskID]: parent_status = self.taskBufferIF.getTaskStatus_JEDI(taskSpec.parent_tid) - if parent_status in ["failed", "broken", "aborted"]: + if not full_parent_check: + # only an exhausted parent is passed on + if parent_status == "exhausted": + status = "exhausted" + else: + status = "done" + elif parent_status in ["failed", "broken", "aborted"]: status = "failed" if update_error_dialog: taskSpec.setErrDiag(f"failed since the parent task is {parent_status} although all files were processed", True) @@ -292,7 +300,7 @@ def doPreCheck(self, taskSpec: JediTaskSpec, tmpLog: MsgWrapper) -> bool: and not self.isTaskGoalReached(taskSpec) ): taskSpec.status = "exhausted" - if self.getFinalTaskStatus(taskSpec, checkParent=False) == "done": + if self.getFinalTaskStatus(taskSpec, full_parent_check=False) == "done": taskSpec.errorDialog = "exhausted since the parent task was incomplete and didn't reach the goal" else: taskSpec.errorDialog = "exhausted since the task was incomplete and didn't reach the goal"