common-workflow-language / cwltool

Common Workflow Language reference implementation
https://cwltool.readthedocs.io/
Apache License 2.0
335 stars 230 forks source link

``cwltool --pack`` does not handle collisions correctly #1937

Open mvdbeek opened 11 months ago

mvdbeek commented 11 months ago

Expected Behavior

cwltool --pack https://raw.githubusercontent.com/common-workflow-language/cwl-v1.1/main/tests/conflict-wf.cwl should resolve conflicts and output an equivalent workflow to cwlpack output:

$graph:
- baseCommand: echo
  class: CommandLineTool
  id: echo
  inputs:
    text:
      inputBinding: {}
      type: string
  outputs:
    fileout:
      outputBinding: {glob: out.txt}
      type: File
  stdout: out.txt
- baseCommand: cat
  class: CommandLineTool
  id: cat
  inputs:
    file1:
      inputBinding: {position: 1}
      type: File
    file2:
      inputBinding: {position: 2}
      type: File
  outputs:
    fileout:
      outputBinding: {glob: out.txt}
      type: File
  stdout: out.txt
- class: Workflow
  id: collision
  inputs: {input_1: string, input_2: string}
  outputs:
    fileout: {outputSource: cat_step/fileout, type: File}
  steps:
    cat_step:
      in:
        file1: {source: echo_1/fileout}
        file2: {source: echo_2/fileout}
      out: [fileout]
      run: '#cat'
    echo_1:
      in: {text: input_1}
      out: [fileout]
      run: '#echo'
    echo_2:
      in: {text: input_2}
      out: [fileout]
      run: '#echo'
cwlVersion: v1.1

Actual Behavior

cwltool --pack https://raw.githubusercontent.com/common-workflow-language/cwl-v1.1/main/tests/conflict-wf.cwl swallows the workflow (without any error):

{
    "$graph": [
        {
            "id": "#main/cat",
            "class": "CommandLineTool",
            "inputs": [
                {
                    "type": "File",
                    "inputBinding": {
                        "position": 1
                    },
                    "id": "#main/cat/file1"
                },
                {
                    "type": "File",
                    "inputBinding": {
                        "position": 2
                    },
                    "id": "#main/cat/file2"
                }
            ],
            "baseCommand": "cat",
            "stdout": "out.txt",
            "outputs": [
                {
                    "type": "File",
                    "outputBinding": {
                        "glob": "out.txt"
                    },
                    "id": "#main/cat/fileout"
                }
            ]
        },
        {
            "id": "#main/echo",
            "class": "CommandLineTool",
            "inputs": [
                {
                    "type": "string",
                    "inputBinding": {},
                    "id": "#main/echo/text"
                }
            ],
            "outputs": [
                {
                    "type": "File",
                    "outputBinding": {
                        "glob": "out.txt"
                    },
                    "id": "#main/echo/fileout"
                }
            ],
            "baseCommand": "echo",
            "stdout": "out.txt"
        }
    ],
    "cwlVersion": "v1.1"
}

Your Environment

mr-c commented 11 months ago

Thank you @mvdbeek for the report; does using cwlpack from https://github.com/rabix/sbpack work for you?

mvdbeek commented 11 months ago

Yes, that's what I generated the expected version with