Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pandajedi/jedipprocess/AtlasProdPostProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
18 changes: 13 additions & 5 deletions pandajedi/jedipprocess/PostProcessorBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

"""
Expand All @@ -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)
Expand Down Expand Up @@ -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"
Expand Down