Skip to content

Commit

Permalink
Use PickledFunction.serialize_function in decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
superstar54 committed Aug 25, 2024
1 parent 44f4262 commit 6cbf441
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions aiida_workgraph/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,12 @@ def build_task_from_AiiDA(
else outputs
)
# get the source code of the function
tdata["executor"] = PickledFunction(executor).executor
tdata["executor"] = {
"executor": pickle.dumps(executor),
"type": "function",
"is_pickle": True,
}
tdata["executor"].update(PickledFunction.serialize_function(executor))
# tdata["executor"]["type"] = tdata["task_type"]
# print("kwargs: ", kwargs)
# add built-in sockets
Expand Down Expand Up @@ -495,9 +500,14 @@ def generate_tdata(
"properties": properties,
"inputs": _inputs,
"outputs": task_outputs,
"executor": PickledFunction(func).executor,
"catalog": catalog,
}
tdata["executor"] = {
"executor": pickle.dumps(func),
"type": "function",
"is_pickle": True,
}
tdata["executor"].update(PickledFunction.serialize_function(func))
if additional_data:
tdata.update(additional_data)
return tdata
Expand Down

0 comments on commit 6cbf441

Please sign in to comment.