Skip to content

Commit

Permalink
docstring for get_finished_jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
mbthornton-lbl committed Nov 26, 2024
1 parent 4981e9b commit fac4dcf
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions nmdc_automation/workflow_automation/watch_nmdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,15 @@ def prepare_and_cache_new_job(self, new_job: WorkflowJob, opid: str, force=False
return new_job

def get_finished_jobs(self)->Tuple[List[WorkflowJob], List[WorkflowJob]]:
""" Get finished jobs """
"""
Get finished jobs
Returns a tuple of successful jobs and failed jobs
Jobs are considered finished if they have a last status of "Succeeded" or "Failed"
or if they have reached the maximum number of failures
Unfinished jobs are checked for status and updated if needed.
A checkpoint is saved after checking for finished jobs.
"""
successful_jobs = []
failed_jobs = []
for job in self.job_cache:
Expand All @@ -193,7 +201,6 @@ def get_finished_jobs(self)->Tuple[List[WorkflowJob], List[WorkflowJob]]:
successful_jobs.append(job)
continue
if job.workflow.last_status == "Failed" and job.workflow.failed_count >= self._MAX_FAILS:
job.done = True
failed_jobs.append(job)
continue
# check status
Expand Down

0 comments on commit fac4dcf

Please sign in to comment.