ChimeraPy / Engine

Distributed computing framework for Multimodal data written in Python
https://chimerapy-engine.readthedocs.io
GNU General Public License v3.0
9 stars 0 forks source link

Error: Cannot Instantiate PosixPath in your system #229

Closed umesh-timalsina closed 1 year ago

umesh-timalsina commented 1 year ago

It seems like nodes created in a Linux system cannot be instantiated in Windows and throws the above error:

File "C:\Users\OELE03\MMLAProject\ChimeraPy\chimerapy\engine\worker\http_server_service.py", line 223, in _async_create_node_route
    await self.eventbus.asend(Event("create_node", CreateNodeEvent(node_config)))
  File "C:\Users\OELE03\MMLAProject\ChimeraPy\chimerapy\engine\eventbus\eventbus.py", line 41, in asend
    await self.stream.asend(event)
  File "C:\Users\OELE03\miniconda3\envs\chimerapy-dev\lib\site-packages\aioreactive\subject.py", line 125, in asend
    await obv.asend(value)
  File "C:\Users\OELE03\MMLAProject\ChimeraPy\chimerapy\engine\eventbus\eventbus.py", line 119, in asend
    await self.exec_callable(self._on_asend, **event.data.__dict__)
  File "C:\Users\OELE03\MMLAProject\ChimeraPy\chimerapy\engine\eventbus\eventbus.py", line 98, in exec_callable
    await func(*arg, **kwargs)
  File "C:\Users\OELE03\MMLAProject\ChimeraPy\chimerapy\engine\worker\node_handler_service.py", line 266, in async_create_node
    node_object = dill.loads(node_config.pickled)
  File "C:\Users\OELE03\miniconda3\envs\chimerapy-dev\lib\site-packages\dill\_dill.py", line 286, in loads
    return load(file, ignore, **kwds)
  File "C:\Users\OELE03\miniconda3\envs\chimerapy-dev\lib\site-packages\dill\_dill.py", line 272, in load
    return Unpickler(file, ignore=ignore, **kwds).load()
  File "C:\Users\OELE03\miniconda3\envs\chimerapy-dev\lib\site-packages\dill\_dill.py", line 419, in load
    obj = StockUnpickler.load(self)
  File "C:\Users\OELE03\miniconda3\envs\chimerapy-dev\lib\pathlib.py", line 962, in __new__
    raise NotImplementedError("cannot instantiate %r on your system"
NotImplementedError: cannot instantiate 'PosixPath' on your system
edavalosanaya commented 1 year ago

Yes, need to ensure that all pathlib.Path objects should be strings before dill loads. Looking for a solution as well.

edavalosanaya commented 1 year ago

Likely the issue is that NodeState has a logdir variable with type Pathlib.Path that is created in the Manager computer, pickled, and sent to the Worker computer to be unpickled. Different OS can cause incompatible pathlib.Path objects. Let me convert it to string.

umesh-timalsina commented 1 year ago

I was wondering why the logdir needs to be a path during initialization? Additionally, does the temporary directory needs to be created during initialization?