From d816c85184e884b60992ace923d005238af11cd7 Mon Sep 17 00:00:00 2001 From: Leo Schick Date: Tue, 7 Nov 2023 13:24:23 +0100 Subject: [PATCH 1/4] add flag --no-skip-on-failture for command build, run, retry, seed --- .changes/unreleased/Features-20231107-132842.yaml | 6 ++++++ core/dbt/cli/main.py | 4 ++++ core/dbt/cli/params.py | 7 +++++++ core/dbt/flags.py | 1 + core/dbt/task/runnable.py | 6 ++++-- core/dbt/utils.py | 1 + 6 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 .changes/unreleased/Features-20231107-132842.yaml diff --git a/.changes/unreleased/Features-20231107-132842.yaml b/.changes/unreleased/Features-20231107-132842.yaml new file mode 100644 index 00000000000..a29049457e4 --- /dev/null +++ b/.changes/unreleased/Features-20231107-132842.yaml @@ -0,0 +1,6 @@ +kind: Features +body: add flag --no-skip-on-failture +time: 2023-11-07T13:28:42.420727773+01:00 +custom: + Author: leo-schick + Issue: "2142" diff --git a/core/dbt/cli/main.py b/core/dbt/cli/main.py index deff7d8d341..469573fbdc0 100644 --- a/core/dbt/cli/main.py +++ b/core/dbt/cli/main.py @@ -174,6 +174,7 @@ def cli(ctx, **kwargs): @p.export_saved_queries @p.full_refresh @p.deprecated_include_saved_query +@p.no_skip_on_failture @p.profiles_dir @p.project_dir @p.resource_type @@ -541,6 +542,7 @@ def parse(ctx, **kwargs): @global_flags @p.exclude @p.full_refresh +@p.no_skip_on_failture @p.profiles_dir @p.project_dir @p.empty @@ -578,6 +580,7 @@ def run(ctx, **kwargs): @p.profiles_dir @p.vars @p.target_path +@p.no_skip_on_failture @p.threads @p.full_refresh @requires.postflight @@ -674,6 +677,7 @@ def run_operation(ctx, **kwargs): @global_flags @p.exclude @p.full_refresh +@p.no_skip_on_failture @p.profiles_dir @p.project_dir @p.select diff --git a/core/dbt/cli/params.py b/core/dbt/cli/params.py index b2716728ce6..ad6a2ea24b2 100644 --- a/core/dbt/cli/params.py +++ b/core/dbt/cli/params.py @@ -120,6 +120,13 @@ help="Stop execution on first failure.", ) +no_skip_on_failture = click.option( + "--no-skip-on-failture", + envvar="DBT_NO_SKIP_ON_FAILTURE", + help="If specified, dbt will proceed with downstream models even the dependent model failed.", + is_flag=True, +) + favor_state = click.option( "--favor-state/--no-favor-state", envvar="DBT_FAVOR_STATE", diff --git a/core/dbt/flags.py b/core/dbt/flags.py index 7deb8966013..8528701eec4 100644 --- a/core/dbt/flags.py +++ b/core/dbt/flags.py @@ -75,6 +75,7 @@ def get_flag_dict(): "log_format", "version_check", "fail_fast", + "no_skip_on_failture", "send_anonymous_usage_stats", "printer_width", "indirect_selection", diff --git a/core/dbt/task/runnable.py b/core/dbt/task/runnable.py index 746c08bf656..b0030fcbfd9 100644 --- a/core/dbt/task/runnable.py +++ b/core/dbt/task/runnable.py @@ -450,8 +450,10 @@ def _mark_dependent_errors( ) -> None: if self.graph is None: raise DbtInternalError("graph is None in _mark_dependent_errors") - for dep_node_id in self.graph.get_dependent_nodes(UniqueId(node_id)): - self._skipped_children[dep_node_id] = cause + no_skip_on_failture = get_flags().NO_SKIP_ON_FAILTURE + if not no_skip_on_failture: + for dep_node_id in self.graph.get_dependent_nodes(UniqueId(node_id)): + self._skipped_children[dep_node_id] = cause def populate_adapter_cache( self, adapter, required_schemas: Optional[Set[BaseRelation]] = None diff --git a/core/dbt/utils.py b/core/dbt/utils.py index 8f7509a5dec..5819c9e6aba 100644 --- a/core/dbt/utils.py +++ b/core/dbt/utils.py @@ -350,6 +350,7 @@ def args_to_dict(args): "debug", "full_refresh", "fail_fast", + "no_skip_on_failture", "warn_error", "single_threaded", "log_cache_events", From e295cdb028c467208e9fe0205d3d456d86b2b7ac Mon Sep 17 00:00:00 2001 From: Leo Schick <67712864+leo-schick@users.noreply.github.com> Date: Mon, 8 Apr 2024 20:51:53 +0200 Subject: [PATCH 2/4] Update core/dbt/cli/params.py Co-authored-by: Conrad Cartmell --- core/dbt/cli/params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/dbt/cli/params.py b/core/dbt/cli/params.py index ad6a2ea24b2..d48cf607879 100644 --- a/core/dbt/cli/params.py +++ b/core/dbt/cli/params.py @@ -123,7 +123,7 @@ no_skip_on_failture = click.option( "--no-skip-on-failture", envvar="DBT_NO_SKIP_ON_FAILTURE", - help="If specified, dbt will proceed with downstream models even the dependent model failed.", + help="Proceed with downstream nodes even if an upstream node fails.", is_flag=True, ) From f8c495d06e2de6fe2a7ca68182df3609c6b729b8 Mon Sep 17 00:00:00 2001 From: Leo Schick Date: Mon, 8 Apr 2024 20:05:40 +0200 Subject: [PATCH 3/4] typo --- .changes/unreleased/Features-20231107-132842.yaml | 2 +- core/dbt/cli/main.py | 8 ++++---- core/dbt/cli/params.py | 6 +++--- core/dbt/flags.py | 2 +- core/dbt/task/runnable.py | 4 ++-- core/dbt/utils.py | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.changes/unreleased/Features-20231107-132842.yaml b/.changes/unreleased/Features-20231107-132842.yaml index a29049457e4..d048f8a5c02 100644 --- a/.changes/unreleased/Features-20231107-132842.yaml +++ b/.changes/unreleased/Features-20231107-132842.yaml @@ -1,5 +1,5 @@ kind: Features -body: add flag --no-skip-on-failture +body: add flag --no-skip-on-failure time: 2023-11-07T13:28:42.420727773+01:00 custom: Author: leo-schick diff --git a/core/dbt/cli/main.py b/core/dbt/cli/main.py index 469573fbdc0..e31fcf65e17 100644 --- a/core/dbt/cli/main.py +++ b/core/dbt/cli/main.py @@ -174,7 +174,7 @@ def cli(ctx, **kwargs): @p.export_saved_queries @p.full_refresh @p.deprecated_include_saved_query -@p.no_skip_on_failture +@p.no_skip_on_failure @p.profiles_dir @p.project_dir @p.resource_type @@ -542,7 +542,7 @@ def parse(ctx, **kwargs): @global_flags @p.exclude @p.full_refresh -@p.no_skip_on_failture +@p.no_skip_on_failure @p.profiles_dir @p.project_dir @p.empty @@ -580,7 +580,7 @@ def run(ctx, **kwargs): @p.profiles_dir @p.vars @p.target_path -@p.no_skip_on_failture +@p.no_skip_on_failure @p.threads @p.full_refresh @requires.postflight @@ -677,7 +677,7 @@ def run_operation(ctx, **kwargs): @global_flags @p.exclude @p.full_refresh -@p.no_skip_on_failture +@p.no_skip_on_failure @p.profiles_dir @p.project_dir @p.select diff --git a/core/dbt/cli/params.py b/core/dbt/cli/params.py index d48cf607879..481c4e62699 100644 --- a/core/dbt/cli/params.py +++ b/core/dbt/cli/params.py @@ -120,9 +120,9 @@ help="Stop execution on first failure.", ) -no_skip_on_failture = click.option( - "--no-skip-on-failture", - envvar="DBT_NO_SKIP_ON_FAILTURE", +no_skip_on_failure = click.option( + "--no-skip-on-failure", + envvar="DBT_NO_SKIP_ON_FAILURE", help="Proceed with downstream nodes even if an upstream node fails.", is_flag=True, ) diff --git a/core/dbt/flags.py b/core/dbt/flags.py index 8528701eec4..1efd468e0b9 100644 --- a/core/dbt/flags.py +++ b/core/dbt/flags.py @@ -75,7 +75,7 @@ def get_flag_dict(): "log_format", "version_check", "fail_fast", - "no_skip_on_failture", + "no_skip_on_failure", "send_anonymous_usage_stats", "printer_width", "indirect_selection", diff --git a/core/dbt/task/runnable.py b/core/dbt/task/runnable.py index b0030fcbfd9..5aef459d4ed 100644 --- a/core/dbt/task/runnable.py +++ b/core/dbt/task/runnable.py @@ -450,8 +450,8 @@ def _mark_dependent_errors( ) -> None: if self.graph is None: raise DbtInternalError("graph is None in _mark_dependent_errors") - no_skip_on_failture = get_flags().NO_SKIP_ON_FAILTURE - if not no_skip_on_failture: + no_skip_on_failure = get_flags().NO_SKIP_ON_FAILURE + if not no_skip_on_failure: for dep_node_id in self.graph.get_dependent_nodes(UniqueId(node_id)): self._skipped_children[dep_node_id] = cause diff --git a/core/dbt/utils.py b/core/dbt/utils.py index 5819c9e6aba..a04420a878d 100644 --- a/core/dbt/utils.py +++ b/core/dbt/utils.py @@ -350,7 +350,7 @@ def args_to_dict(args): "debug", "full_refresh", "fail_fast", - "no_skip_on_failture", + "no_skip_on_failure", "warn_error", "single_threaded", "log_cache_events", From 3ec1e0363582c821b0e9fd09c1267cd0e4566d92 Mon Sep 17 00:00:00 2001 From: Leo Schick Date: Mon, 8 Apr 2024 20:07:59 +0200 Subject: [PATCH 4/4] add --no-skip-on-failure for command clone --- core/dbt/cli/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/core/dbt/cli/main.py b/core/dbt/cli/main.py index e31fcf65e17..da9ca5d8a85 100644 --- a/core/dbt/cli/main.py +++ b/core/dbt/cli/main.py @@ -609,6 +609,7 @@ def retry(ctx, **kwargs): @global_flags @p.exclude @p.full_refresh +@p.no_skip_on_failure @p.profiles_dir @p.project_dir @p.resource_type