Skip to content

Commit

Permalink
chore(ingest): remove legacy memory_leak_detector (#9158)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 authored Nov 2, 2023
1 parent f42cb95 commit ec97250
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 139 deletions.
4 changes: 0 additions & 4 deletions metadata-ingestion/src/datahub/cli/ingest_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from datahub.ingestion.run.pipeline import Pipeline
from datahub.telemetry import telemetry
from datahub.upgrade import upgrade
from datahub.utilities import memory_leak_detector

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -98,7 +97,6 @@ def ingest() -> None:
@click.option(
"--no-spinner", type=bool, is_flag=True, default=False, help="Turn off spinner"
)
@click.pass_context
@telemetry.with_telemetry(
capture_kwargs=[
"dry_run",
Expand All @@ -109,9 +107,7 @@ def ingest() -> None:
"no_spinner",
]
)
@memory_leak_detector.with_leak_detection
def run(
ctx: click.Context,
config: str,
dry_run: bool,
preview: bool,
Expand Down
15 changes: 0 additions & 15 deletions metadata-ingestion/src/datahub/entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,10 @@
version=datahub_package.nice_version_name(),
prog_name=datahub_package.__package_name__,
)
@click.option(
"-dl",
"--detect-memory-leaks",
type=bool,
is_flag=True,
default=False,
help="Run memory leak detection.",
)
@click.pass_context
def datahub(
ctx: click.Context,
debug: bool,
log_file: Optional[str],
debug_vars: bool,
detect_memory_leaks: bool,
) -> None:
if debug_vars:
# debug_vars implies debug. This option isn't actually used here, but instead
Expand All @@ -109,10 +98,6 @@ def datahub(
_logging_configured = configure_logging(debug=debug, log_file=log_file)
_logging_configured.__enter__()

# Setup the context for the memory_leak_detector decorator.
ctx.ensure_object(dict)
ctx.obj["detect_memory_leaks"] = detect_memory_leaks


@datahub.command()
@telemetry.with_telemetry()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ class LookerCommonConfig(DatasetSourceConfigMixin):
"discoverable. When disabled, adds this information to the description of the column.",
)
platform_name: str = Field(
"looker", description="Default platform name. Don't change."
# TODO: This shouldn't be part of the config.
"looker",
description="Default platform name.",
hidden_from_docs=True,
)
extract_column_level_lineage: bool = Field(
True,
Expand Down Expand Up @@ -213,7 +216,6 @@ def external_url_defaults_to_api_config_base_url(
def stateful_ingestion_should_be_enabled(
cls, v: Optional[bool], *, values: Dict[str, Any], **kwargs: Dict[str, Any]
) -> Optional[bool]:

stateful_ingestion: StatefulStaleMetadataRemovalConfig = cast(
StatefulStaleMetadataRemovalConfig, values.get("stateful_ingestion")
)
Expand Down
106 changes: 0 additions & 106 deletions metadata-ingestion/src/datahub/utilities/memory_leak_detector.py

This file was deleted.

3 changes: 1 addition & 2 deletions metadata-ingestion/tests/integration/snowflake/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,5 +565,4 @@ def default_query_results( # noqa: C901
"DOMAIN": "DATABASE",
},
]
# Unreachable code
raise Exception(f"Unknown query {query}")
raise ValueError(f"Unexpected query: {query}")
15 changes: 5 additions & 10 deletions metadata-ingestion/tests/unit/test_snowflake_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,7 @@ def default_query_results(query):
return [('{"roles":"","value":""}',)]
elif query == "select current_warehouse()":
return [("TEST_WAREHOUSE")]
# Unreachable code
raise Exception()
raise ValueError(f"Unexpected query: {query}")

connection_mock = MagicMock()
cursor_mock = MagicMock()
Expand Down Expand Up @@ -397,8 +396,7 @@ def query_results(query):
]
elif query == 'show grants to role "PUBLIC"':
return []
# Unreachable code
raise Exception()
raise ValueError(f"Unexpected query: {query}")

config = {
"username": "user",
Expand Down Expand Up @@ -441,8 +439,7 @@ def query_results(query):
return [("", "USAGE", "DATABASE", "DB1")]
elif query == 'show grants to role "PUBLIC"':
return []
# Unreachable code
raise Exception()
raise ValueError(f"Unexpected query: {query}")

setup_mock_connect(mock_connect, query_results)

Expand Down Expand Up @@ -485,8 +482,7 @@ def query_results(query):
]
elif query == 'show grants to role "PUBLIC"':
return []
# Unreachable code
raise Exception()
raise ValueError(f"Unexpected query: {query}")

setup_mock_connect(mock_connect, query_results)

Expand Down Expand Up @@ -536,8 +532,7 @@ def query_results(query):
["", "USAGE", "VIEW", "SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY"],
["", "USAGE", "VIEW", "SNOWFLAKE.ACCOUNT_USAGE.OBJECT_DEPENDENCIES"],
]
# Unreachable code
raise Exception()
raise ValueError(f"Unexpected query: {query}")

setup_mock_connect(mock_connect, query_results)

Expand Down

0 comments on commit ec97250

Please sign in to comment.