I am trying to pass some certain functions to a distributed system. The system uses serialized data to do such things, ie. it pickle the function by default and send it to destination. Here I have a problem that some complex functions are involving data and functionalities of other modules. Eg., I am to send the func1
which is imported from utils.py
in main.py
, func1
also uses some lists/dicts in data.py
. Such as:
│───main.py
│
└───module1
│ __init__.py
│ utils.py
│ data.py
The code of utils
import data
def func1(arg):
return func2(data.cfg, arg)
def func2(*args):
.....
I tried dill, it however could not recursively process references accross modules. Any solution to cope with serialization?