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

feat(ingest/looker): cleanup error handling #9135

Merged
merged 1 commit into from
Oct 30, 2023
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: 5 additions & 1 deletion metadata-ingestion/src/datahub/ingestion/api/workunit.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ class MetadataWorkUnit(WorkUnit):
metadata: Union[
MetadataChangeEvent, MetadataChangeProposal, MetadataChangeProposalWrapper
]
# A workunit creator can determine if this workunit is allowed to fail

# A workunit creator can determine if this workunit is allowed to fail.
# TODO: This flag was initially added during the rollout of the subType aspect
# to improve backwards compatibility, but is not really needed anymore and so
# should be removed.
treat_errors_as_warnings: bool = False

# When this is set to false, this MWU will be ignored by automatic helpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ def get_user(self, id_: str, user_fields: str) -> Optional[User]:
transport_options=self.transport_options,
)
except SDKError as e:
logger.warning(f"Could not find user with id {id_}")
logger.warning(f"Failure was {e}")
if "Looker Not Found (404)" in str(e):
# User not found
logger.info(f"Could not find user with id {id_}: 404 error")
else:
logger.warning(f"Could not find user with id {id_}")
logger.warning(f"Failure was {e}")
# User not found
return None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -926,14 +926,7 @@ def process_metrics_dimensions_and_fields_for_dashboard(
mcps = chart_mcps
mcps.append(dashboard_mcp)

workunits = [
MetadataWorkUnit(
id=f"looker-{mcp.aspectName}-{mcp.entityUrn}",
mcp=mcp,
treat_errors_as_warnings=True,
)
for mcp in mcps
]
workunits = [mcp.as_workunit() for mcp in mcps]

return workunits

Expand Down Expand Up @@ -1320,10 +1313,7 @@ def get_workunits_internal(self) -> Iterable[MetadataWorkUnit]:
id=f"looker-{event.proposedSnapshot.urn}", mce=event
)
elif isinstance(event, MetadataChangeProposalWrapper):
# We want to treat subtype aspects as optional, so allowing failures in this aspect to be treated as warnings rather than failures
yield event.as_workunit(
treat_errors_as_warnings=event.aspectName in ["subTypes"]
)
yield event.as_workunit()
else:
raise Exception(f"Unexpected type of event {event}")
self.reporter.report_stage_end("explore_metadata")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2171,10 +2171,7 @@ def get_internal_workunits(self) -> Iterable[MetadataWorkUnit]: # noqa: C901
for mcp in self._build_dataset_mcps(
maybe_looker_view
):
# We want to treat mcp aspects as optional, so allowing failures in this aspect to be treated as warnings rather than failures
yield mcp.as_workunit(
treat_errors_as_warnings=True
)
yield mcp.as_workunit()
else:
(
prev_model_name,
Expand Down
Loading