I want to send lean object to another machine for execution of selected method.
I have a class like:
class ToBeSent:
def __init__(self, data_info):
self.data_info = data_info
def use_data_info_common(self, other_data):
print('using data info ' + self.data_info + other_data)
def use_data_info_SERIALIZE(self, other_data):
print('using data info ' + self.data_info + other_data)
def use_data_info_NOT_serialize(self, other_data):
# some other dependencies I don't want
print("refers to bunch of methods and dependencies I don't want" + self.data_info + other_data)
def serialize_me(self, other_data):
self.use_data_info_common('other' + other_data)
self.use_data_info_SERIALIZE('something')
def NOT_serialize_me(self, other):
self.use_data_info_common(other)
self.use_data_info_NOT_serialize(other)
I want to serialize only one method serialize_me
with all it's dependencies from this object (or super.object) but not the NOT_serialize_me
and it's dependencies, because they are user defined and I cannot run them on target machine.
In case above I would like to automatically detect and serialize serialize_me
and all dependencies which are:
use_data_info_SERIALIZE
use_data_info_common
self.data_info
and remove everything else:
NOT_serialize_me
use_data_info_NOT_serialize
I was experimenting with a proxy getattr
trying to record all calls but it doesn't see any internal calls to common or other methods, and I was cutting too much from this class.