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

Fully remove legacy logger #9353

Merged
merged 5 commits into from
Jan 10, 2024
Merged
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/Dependencies-20240109-120530.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Dependencies
body: Remove logbook dependency
time: 2024-01-09T12:05:30.176656-06:00
custom:
Author: emmyoop
PR: "9353"
2 changes: 0 additions & 2 deletions core/dbt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

### links.py

### logger.py

### main.py

### node_types.py
Expand Down
1 change: 0 additions & 1 deletion core/dbt/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ def global_flags(func):
@p.cache_selected_only
@p.debug
@p.deprecated_print
@p.enable_legacy_logger
@p.fail_fast
@p.log_cache_events
@p.log_file_max_bytes
Expand Down
6 changes: 0 additions & 6 deletions core/dbt/cli/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@
is_flag=True,
)

enable_legacy_logger = click.option(
"--enable-legacy-logger/--no-enable-legacy-logger",
envvar="DBT_ENABLE_LEGACY_LOGGER",
hidden=True,
)

exclude = click.option(
"--exclude",
envvar=None,
Expand Down
1 change: 0 additions & 1 deletion core/dbt/cli/requires.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import dbt.tracking
from dbt_common.invocation import reset_invocation_id
from dbt.mp_context import get_mp_context
from dbt.version import installed as installed_version
from dbt.adapters.factory import adapter_management
from dbt.flags import set_flags, get_flag_dict
Expand Down
11 changes: 4 additions & 7 deletions core/dbt/contracts/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from dbt.events.types import TimingInfoCollected
from dbt_common.events.contextvars import get_node_info
from dbt_common.events.helpers import datetime_to_json_string
from dbt.logger import TimingProcessor
from dbt_common.utils.formatting import lowercase
from dbt_common.utils import cast_to_str, cast_to_int
from dbt_common.dataclass_schema import dbtClassMixin, StrEnum
Expand Down Expand Up @@ -73,13 +72,11 @@ def __enter__(self):
def __exit__(self, exc_type, exc_value, traceback):
self.timing_info.end()
self.callback(self.timing_info)
# Note: when legacy logger is removed, we can remove the following line
with TimingProcessor(self.timing_info):
fire_event(
TimingInfoCollected(
timing_info=self.timing_info.to_msg_dict(), node_info=get_node_info()
)
fire_event(
TimingInfoCollected(
timing_info=self.timing_info.to_msg_dict(), node_info=get_node_info()
)
)


class RunningStatus(StrEnum):
Expand Down
12 changes: 2 additions & 10 deletions core/dbt/contracts/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
RunExecutionResult,
)
from dbt.contracts.util import VersionedSchema, schema_version
from dbt.logger import LogMessage


TaskTags = Optional[Dict[str, Any]]
Expand All @@ -24,12 +23,7 @@


@dataclass
class RemoteResult(VersionedSchema):
logs: List[LogMessage]


@dataclass
class RemoteCompileResultMixin(RemoteResult):
class RemoteCompileResultMixin(VersionedSchema):

Check warning on line 26 in core/dbt/contracts/sql.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/contracts/sql.py#L26

Added line #L26 was not covered by tests
raw_code: str
compiled_code: str
node: ResultNode
Expand All @@ -48,7 +42,7 @@

@dataclass
@schema_version("remote-execution-result", 1)
class RemoteExecutionResult(ExecutionResult, RemoteResult):
class RemoteExecutionResult(ExecutionResult):

Check warning on line 45 in core/dbt/contracts/sql.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/contracts/sql.py#L45

Added line #L45 was not covered by tests
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that the schema for these "remote result" objects has changed and needs to be bumped? Even if the schema has changed, it looks these objects are only ever used by dbt-rpc. If that is indeed the case, can we remove them entirely?

Copy link
Member Author

@emmyoop emmyoop Jan 10, 2024

Choose a reason for hiding this comment

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

Going to push off this code cleanup to #9359

results: Sequence[RunResult]
args: Dict[str, Any] = field(default_factory=dict)
generated_at: datetime = field(default_factory=datetime.utcnow)
Expand All @@ -66,14 +60,12 @@
def from_local_result(
cls,
base: RunExecutionResult,
logs: List[LogMessage],
) -> "RemoteExecutionResult":
return cls(
generated_at=base.generated_at,
results=base.results,
elapsed_time=base.elapsed_time,
args=base.args,
logs=logs,
)


Expand Down
18 changes: 0 additions & 18 deletions core/dbt/flags.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
# Do not import the os package because we expose this package in jinja
from os import getenv as os_getenv
from argparse import Namespace
from typing import Optional
from pathlib import Path


# for setting up logger for legacy logger
def env_set_truthy(key: str) -> Optional[str]:
"""Return the value if it was set to a "truthy" string value or None
otherwise.
"""
value = os_getenv(key)
if not value or value.lower() in ("0", "false", "f"):
return None
return value


# for setting up logger for legacy logger
ENABLE_LEGACY_LOGGER = env_set_truthy("DBT_ENABLE_LEGACY_LOGGER")


# this roughly follows the patten of EVENT_MANAGER in dbt/common/events/functions.py
# During de-globlization, we'll need to handle both similarly
# Match USE_COLORS default with default in dbt.cli.params.use_colors for use in --version
Expand Down
Loading