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
2 changes: 1 addition & 1 deletion pandaserver/api/v1/task_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def retry(
clean_id = clean_user_id(user)
for job_id in job_ids:
global_task_buffer.finalizePendingJobs(clean_id, job_id)
global_task_buffer.increaseAttemptNrPanda(task_id, 5)
global_task_buffer.increaseAttemptNrPanda(task_id, 3, only_exhausted=True)
return_str = f"retry has been triggered for failed jobs while the task is still {ret[1]}"
if not new_parameters:
ret = 0, return_str
Expand Down
26 changes: 14 additions & 12 deletions pandaserver/taskbuffer/db_proxy_mods/misc_standalone_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,10 +744,11 @@ def updateTaskErrorDialogJEDI(self, jediTaskID: int, msg: str) -> bool:
return False

# increase attempt number for unprocessed files
def increaseAttemptNrPanda(self, jediTaskID: int, increasedNr: int) -> tuple[int | None, str]:
# only_exhausted=True leaves files that still have attempts left untouched, and only reactivates exhausted files
def increaseAttemptNrPanda(self, jediTaskID: int, increasedNr: int, only_exhausted: bool = False) -> tuple[int | None, str]:
comment = " /* DBProxy.increaseAttemptNrPanda */"
tmp_log = self.create_tagged_logger(comment, f"jediTaskID={jediTaskID}")
tmp_log.debug(f"increasedNr={increasedNr}")
tmp_log.debug(f"increasedNr={increasedNr} only_exhausted={only_exhausted}")
try:
# sql to check task status
sqlT = f"SELECT status,oldStatus FROM {panda_config.schemaJEDI}.JEDI_Tasks WHERE jediTaskID=:jediTaskID FOR UPDATE "
Expand Down Expand Up @@ -813,16 +814,17 @@ def increaseAttemptNrPanda(self, jediTaskID: int, increasedNr: int) -> tuple[int
}
nFilesIncreased = 0
nFilesReset = 0
# still active and maxFailure is undefined
sqlA = sqlAB + "AND maxAttempt>attemptNr AND maxFailure IS NULL "
self.cur.execute(sqlA + comment, varMap)
nRow = self.cur.rowcount
nFilesIncreased += nRow
# still active and maxFailure is defined
sqlA = sqlAF + "AND maxAttempt>attemptNr AND (maxFailure IS NOT NULL AND maxFailure>failedAttempt) "
self.cur.execute(sqlA + comment, varMap)
nRow = self.cur.rowcount
nFilesIncreased += nRow
if not only_exhausted:
# still active and maxFailure is undefined
sqlA = sqlAB + "AND maxAttempt>attemptNr AND maxFailure IS NULL "
self.cur.execute(sqlA + comment, varMap)
nRow = self.cur.rowcount
nFilesIncreased += nRow
# still active and maxFailure is defined
sqlA = sqlAF + "AND maxAttempt>attemptNr AND (maxFailure IS NOT NULL AND maxFailure>failedAttempt) "
self.cur.execute(sqlA + comment, varMap)
nRow = self.cur.rowcount
nFilesIncreased += nRow
# already done and maxFailure is undefined
sqlA = sqlAB + "AND maxAttempt<=attemptNr AND maxFailure IS NULL "
self.cur.execute(sqlA + comment, varMap)
Expand Down
Loading