From fac4dcf22bb163bedda91533dc00c69fad4b77e5 Mon Sep 17 00:00:00 2001 From: Michael Thornton Date: Tue, 26 Nov 2024 15:00:03 -0800 Subject: [PATCH] docstring for get_finished_jobs --- nmdc_automation/workflow_automation/watch_nmdc.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/nmdc_automation/workflow_automation/watch_nmdc.py b/nmdc_automation/workflow_automation/watch_nmdc.py index 1b22f6c9..a71472e6 100644 --- a/nmdc_automation/workflow_automation/watch_nmdc.py +++ b/nmdc_automation/workflow_automation/watch_nmdc.py @@ -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: @@ -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