Skip to content

workflow level ResourceRequirements unable to access workflow level inputs #1330

Open
@mr-c

Description

@mr-c
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: Workflow

requirements:
  InlineJavascriptRequirement: {}  # shouldn't need this, but makes the error more interesting

hints:
  ResourceRequirement:
    coresMax: $(inputs.threads_max)

inputs:
  threads_max:
    type: int
    default: 4

steps:
  one:
    in: []
    run:
      class: CommandLineTool
      inputs: []
      baseCommand: echo
      arguments: [ $(runtime.cores) ]
      outputs: []
    out: []

outputs: []
$ cwltool workflow-dyn-res.cwl
INFO /home/michael/cwltool/env3.8/bin/cwltool 3.0.20200724083110
INFO Resolved 'workflow-dyn-res.cwl' to 'file:///home/michael/cwltool/workflow-dyn-res.cwl'
INFO [workflow ] start
INFO [workflow ] starting step one
INFO [step one] start
ERROR Expecting value: line 1 column 1 (char 0)
script was:
01 "use strict";
02 var inputs = {};
03 var self = null;
04 var runtime = {
05     "tmpdir": "/tmp/tmpcb9aom_8",
06     "outdir": "/tmp/nx2jmuji"
07 };
08 (function(){return ((inputs.threads_max));})()
stdout was: 'undefined'
stderr was: ''

Traceback (most recent call last):
  File "/home/michael/cwltool/cwltool/sandboxjs.py", line 411, in execjs
    return cast(CWLOutputType, json.loads(stdout))
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "cwltool/expression.py", line 377, in do_eval
    return interpolate(
  File "cwltool/expression.py", line 293, in interpolate
    e = evaluator(
  File "cwltool/expression.py", line 250, in evaluator
    return execjs(
  File "/home/michael/cwltool/cwltool/sandboxjs.py", line 413, in execjs
    raise JavascriptException(
cwltool.sandboxjs.JavascriptException: Expecting value: line 1 column 1 (char 0)
script was:
01 "use strict";
02 var inputs = {};
03 var self = null;
04 var runtime = {
05     "tmpdir": "/tmp/tmpcb9aom_8",
06     "outdir": "/tmp/nx2jmuji"
07 };
08 (function(){return ((inputs.threads_max));})()
stdout was: 'undefined'
stderr was: ''

ERROR Exception on step 'one'
ERROR [step one] Cannot make job: Expression evaluation error:
Expecting value: line 1 column 1 (char 0)
script was:
01 "use strict";
02 var inputs = {};
03 var self = null;
04 var runtime = {
05     "tmpdir": "/tmp/tmpcb9aom_8",
06     "outdir": "/tmp/nx2jmuji"
07 };
08 (function(){return ((inputs.threads_max));})()
stdout was: 'undefined'
stderr was: ''

INFO [workflow ] completed permanentFail
{}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions