Skip to content

Add discussion about how command lines work; spaces in options #39

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

Open
mr-c opened this issue Nov 15, 2017 · 5 comments
Open

Add discussion about how command lines work; spaces in options #39

mr-c opened this issue Nov 15, 2017 · 5 comments

Comments

@mr-c
Copy link
Member

mr-c commented Nov 15, 2017

Real world example:
https://github.com/gijzelaerr/spiel/blob/181b889c77a59a83f1939a2e2c08d8aea5e14469/steps/wsclean.cwl

The tool expects -size 2048 2048 and the POSIX shell sh turns that into three entries in the argument array: -size, 2048, and 2048. However this description passes the sizes in as a single string which becomes only two entries -size and 2048 2048 which is rejected by the tool.

Ideally the tool would accept 2048 2048 (with the embedded space) or have split options for each element (like -xsize and -ysize)

Here's a workaround using arguments that doesn't require any code changes to the underlying tool

cwlVersion: v1.0
class: CommandLineTool

baseCommand: wsclean

hints:
  DockerRequirement:
      dockerImageId: kernsuite/wsclean
      dockerFile: |
        FROM kernsuite/base:3
        RUN docker-apt-install wsclean

inputs:
  ms:
    type: Directory
    inputBinding:
      position: 1

  xsize:
    type: int
    default: 2048

  ysize:
    type: int
    default: 2048

  scale:
    type: string
    default: 1asec
    inputBinding:
      prefix: -scale

arguments:
 - -size
 - $(inputs.xsize)
 - $(inputs.ysize)


outputs:
  dirty:
    type: File
    outputBinding:
      glob: wsclean-dirty.fits

  clean:
    type: File
    outputBinding:
      glob: wsclean-clean.fits
@mr-c
Copy link
Member Author

mr-c commented Nov 30, 2017

@Fienne
Copy link
Contributor

Fienne commented Oct 12, 2022

@mr-c I'm finding it difficult to understand this issue. Please can you give me an idea on how to go about it?

@annngure
Copy link

@mr-c I would also like an idea on how to go about it.

@tetron
Copy link
Member

tetron commented Oct 13, 2022

@Fienne

What michael is saying is that the example he linked to (https://github.com/gijzelaerr/spiel/blob/181b889c77a59a83f1939a2e2c08d8aea5e14469/steps/wsclean.cwl) is wrong and we need a section in the guide that (a) explains why it is wrong and (b) shows the right way to do it. There's also a more general topic of how inputBinding and arguments get put together to make the command line that is actually invoked. Here's some relevant links to the specification:

https://www.commonwl.org/v1.2/CommandLineTool.html#CommandLineTool

https://www.commonwl.org/v1.2/CommandLineTool.html#CommandLineBinding

@Fienne
Copy link
Contributor

Fienne commented Oct 13, 2022

Thank you so much!

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

4 participants