Skip to content

Commit cd27a0b

Browse files
committed
try semver
1 parent c122166 commit cd27a0b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

btrdb/utils/ray.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import ray
44

5+
import semver
6+
57
import btrdb
68
from btrdb.conn import BTrDB
79

@@ -24,13 +26,16 @@ def register_serializer(conn_str=None, apikey=None, profile=None):
2426
"""
2527
assert ray.is_initialized(), "Need to call ray.init() before registering custom serializer"
2628
# TODO: check the version using the 'semver' package?
27-
if ray.__version__ == "0.8.4":
29+
ver = semver.VersionInfo.parse(ray.__version__)
30+
if ver.major == 0:
2831
ray.register_custom_serializer(
2932
BTrDB, serializer=btrdb_serializer, deserializer=partial(btrdb_deserializer, conn_str=conn_str, apikey=apikey, profile=profile))
30-
elif ray.__version__ in ["1.2.0", "1.3.0"]:
33+
elif ver.major == 1 and ver.minor in range(2, 4):
3134
# TODO: check different versions of ray?
3235
ray.util.register_serializer(
3336
BTrDB, serializer=btrdb_serializer, deserializer=partial(btrdb_deserializer, conn_str=conn_str, apikey=apikey, profile=profile))
37+
else:
38+
raise Exception("Ray version %s does not have custom serialization. Please upgrade to >= 1.2.0" % ray.__version__)
3439

3540
def btrdb_serializer(_):
3641
"""

0 commit comments

Comments
 (0)