File tree Expand file tree Collapse file tree 2 files changed +6
-13
lines changed
Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ dependencies = [
1919 " rich >= 12.6.0" ,
2020 " python-logging-loki >= 0.3.1" ,
2121 " neuroglancer >= 2.32" ,
22+ " cloudpickle >= 3.1.1" ,
2223 " dill >= 0.3.6" ,
2324 " pyyaml ~= 6.0.1" ,
2425 " requests==2.31.0" , # version conflicts otherwise
@@ -34,7 +35,7 @@ keywords = ["neuroscience connectomics EM"]
3435license = {text = " MIT" }
3536name = " zetta_utils"
3637readme = " README.md"
37- requires-python = " >3.9 ,<3.13"
38+ requires-python = " >3.10 ,<3.13"
3839urls = {Homepage = " https://github.com/zettaai/zetta_utils" }
3940version = " 0.0.2"
4041
Original file line number Diff line number Diff line change 44import uuid
55from typing import Callable , Optional
66
7- import dill
7+ import cloudpickle
88import xxhash
99from coolname import generate_slug
1010
@@ -42,7 +42,7 @@ def generate_invocation_id(
4242 prefix : Optional [str ] = None ,
4343) -> str :
4444 """Generate a unique and deterministic ID for a function invocation.
45- The ID is generated using xxhash and dill to hash the function and its arguments.
45+ The ID is generated using xxhash and cloudpickle to hash the function and its arguments.
4646
4747 :param fn: the function, or really any Callable, defaults to None
4848 :param args: the function arguments, or any list, defaults to None
@@ -53,16 +53,8 @@ def generate_invocation_id(
5353 """
5454 x = xxhash .xxh128 ()
5555 try :
56- x .update (
57- dill .dumps (
58- (fn , args , kwargs ),
59- protocol = dill .DEFAULT_PROTOCOL ,
60- byref = False ,
61- recurse = True ,
62- fmode = dill .FILE_FMODE ,
63- )
64- )
65- except dill .PicklingError as e :
56+ x .update (cloudpickle .dumps ((fn , args , kwargs )))
57+ except Exception as e : # pylint: disable=broad-exception-caught
6658 logger .warning (f"Failed to pickle { fn } with args { args } and kwargs { kwargs } : { e } " )
6759 x .update (str (uuid .uuid4 ()))
6860
You can’t perform that action at this time.
0 commit comments