Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix cache filter
  • Loading branch information
gshank committed Mar 19, 2023
commit 03f1c006cc56ffa536ae64d93d8c39c3f2583054
5 changes: 0 additions & 5 deletions core/dbt/events/base_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #


class Cache:
# Events with this class will only be logged when the `--log-cache-events` flag is passed
pass


def get_global_metadata_vars() -> dict:
from dbt.events.functions import get_metadata_vars

Expand Down
12 changes: 8 additions & 4 deletions core/dbt/events/functions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dbt.constants import METADATA_ENV_PREFIX
from dbt.events.base_types import BaseEvent, Cache, EventLevel, NoFile, NoStdOut, EventMsg
from dbt.events.base_types import BaseEvent, EventLevel, NoFile, NoStdOut, EventMsg
from dbt.events.eventmgr import EventManager, LoggerConfig, LineFormat, NoFilter
from dbt.events.helpers import env_secrets, scrub_secrets
from dbt.events.types import Formatting
Expand Down Expand Up @@ -106,7 +106,7 @@ def _stdout_filter(
) -> bool:
return (
not isinstance(msg.data, NoStdOut)
and (not isinstance(msg.data, Cache) or log_cache_events)
and (msg.info.name not in ["CacheAction", "CacheDumpGraph"] or log_cache_events)
and (EventLevel(msg.info.level) != EventLevel.DEBUG or debug_mode)
and (EventLevel(msg.info.level) == EventLevel.ERROR or not quiet_mode)
and not (line_format == LineFormat.Json and type(msg.data) == Formatting)
Expand All @@ -130,7 +130,7 @@ def _get_logfile_config(
def _logfile_filter(log_cache_events: bool, line_format: LineFormat, msg: EventMsg) -> bool:
return (
not isinstance(msg.data, NoFile)
and not (isinstance(msg.data, Cache) and not log_cache_events)
and not (msg.info.name in ["CacheAction", "CacheDumpGraph"] and not log_cache_events)
and not (line_format == LineFormat.Json and type(msg.data) == Formatting)
)

Expand All @@ -147,7 +147,11 @@ def _get_logbook_log_config(
quiet,
)
config.name = "logbook_log"
config.filter = NoFilter if log_cache_events else lambda e: not isinstance(e.data, Cache)
config.filter = (
NoFilter
if log_cache_events
else lambda e: e.info.name not in ["CacheAction", "CacheDumpGraph"]
)
config.logger = GLOBAL_LOGGER
config.output_stream = None
return config
Expand Down
5 changes: 2 additions & 3 deletions core/dbt/events/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
InfoLevel,
WarnLevel,
ErrorLevel,
Cache,
EventLevel,
)
from dbt.events.format import format_fancy_output_line, pluralize
Expand Down Expand Up @@ -555,7 +554,7 @@ def message(self) -> str:
return f'Dropping schema "{self.relation}".'


class CacheAction(DebugLevel, Cache):
class CacheAction(DebugLevel):
def code(self):
return "E022"

Expand Down Expand Up @@ -592,7 +591,7 @@ def message(self):
# Skipping E023, E024, E025, E026, E027, E028, E029, E030


class CacheDumpGraph(DebugLevel, Cache):
class CacheDumpGraph(DebugLevel):
def code(self):
return "E031"

Expand Down