Skip to content

Commit

Permalink
fix: use _resolve_element method in config load (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 authored Sep 20, 2023
1 parent 4ffe4e6 commit 63d17fd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
9 changes: 5 additions & 4 deletions datahub-actions/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ def get_long_description():

return description

acryl_datahub_min_version = os.environ.get("ACRYL_DATAHUB_MIN_VERSION", "0.9.4")

acryl_datahub_min_version = os.environ.get("ACRYL_DATAHUB_MIN_VERSION") or "0.10.3"
acryl_datahub_min_version = os.environ.get("ACRYL_DATAHUB_MIN_VERSION") or "0.11.0"

base_requirements = {
f"acryl-datahub[kafka]>={acryl_datahub_min_version}",
Expand Down Expand Up @@ -74,7 +73,7 @@ def get_long_description():
"kafka": set(), # included by default
# Action Plugins
"executor": {
"acryl-executor==0.0.3.11",
"acryl-executor==0.0.3.12",
},
"slack": {
"slack-bolt>=1.15.5",
Expand All @@ -84,7 +83,9 @@ def get_long_description():
},
"tag_propagation": set(),
"term_propagation": set(),
"snowflake_tag_propagation": {f"acryl-datahub[snowflake]>={acryl_datahub_min_version}"}
"snowflake_tag_propagation": {
f"acryl-datahub[snowflake]>={acryl_datahub_min_version}"
}
# Transformer Plugins (None yet)
}

Expand Down
6 changes: 3 additions & 3 deletions datahub-actions/src/datahub_actions/cli/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import click
from click_default_group import DefaultGroup
from datahub.configuration.config_loader import load_config_file, resolve_element
from datahub.configuration.config_loader import _resolve_element, load_config_file

import datahub_actions as datahub_actions_package
from datahub_actions.pipeline.pipeline import Pipeline
Expand All @@ -37,7 +37,7 @@

def best_effort_resolve_element(x: str) -> str:
try:
return resolve_element(x)
return _resolve_element(x)
except Exception:
return x

Expand Down Expand Up @@ -94,7 +94,7 @@ def run(ctx: Any, config: List[str], debug: bool) -> None:
for pipeline_config in config:
pipeline_config_file = pathlib.Path(pipeline_config)
with unittest.mock.patch(
"datahub.configuration.config_loader.resolve_element"
"datahub.configuration.config_loader._resolve_element"
) as mock_resolve_element:
mock_resolve_element.side_effect = best_effort_resolve_element
pipeline_config_dict = load_config_file(pipeline_config_file)
Expand Down
2 changes: 1 addition & 1 deletion datahub-actions/src/datahub_actions/utils/name_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class SchemaFieldNameResolver(DefaultNameResolver):
def get_entity_name(
self, entity_urn: Urn, datahub_graph: Optional[DataHubGraph]
) -> str:
return DatasetUrn._get_simple_field_path_from_v2_field_path(
return DatasetUrn.get_simple_field_path_from_v2_field_path(
entity_urn.get_entity_id()[1]
)

Expand Down
8 changes: 4 additions & 4 deletions datahub-actions/tests/unit/pipeline/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ def test_create():
# Validate Pipeline is initialized
assert valid_pipeline.name is not None
assert valid_pipeline.source is not None
assert type(valid_pipeline.source) == TestEventSource
assert isinstance(valid_pipeline.source, TestEventSource)
assert valid_pipeline.transforms is not None
assert len(valid_pipeline.transforms) == 2 # Filter + Custom
assert type(valid_pipeline.transforms[0]) == FilterTransformer
assert type(valid_pipeline.transforms[1]) == TestTransformer
assert isinstance(valid_pipeline.transforms[0], FilterTransformer)
assert isinstance(valid_pipeline.transforms[1], TestTransformer)
assert valid_pipeline.action is not None
assert type(valid_pipeline.action) == TestAction
assert isinstance(valid_pipeline.action, TestAction)
assert valid_pipeline._shutdown is False
assert valid_pipeline._stats is not None
assert valid_pipeline._retry_count == 3
Expand Down

0 comments on commit 63d17fd

Please sign in to comment.