yuch7 / cwlexec

A new open source tool to run CWL workflows on LSF
Other
36 stars 8 forks source link

Undefined javascript variable error #36

Closed drjrm3 closed 5 years ago

drjrm3 commented 5 years ago

Working on #34 again and I can now reproduce the same error in my larger workflow.

Step 1 is split_reads which correctly scatters over the files now after the workaround proposed.

Step 2 scatters over those files and tries to generate a string for output_file from one of the files generated as part of step 1. I am using the following JavaScript to generate this string and it works in cwltool so I had assumed it was the correct approach:

      output_file:
        valueFrom: |
          ${  
            var s = inputs.R1_file.nameroot;
            s = s.replace(".R1","");
            return s + ".out";
          }   

However, the error I get with cwlexec is:

[var runtime={"tmpdir":"/home/jmichael/cwl-workdir/79cb5eaa-3438-497f-8be8-85fd9a5523c7","tmpdirSize":"15005232752754688","outdirSize":"15005232752754688","cores":"1","outdir":"/home/jmichael/cwl-workdir/79cb5eaa-3438-497f-8be8-85fd9a5523c7","ram":"1024"};, var inputs={"R
12:20:50.855 default [pool-5-thread-1] ERROR c.i.s.c.e.e.lsf.LSFBwaitExecutorTask - Failed to wait for job process_reads <66124407>, Failed to evaluate the expression "${
  var s = inputs.R1_file.nameroot;
  s = s.replace(".R1","");
  return s + ".out";
}
": TypeError: Cannot read property "replace" from undefined in <eval> at line number 3

so it looks like it is not correctly using inputs.R1_file. Am I using the correct approach here? It appears to be the same general issues as in #34 but I don't know that I can use the same workaround since I don't take anything in the inputs section in the scatter so I can't use that as source.

UndefinedVariableError.tar.gz

skeeey commented 5 years ago

@drjrm3 the root cause is still the inputs.R1_file (split_reads/read1_file) is an array, this because output_file does not participate in scatter, we use the original inputs value to build the javascript context.

For scatter case, we may need to build the javascript context after the scatter phase. I will try to fix this problem