rabix / bunny

[Legacy] Executor for CWL workflows. Executes sbg:draft-2 and CWL 1.0
http://rabix.io
Apache License 2.0
74 stars 28 forks source link

Fix CommandLineBuilder behaviour when prefix is null and itemSeparator is set. #430

Closed AdrianMBarrera closed 6 years ago

AdrianMBarrera commented 6 years ago

I'm working with Rabix Composer to create a workflow that has an array as input. The result is something like this:

cwlVersion: v1.0
class: CommandLineTool

baseCommand: 
  - command

inputs:
  - id: inputs_separated
    type: 'File[]'
    inputBinding:
      prefix: '-I'
      itemSeparator: null

outputs:
   output:
    type: stdout

It should produce the command command -I input1 -I input2, but it produces command -I input1 input2

I tried to change itemSeparator value to ' -I ', but then, it produces command -I 'input1 -I input2'

This change should fix the issue.

milos-ljubinkovic commented 6 years ago

This breaks a lot of conformance tests https://travis-ci.org/rabix/bunny/builds/349330713

buchanae commented 6 years ago

For reference, this is how you might do it with cwltool. Note that I changed the input definition to put the prefix on the nested file type.

cat file-array-prefix.cwl
cwlVersion: v1.0
class: CommandLineTool

baseCommand: echo

inputs:
  - id: inputs_separated
    type:
        type: array
        items: File
        inputBinding:
            prefix: "-I"

outputs: []
cat file-array-prefix.inputs.cwl
inputs_separated:
  - class: File
    location: foo
  - class: File
    location: bar
cwltool --quiet file-array-prefix.cwl file-array-prefix.inputs.cwl
-I /private/var/folders/kw/m6dz8snx7h33ppbkbllnqt48bkhsqx/T/tmp6e5nFf/stg72f29525-0722-4ec8-9cf9-bc6ca5d3bc44/foo -I /private/var/folders/kw/m6dz8snx7h33ppbkbllnqt48bkhsqx/T/tmp6e5nFf/stg6e391422-7923-4ca3-b401-47ba5184d11d/bar
{}