Skip to content

Commit

Permalink
fix: use dill instead of pickle to support lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
zcstarr committed Mar 15, 2024
1 parent 850c280 commit ba17a0b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cadCAD/engine/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from cadCAD.utils import flatten
import tempfile
import pickle
import dill

VarDictType = Dict[str, List[object]]
StatesListsType = List[dict[str, object]]
Expand Down Expand Up @@ -69,15 +70,15 @@ def process_executor(params):
)]
temp_file = tempfile.NamedTemporaryFile(delete=False)
with open(temp_file.name, 'wb') as f: # Note 'wb' for binary writing mode
pickle.dump(result, f)
dill.dump(result, f)
return temp_file.name


def file_handler(filenames: List[str]) -> List:
combined_results = []
for file_name in filenames:
with open(file_name, 'rb') as f: # Note 'rb' for binary reading mode
result = pickle.load(f)
result = dill.load(f)
combined_results.append(result)
result = None
f.close()
Expand Down

0 comments on commit ba17a0b

Please sign in to comment.