Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add flag --no-skip-on-failure for command build, run, retry, seed #9020

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20231107-132842.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: add flag --no-skip-on-failure
time: 2023-11-07T13:28:42.420727773+01:00
custom:
Author: leo-schick
Issue: "2142"
5 changes: 5 additions & 0 deletions core/dbt/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def cli(ctx, **kwargs):
@p.export_saved_queries
@p.full_refresh
@p.deprecated_include_saved_query
@p.no_skip_on_failure
@p.profiles_dir
@p.project_dir
@p.resource_type
Expand Down Expand Up @@ -541,6 +542,7 @@ def parse(ctx, **kwargs):
@global_flags
@p.exclude
@p.full_refresh
@p.no_skip_on_failure
@p.profiles_dir
@p.project_dir
@p.empty
Expand Down Expand Up @@ -578,6 +580,7 @@ def run(ctx, **kwargs):
@p.profiles_dir
@p.vars
@p.target_path
@p.no_skip_on_failure
@p.threads
@p.full_refresh
@requires.postflight
Expand Down Expand Up @@ -606,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
Expand Down Expand Up @@ -674,6 +678,7 @@ def run_operation(ctx, **kwargs):
@global_flags
@p.exclude
@p.full_refresh
@p.no_skip_on_failure
@p.profiles_dir
@p.project_dir
@p.select
Expand Down
7 changes: 7 additions & 0 deletions core/dbt/cli/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@
help="Stop execution on first failure.",
)

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,
)

favor_state = click.option(
"--favor-state/--no-favor-state",
envvar="DBT_FAVOR_STATE",
Expand Down
1 change: 1 addition & 0 deletions core/dbt/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def get_flag_dict():
"log_format",
"version_check",
"fail_fast",
"no_skip_on_failure",
"send_anonymous_usage_stats",
"printer_width",
"indirect_selection",
Expand Down
6 changes: 4 additions & 2 deletions core/dbt/task/runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,10 @@
) -> 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_failure = get_flags().NO_SKIP_ON_FAILURE
if not no_skip_on_failure:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm thinking about this right, it would also have the effect for dbt build of not skipping downstream models if an upstream test fails. That doesn't feel desirable as a global effect.

for dep_node_id in self.graph.get_dependent_nodes(UniqueId(node_id)):
self._skipped_children[dep_node_id] = cause

Check warning on line 456 in core/dbt/task/runnable.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/runnable.py#L453-L456

Added lines #L453 - L456 were not covered by tests

def populate_adapter_cache(
self, adapter, required_schemas: Optional[Set[BaseRelation]] = None
Expand Down
1 change: 1 addition & 0 deletions core/dbt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ def args_to_dict(args):
"debug",
"full_refresh",
"fail_fast",
"no_skip_on_failure",
"warn_error",
"single_threaded",
"log_cache_events",
Expand Down
Loading