Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def save_info(self, combos=None, cases=None, fn_args=None):
"""Save information about the sowed cases.
"""
# If saving Harvester or Runner, strip out function information so
# as just to use pickle.
if self.farmer is not None:
farmer_copy = copy.deepcopy(self.farmer)
farmer_copy.fn = None
farmer_pkl = cloudpickle.dumps(farmer_copy)
else:
farmer_pkl = None
joblib.dump({
'combos': combos,
'cases': cases,
'fn_args': fn_args,
'batchsize': self.batchsize,
'num_batches': self.num_batches,
'_batch_remainder': self._batch_remainder,
'farmer': farmer_pkl,
}, os.path.join(self.location, INFO_NM))
def __reduce__(self):
_pickled_object = dumps(self._obj)
if not self._keep_wrapper:
return loads, (_pickled_object,)
return _reconstruct_wrapper, (_pickled_object, self._keep_wrapper)
def save_function_to_disk(self):
"""Save the base function to disk using cloudpickle
"""
joblib.dump(cloudpickle.dumps(self._fn),
os.path.join(self.location, FNCT_NM))