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

Account for non cadet refresh period #1074

Merged
merged 5 commits into from
Nov 19, 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
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def get_refresh_period_from_cadet_tags(
logger.warn(f"More than one refresh period tag found: {tags=}")

if relevant_refresh_schedules:
refresh_schedule = relevant_refresh_schedules[0].capitalize()
refresh_schedule = ", ".join(relevant_refresh_schedules).capitalize()
return refresh_schedule

if not relevant_refresh_schedules:
Expand Down Expand Up @@ -249,7 +249,9 @@ def parse_properties(
usage_restrictions = UsageRestrictions.model_validate(custom_properties_dict)
data_summary = DataSummary.model_validate(custom_properties_dict)
tags = parse_tags(entity)
data_summary.refresh_period = get_refresh_period_from_cadet_tags(tags)
cadet_refresh_period = get_refresh_period_from_cadet_tags(tags)
murdo-moj marked this conversation as resolved.
Show resolved Hide resolved
if cadet_refresh_period:
data_summary.refresh_period = cadet_refresh_period
audience = custom_properties_dict.get("audience", "Internal")

further_information = FurtherInformation.model_validate(custom_properties_dict)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ def test_parse_properties():
{"key": "row_count", "value": 100},
{"key": "Not_IN", "value": "dddd"},
{"key": "audience", "value": "Internal"},
{"key": "refresh_period", "value": "Weekly"},
],
"name": "test",
"description": "test description",
Expand All @@ -311,7 +312,7 @@ def test_parse_properties():
source_dataset_name="",
s3_location="s3://databucket/",
),
data_summary=DataSummary(row_count=100),
data_summary=DataSummary(row_count=100, refresh_period="Weekly"),
further_information=FurtherInformation(
dc_slack_channel_name="test-channel", dc_slack_channel_url="test-url"
),
Expand Down Expand Up @@ -666,6 +667,13 @@ def test_parse_updated():
([TagRef(display_name="daily_opg", urn="urn:li:tag:daily_opg")], "Daily"),
([TagRef(display_name="monthly", urn="urn:li:tag:monthly")], "Monthly"),
([TagRef(display_name="dc_cadet", urn="urn:li:tag:dc_cadet")], ""),
(
[
TagRef(display_name="daily", urn="urn:li:tag:dc_cadet"),
TagRef(display_name="monthly", urn="urn:li:tag:dc_cadet")
],
"Daily, monthly"
),
],
)
def test_get_refresh_period_from_cadet_tags(tags, expected_refresh_period):
Expand Down