common-workflow-language / common-workflow-language/cwltool

cwltool does not recognize the array property 'length' in ECMAScript expressions

Open
#235 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
376
Forks
255
Avg merge
2d 7h
Merged PRs (30d)
12

Description

When not using the full javascript engine, cwltool doesn't recognize length as a special field in `$(input.files.length)` but it should.

I'm interested in requesting a maximum number of cores to be equal to the number of files in an input of type `File[]`. However, when I set `maxCores: $(input.files.length)`, I get the error `ERROR: Execution failed: list indices must be integers, not str`.

CWL and yml inputs are provided in the zip attached: [fastqc.zip](https://github.com/common-workflow-language/cwltool/files/605465/fastqc.zip)

Full traceback is below:
```
$ cwltool fastqc.cwl fastqc_local_inputs.yml
/usr/bin/cwltool 1.0.20161107145355
Got workflow error
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/cwltool/main.py", line 220, in single_job_executor
for r in jobiter:
File "/usr/lib/python2.7/dist-packages/cwltool/draft2tool.py", line 243, in job
builder = self._init_job(joborder, **kwargs)
File "/usr/lib/python2.7/dist-packages/cwltool/process.py", line 508, in _init_job
builder.resources = self.evalResources(builder, kwargs)
File "/usr/lib/python2.7/dist-packages/cwltool/process.py", line 533, in evalResources
mx = builder.do_eval(resourceReq[a+"Max"])
File "/usr/lib/python2.7/dist-packages/cwltool/builder.py", line 206, in do_eval
timeout=self.timeout)
File "/usr/lib/python2.7/dist-packages/cwltool/expression.py", line 185, in do_eval
jslib=jslib)
File "/usr/lib/python2.7/dist-packages/cwltool/expression.py", line 143, in interpolate
timeout=timeout)
File "/usr/lib/python2.7/dist-packages/cwltool/expression.py", line 126, in evaluator
return next_seg(m.group(0)[m.end(1) - m.start(0):-1], obj[m.group(1)])
File "/usr/lib/python2.7/dist-packages/cwltool/expression.py", line 112, in next_seg
return next_seg(remain[m.end(0):], obj[m.group(0)[1:]])
File "/usr/lib/python2.7/dist-packages/cwltool/expression.py", line 112, in next_seg
return next_seg(remain[m.end(0):], obj[m.group(0)[1:]])
TypeError: list indices must be integers, not str
Workflow error, try again with --debug for more information:
list indices must be integers, not st
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.