Skip to content

Commit

Permalink
skip _sis_runnable check when already finished
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz committed Nov 29, 2024
1 parent c7fdbe4 commit 2412583
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions sisyphus/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import sys
import time
import traceback
from typing import List, Iterator, Type, TypeVar
from typing import List, Iterator, Type, TypeVar, Optional

from sisyphus import block, tools
from sisyphus.task import Task
Expand Down Expand Up @@ -472,7 +472,7 @@ def _sis_finished(self):
self._sis_is_finished = True
return True
else:
if self._sis_setup() and self._sis_runnable():
if self._sis_setup() and self._sis_runnable(return_when_finished=None):
# check all task if they are finished
for task in self._sis_tasks():
# job is only finished if all sub tasks are finished
Expand Down Expand Up @@ -684,8 +684,15 @@ def _sis_all_path_available(self):
return False
return True

def _sis_runnable(self):
def _sis_runnable(self, *, return_when_finished: Optional[bool] = True):
"""True if all inputs are available, also checks if new inputs are requested"""
if return_when_finished is not None:
# Avoid _sis_finished call due to potential recursive calls.
if not self._sis_is_finished and job_finished(self._sis_path()):
# Job is already marked as finished, skip check next time
self._sis_is_finished = True
if self._sis_is_finished:
return return_when_finished

if not self._sis_update_possible():
# Short cut used for most jobs
Expand Down

0 comments on commit 2412583

Please sign in to comment.