Skip to content

Commit 44ff0ac

Browse files
authored
treat version string parse failures as heartbeat-enabled versions by default (#444)
1 parent d7399d2 commit 44ff0ac

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

services/metadata_service/tests/unit_tests/task_test.py

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
(["metaflow_version:2.12.24+inconsequential+trailing-string"], True),
2626
(["metaflow_version:2.12.24.break"], True),
2727
(["metaflow_version:3"], True),
28+
(["metaflow_version:custom-1"], True),
2829
]
2930

3031

services/utils/__init__.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -150,18 +150,20 @@ def has_heartbeat_capable_version_tag(system_tags):
150150
"""Check client version tag whether it is known to support heartbeats or not"""
151151
try:
152152
# only parse for the major.minor.patch version and disregard any trailing bits that might cause issues with comparison.
153-
version_tag = [tag for tag in system_tags if tag.startswith('metaflow_version:')][0]
153+
version_tags = [tag for tag in system_tags if tag.startswith('metaflow_version:')]
154+
if not version_tags:
155+
return False
154156
# match versions: major | major.minor | major.minor.patch
155-
ver_string = re.match(r"(0|\d+)(\.(0|\d+))*", version_tag[len("metaflow_version:"):])[0]
156-
print(ver_string)
157+
ver_string = re.match(r"(0|\d+)(\.(0|\d+))*", version_tags[0].lstrip("metaflow_version:"))[0]
157158
version = parse(ver_string)
158159

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

162163
return version >= Version("2.2.12")
163164
except Exception:
164-
return False
165+
# Treat non-standard versions as heartbeat-enabled by default
166+
return True
165167

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

0 commit comments

Comments
 (0)