Skip to content

Commit

Permalink
add flag --no-skip-on-failture for command build, run, retry, seed
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-schick committed Jan 15, 2024
1 parent a1f78a8 commit 362da1c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
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-failture
time: 2023-11-07T13:28:42.420727773+01:00
custom:
Author: leo-schick
Issue: "2142"
4 changes: 4 additions & 0 deletions core/dbt/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def cli(ctx, **kwargs):
@p.full_refresh
@p.include_saved_query
@p.indirect_selection
@p.no_skip_on_failture
@p.profile
@p.profiles_dir
@p.project_dir
Expand Down Expand Up @@ -588,6 +589,7 @@ def parse(ctx, **kwargs):
@p.deprecated_favor_state
@p.exclude
@p.full_refresh
@p.no_skip_on_failture
@p.profile
@p.profiles_dir
@p.project_dir
Expand Down Expand Up @@ -627,6 +629,7 @@ def run(ctx, **kwargs):
@p.project_dir
@p.profiles_dir
@p.vars
@p.no_skip_on_failture
@p.profile
@p.target
@p.state
Expand Down Expand Up @@ -725,6 +728,7 @@ def run_operation(ctx, **kwargs):
@global_flags
@p.exclude
@p.full_refresh
@p.no_skip_on_failture
@p.profile
@p.profiles_dir
@p.project_dir
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 @@ -112,6 +112,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",
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_failture",
"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 @@ -391,8 +391,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

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

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/runnable.py#L394-L397

Added lines #L394 - L397 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_failture",
"warn_error",
"single_threaded",
"log_cache_events",
Expand Down

0 comments on commit 362da1c

Please sign in to comment.