Skip to content

itemSeparator with an array prints arguments twice #745

Open
@ThomasHickman

Description

@ThomasHickman
Member

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

Activity

kinow

kinow commented on May 19, 2022

@kinow
Member

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

tom-tan commented on May 19, 2022

@tom-tan
Member

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @kinow@tom-tan@ThomasHickman

        Issue actions

          itemSeparator with an array prints arguments twice · Issue #745 · common-workflow-language/cwltool