Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

itemSeparator with an array prints arguments twice #745

Open
ThomasHickman opened this issue May 11, 2018 · 2 comments
Open

itemSeparator with an array prints arguments twice #745

ThomasHickman opened this issue May 11, 2018 · 2 comments

Comments

@ThomasHickman
Copy link
Member

ThomasHickman commented May 11, 2018

Inputs

test.cwl:

cwlVersion: v1.0
class: CommandLineTool
baseCommand: ['true']
inputs:
  - id: param
    type:
      type: array
      items: string
      inputBinding:
        prefix: --arr_prefix
    inputBinding:
      prefix: --before_prefix
      itemSeparator: " "

outputs: []

Output

$ python -m cwltool test.cwl --param one --param two
/Users/th10/checkouts/cwltool/cwltool/__main__.py 1.0.20180509130025
Resolved 'test.cwl' to 'file:///Users/th10/checkouts/cwltool/test.cwl'
[job test.cwl] /private/tmp/docker_tmpq_xbceae$ true \
    --before_prefix \
    'one two' \
    --arr_prefix \
    one \
    --arr_prefix \
    two
[job test.cwl] completed success
{}
Final process status is success

It looks like

l = [binding["itemSeparator"].join([self.tostr(v) for v in value])]
is generating values as well as bind_input splitting up the list and feeding each part into bind_input, hence the generation of the interpolated value of one two twice.

Your Environment

  • cwltool version: 1.0.20170816094652
@kinow
Copy link
Member

kinow commented May 19, 2022

Same output with the latest version of cwltool and using v1.0 or v1.2.

I think the type element is a CommandInputRecordSchema, and its inputBinding is telling cwltool to add the values of that parameter to the command line.

If the idea was to add one two to both --arr_prefix and to --before_prefix (i.e. re-use the same values), I think it would be simpler to create two inputs like this.

cwlVersion: v1.2
class: CommandLineTool
baseCommand: ['true']
requirements:
  InlineJavascriptRequirement: {}
inputs:
  - id: param
    type:
      type: array
      items: string
    inputBinding:
      prefix: --before_prefix
      itemSeparator: " "
  - id: param2
    default: []
    type:
      type: array
      items: string
    inputBinding:
      prefix: --after_prefix
      valueFrom: ${ return inputs.param.join(' ') }

outputs: []
(venv) kinow@ranma:~/Development/python/workspace/cwltool$ cwltool /tmp/test.cwl --param a --param b
INFO /home/kinow/Development/python/workspace/cwltool/venv/bin/cwltool 3.1.20220502060230
INFO Resolved '/tmp/test.cwl' to 'file:///tmp/test.cwl'
INFO [job test.cwl] /tmp/mr6wviq1$ true \
    --before_prefix \
    'a b' \
    --after_prefix \
    'a b'
INFO [job test.cwl] completed success
{}
INFO Final process status is success

But I am not sure what's the expected behavior.

@tom-tan
Copy link
Member

tom-tan commented May 19, 2022

It is a matter of the specification as well as the implementation.
Related: common-workflow-language/cwl-v1.2#177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants