Skip to content

Commit

Permalink
not none
Browse files Browse the repository at this point in the history
  • Loading branch information
bra-fsn committed Oct 5, 2024
1 parent c5cfd04 commit 2030afa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inspector/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
TASK_HASH_KEYS = {"command", "transform_output", "image"}
# don't start task if it has already been started less than 2 hours ago
WAIT_SINCE_LAST_START = timedelta(hours=2)
# fail if a job has already started, but didn't produce output for 2 days
# fail if a job has already started, but didn't produce output
FAIL_IF_NO_OUTPUT = timedelta(days=365)
FAIL_ON_ERROR = timedelta(days=7)
# destroy the instance 15 mins after the last task has timed out
Expand Down Expand Up @@ -208,7 +208,7 @@ def should_start(task: Task, data_dir: str | os.PathLike, srv) -> bool:
if meta.start:
if (datetime.now() - meta.start) >= FAIL_IF_NO_OUTPUT and (meta.end is None or meta.exit_code is None):
raise RuntimeError(f"{task.name} was started at {meta.start}, but didn't produce output!")
if (datetime.now() - meta.start) >= FAIL_ON_ERROR and meta.exit_code > 0:
if (datetime.now() - meta.start) >= FAIL_ON_ERROR and meta.exit_code is not None and meta.exit_code > 0:
raise RuntimeError(f"{task.name} was last started at {meta.start} and failed!")
if meta.end and task.rerun and (datetime.now() - meta.end) >= task.rerun and meta.exit_code == 0:
# if rerun is set and there's a successful run, run the task again if rerun time interval has passed
Expand Down

0 comments on commit 2030afa

Please sign in to comment.