我正在使用Ray库,然后我想对我的包进行Cythonize。而如何适配常规远程函数的there is a reference
some_cython_func = ray.remote(some_cython_module.some_cython_func)不清楚如何处理Ray Actor (类级别的装饰器)
@ray.remote
class MyService:
def __init__(self):
pass
def run(self):
...
def helper(self):
...在被Cython化后,这段代码会产生这样的错误
File "/Users/user/anaconda3/envs/ray-test/lib/python3.7/site-packages/ray/actor.py", line 538, in _remote
meta.method_meta.methods.keys())
File "/Users/user/anaconda3/envs/ray-test/lib/python3.7/site-packages/ray/function_manager.py", line 358, in export_actor_class
"class": pickle.dumps(Class),
File "/Users/user/anaconda3/envs/ray-test/lib/python3.7/site-packages/ray/cloudpickle/cloudpickle_fast.py", line 70, in dumps
cp.dump(obj)
File "/Users/user/anaconda3/envs/ray-test/lib/python3.7/site-packages/ray/cloudpickle/cloudpickle_fast.py", line 656, in dump
return Pickler.dump(self, obj)
_pickle.PicklingError: Can't pickle <cyfunction MyService.__init__ at 0x7fc230367c80>: it's not the same object as app.my_service.__init__如何重写/调整现有的工作光线代码以与Cython一起工作?
Python 3.7.9 / ray==0.8.6
发布于 2021-02-03 17:07:47
https://stackoverflow.com/questions/66012058
复制相似问题