Skip to content

Commit 0e63881

Browse files
committed
Fix handling for string work functions
1 parent f48eee0 commit 0e63881

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

dcp/api/compute_for.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ def compute_for(*args, **kwargs):
2828
job_args_idx = None
2929

3030
for i, arg in enumerate(args):
31-
if isinstance(arg, FunctionType):
31+
if isinstance(arg, FunctionType) or isinstance(arg, str):
3232
# work function arg separates input from arguments, find indices to hide based on it
3333
if i == 1: # compute.for(iterableObject, work, args), need to wrap iterable
3434
job_input_idx = 0
3535
if i < len(args) - 1: # work function isn't last argument, so last value is args in compute.for
3636
job_args_idx = len(args) - 1
37-
args[i] = dill.source.getsource(arg)
37+
if isinstance(arg, FunctionType):
38+
args[i] = dill.source.getsource(arg)
3839

3940
# Process for ensuring symbols aren't mutated in the python -> js layer:
4041
# 1. Check if symbol is coming from a dcp module/class. If so, set it as the js_ref. Skip next steps.

0 commit comments

Comments
 (0)