From e1beca76cdd32ad1e8fb214619bcaee84493960d Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Tue, 2 Aug 2022 12:00:02 -0700 Subject: [PATCH 1/3] fix(ingest): handle bug where current server version is unavailable Ref: https://datahubspace.slack.com/archives/CV2KB471C/p1659463009081319?thread_ts=1659458463.742769&cid=CV2KB471C --- .../src/datahub/upgrade/upgrade.py | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/metadata-ingestion/src/datahub/upgrade/upgrade.py b/metadata-ingestion/src/datahub/upgrade/upgrade.py index 8bac44f568078d..5f9a45e296362c 100644 --- a/metadata-ingestion/src/datahub/upgrade/upgrade.py +++ b/metadata-ingestion/src/datahub/upgrade/upgrade.py @@ -114,7 +114,7 @@ async def get_server_config(gms_url: str, token: str) -> dict: async def get_server_version_stats( server: Optional[DataHubGraph] = None, -) -> Tuple[Any, Any, Any]: +) -> Tuple[Optional[str], Optional[Version], Optional[datetime]]: server_config = None if not server: try: @@ -153,6 +153,8 @@ async def get_server_version_stats( if server_version_string and server_version_string.startswith("v"): server_version = Version(server_version_string[1:]) + server_version = None + current_server_release_date = None return (server_type, server_version, current_server_release_date) @@ -180,15 +182,20 @@ async def retrieve_version_stats( ) = server_config_future.result() tasks.remove(t) - server_version_stats = ServerVersionStats( - current=VersionStats( - version=current_server_version, release_date=current_server_release_date - ), - latest=VersionStats(version=last_server_version, release_date=last_server_date) - if last_server_version - else None, - current_server_type=current_server_type, - ) + server_version_stats = None + if current_server_version and current_server_release_date: + server_version_stats = ServerVersionStats( + current=VersionStats( + version=current_server_version, release_date=current_server_release_date + ), + latest=VersionStats( + version=last_server_version, release_date=last_server_date + ) + if last_server_version + else None, + current_server_type=current_server_type, + ) + if client_version_stats and server_version_stats: return DataHubVersionStats( server=server_version_stats, client=client_version_stats From 5a38806e7612a358bf1bb5757b72de032dc42b0a Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Tue, 2 Aug 2022 12:01:40 -0700 Subject: [PATCH 2/3] tweak --- metadata-ingestion/src/datahub/upgrade/upgrade.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/metadata-ingestion/src/datahub/upgrade/upgrade.py b/metadata-ingestion/src/datahub/upgrade/upgrade.py index 5f9a45e296362c..49215e059c0251 100644 --- a/metadata-ingestion/src/datahub/upgrade/upgrade.py +++ b/metadata-ingestion/src/datahub/upgrade/upgrade.py @@ -153,8 +153,6 @@ async def get_server_version_stats( if server_version_string and server_version_string.startswith("v"): server_version = Version(server_version_string[1:]) - server_version = None - current_server_release_date = None return (server_type, server_version, current_server_release_date) From 772f24b6a324a0a0b26d5ca271d103a4f0f6ce28 Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Tue, 2 Aug 2022 12:05:44 -0700 Subject: [PATCH 3/3] tweak again --- metadata-ingestion/src/datahub/upgrade/upgrade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata-ingestion/src/datahub/upgrade/upgrade.py b/metadata-ingestion/src/datahub/upgrade/upgrade.py index 49215e059c0251..32c55284870287 100644 --- a/metadata-ingestion/src/datahub/upgrade/upgrade.py +++ b/metadata-ingestion/src/datahub/upgrade/upgrade.py @@ -181,7 +181,7 @@ async def retrieve_version_stats( tasks.remove(t) server_version_stats = None - if current_server_version and current_server_release_date: + if current_server_version: server_version_stats = ServerVersionStats( current=VersionStats( version=current_server_version, release_date=current_server_release_date