Skip to content

Commit

Permalink
replace logger.warning with warn_or_error
Browse files Browse the repository at this point in the history
Uses `warn_or_error` to log _or_ raise errors depending on arguments
passed.
  • Loading branch information
Jesse Lax committed Oct 7, 2021
1 parent b501f43 commit 84ebad6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions core/dbt/task/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from dbt.task.runnable import GraphRunnableTask, ManifestTask
from dbt.task.test import TestSelector
from dbt.node_types import NodeType
from dbt.exceptions import RuntimeException, InternalException
from dbt.logger import log_manager, GLOBAL_LOGGER as logger
from dbt.exceptions import RuntimeException, InternalException, warn_or_error
from dbt.logger import log_manager


class ListTask(GraphRunnableTask):
Expand Down Expand Up @@ -61,7 +61,7 @@ def _iterate_selected_nodes(self):
spec = self.get_selection_spec()
nodes = sorted(selector.get_selected(spec))
if not nodes:
logger.warning('No nodes selected!')
warn_or_error('No nodes selected!')
return
if self.manifest is None:
raise InternalException(
Expand Down
5 changes: 3 additions & 2 deletions core/dbt/task/runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
NotImplementedException,
RuntimeException,
FailFastException,
warn_or_error,
)

from dbt.graph import (
Expand Down Expand Up @@ -438,8 +439,8 @@ def run(self):
)

if len(self._flattened_nodes) == 0:
logger.warning("\nWARNING: Nothing to do. Try checking your model "
"configs and model specification args")
warn_or_error("\nWARNING: Nothing to do. Try checking your model "
"configs and model specification args")
result = self.get_result(
results=[],
generated_at=datetime.utcnow(),
Expand Down

0 comments on commit 84ebad6

Please sign in to comment.