Skip to content

Commit

Permalink
SAYN properly skips all tasks after the first instance of failure
Browse files Browse the repository at this point in the history
  • Loading branch information
hustic committed Dec 14, 2023
1 parent 70c25c1 commit a85b344
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sayn/core/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,11 +612,15 @@ def execute_dag(self):
self.tracker.start_stage(
self.run_arguments.command.value, tasks=list(tasks_in_query.keys())
)
interrupt_flag = False

for task in self.tasks.values():
if not task.in_query:
continue

if interrupt_flag:
task.is_interrupted = True

# We force the run/compile so that the skipped status can be calculated,
# but we only report if the task is in the query
# if task.in_query:
Expand All @@ -638,7 +642,7 @@ def execute_dag(self):
)

if self.run_arguments.interrupt and result.is_err:
self.check_abort(result)
interrupt_flag = True

self.tracker.finish_current_stage(
tasks={k: v.status for k, v in tasks_in_query.items()},
Expand Down
3 changes: 3 additions & 0 deletions sayn/logging/fancy_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def task_stage_finish(self, stage, duration, result):
if result.error.code == "parent_errors":
self.spinner.text_color = "yellow"
self.spinner.warn()
if result.error.code == "interrupted":
self.spinner.text_color = "yellow"
self.spinner.warn()
elif (
result.error.code == "setup_error"
and result.error.details["status"].value == "skipped"
Expand Down
4 changes: 4 additions & 0 deletions sayn/logging/log_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ def error_result(self, duration, error): # noqa: C901
f"Skipping due to ancestors errors: {parents} ({duration})"
)

elif error.code == "interrupted":
level = "warning"
message = self.warn(f"Skipping due to Interrupt signal ({duration})")

elif error.code == "setup_error":
if error.details["status"].value == "skipped":
level = "warning"
Expand Down
5 changes: 5 additions & 0 deletions sayn/tasks/task_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def __init__(
self.used_connections = set()
self.tracker = tracker
self.runner = None
self.is_interrupted = False

self.name = name
self.group = group
Expand Down Expand Up @@ -266,6 +267,10 @@ def set_parameters(
self.compiler.update_globals(**task_parameters)

def check_skip(self):
if self.is_interrupted:
self.status = TaskStatus.SKIPPED
return Err("task", "interrupted")

if self.run_arguments["command"] != "test":
failed_parents = {
p.name: p.status
Expand Down

0 comments on commit a85b344

Please sign in to comment.