Skip to content

Commit

Permalink
try passing pyfunc
Browse files Browse the repository at this point in the history
  • Loading branch information
calgray committed May 18, 2022
1 parent a321ee1 commit 85a4e1b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions daliuge-engine/dlg/apps/pyfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,10 @@ def _init_func_defaults(self):
self.func_defaults = self.func_defaults["kwargs"]
# we came all this way, now assume that any resulting dict is correct
if not isinstance(self.func_defaults, dict):
logger.error(f"Wrong format or type for function defaults for "+\
"{self.f.__name__}: {self.func_defaults}, {type(self.func_defaults)}")
logger.error(
f"Wrong format or type for function defaults for "
+ "{self.f.__name__}: {self.func_defaults}, {type(self.func_defaults)}"
)
raise ValueError
if DropParser(self.input_parser) is DropParser.PICKLE:
# only values are pickled, get them unpickled
Expand Down Expand Up @@ -397,9 +399,8 @@ def run(self):
elif DropParser(self.input_parser) is DropParser.DATAURL:
all_contents = lambda x: x.dataurl
else:
all_contents = lambda x: ast.literal_eval(
droputils.allDropContents(x).decode("utf-8")
)
# TODO raise ValueError(self.input_parser.__repr__())
all_contents = lambda x: pickle.loads(x)

inputs = collections.OrderedDict()
for uid, drop in self._inputs.items():
Expand Down Expand Up @@ -557,8 +558,11 @@ def write_results(self, result):
if DropParser(self.output_parser) is DropParser.PICKLE:
logger.debug(f"Writing pickeled result {type(r)} to {o}")
o.write(pickle.dumps(r))
# TODO: elif DropParser(self.output_parser) is DropParser.AST:
else:
o.write(repr(r).encode('utf-8'))
# else:
# ValueError(self.output_parser.__repr__())

def generate_recompute_data(self):
return self._recompute_data

0 comments on commit 85a4e1b

Please sign in to comment.