Skip to content

Commit

Permalink
resolve restart of tasks with no tracebacks
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmkenney committed Aug 23, 2024
1 parent 5bb6700 commit fe4b87b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions alchemiscale/storage/statestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -2944,7 +2944,9 @@ def get_task_restart_patterns(
q, taskhub_scoped_keys=list(map(str, taskhubs))
).records

data = {taskhub: set() for taskhub in taskhubs}
data: dict[ScopedKey, set[tuple[str, int]]] = {
taskhub: set() for taskhub in taskhubs
}

for record in records:
pattern = record["trp"]["pattern"]
Expand Down Expand Up @@ -3000,11 +3002,15 @@ def resolve_task_restarts(self, task_scoped_keys: Iterable[ScopedKey], *, tx=Non
applies_relationship = record["app"]
task = record["task"]
taskhub = record["taskhub"]
# TODO: what happens if there is no traceback? i.e. older errored tasks
traceback = record["traceback"]

task_taskhub_tuple = (task["_scoped_key"], taskhub["_scoped_key"])

# TODO: remove in v1.0.0
# tasks that errored, prior to the indtroduction of task restart policies will have no tracebacks in the database
if traceback is None:
cancel_map[task_taskhub_tuple] = True

# we have already determined that the task is to be canceled
# is only ever truthy when we say a task needs to be canceled
if cancel_map[task_taskhub_tuple]:
Expand Down

0 comments on commit fe4b87b

Please sign in to comment.