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 Nov 7, 2023
1 parent 6c1822f commit f88c041
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 @@ -188,6 +188,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 @@ -596,6 +597,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 @@ -634,6 +636,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 @@ -732,6 +735,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 @@ -113,6 +113,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 @@ -77,6 +77,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 @@ -396,8 +396,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 402 in core/dbt/task/runnable.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/runnable.py#L399-L402

Added lines #L399 - L402 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 @@ -649,6 +649,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 f88c041

Please sign in to comment.