diff --git a/sayn/core/app.py b/sayn/core/app.py index 1e43c453..6f768cdd 100644 --- a/sayn/core/app.py +++ b/sayn/core/app.py @@ -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: @@ -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()}, diff --git a/sayn/logging/fancy_logger.py b/sayn/logging/fancy_logger.py index 368d2a19..95b8c7a9 100644 --- a/sayn/logging/fancy_logger.py +++ b/sayn/logging/fancy_logger.py @@ -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" diff --git a/sayn/logging/log_formatter.py b/sayn/logging/log_formatter.py index 4dd9861d..0828cb68 100644 --- a/sayn/logging/log_formatter.py +++ b/sayn/logging/log_formatter.py @@ -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" diff --git a/sayn/tasks/task_wrapper.py b/sayn/tasks/task_wrapper.py index efa7a0e5..da4eb113 100644 --- a/sayn/tasks/task_wrapper.py +++ b/sayn/tasks/task_wrapper.py @@ -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 @@ -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