Skip to content

Commit

Permalink
treat version string parse failures as heartbeat-enabled versions by …
Browse files Browse the repository at this point in the history
…default (#444)
  • Loading branch information
saikonen authored Oct 7, 2024
1 parent d7399d2 commit 44ff0ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions services/metadata_service/tests/unit_tests/task_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
(["metaflow_version:2.12.24+inconsequential+trailing-string"], True),
(["metaflow_version:2.12.24.break"], True),
(["metaflow_version:3"], True),
(["metaflow_version:custom-1"], True),
]


Expand Down
10 changes: 6 additions & 4 deletions services/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,20 @@ def has_heartbeat_capable_version_tag(system_tags):
"""Check client version tag whether it is known to support heartbeats or not"""
try:
# only parse for the major.minor.patch version and disregard any trailing bits that might cause issues with comparison.
version_tag = [tag for tag in system_tags if tag.startswith('metaflow_version:')][0]
version_tags = [tag for tag in system_tags if tag.startswith('metaflow_version:')]
if not version_tags:
return False
# match versions: major | major.minor | major.minor.patch
ver_string = re.match(r"(0|\d+)(\.(0|\d+))*", version_tag[len("metaflow_version:"):])[0]
print(ver_string)
ver_string = re.match(r"(0|\d+)(\.(0|\d+))*", version_tags[0].lstrip("metaflow_version:"))[0]
version = parse(ver_string)

if version >= Version("1") and version < Version("2"):
return version >= Version("1.14.0")

return version >= Version("2.2.12")
except Exception:
return False
# Treat non-standard versions as heartbeat-enabled by default
return True

# Database configuration helper
# Prioritizes DSN string over individual connection arguments (host,user,...)
Expand Down

0 comments on commit 44ff0ac

Please sign in to comment.