common-workflow-language/cwljava

Embedded process ID is ignored

jdidion opened this issue · 2 comments

I am trying to parse the following workflow, which was generated by cwlpack --json --add-ids. The parser ignores the ID of the wc3-tool process is ignored and instead substitutes the ID #count-lines19-wf.cwl/step1/null.

{
    "class": "Workflow",
    "cwlVersion": "v1.2",
    "inputs": [
        {
            "type": "File",
            "id": "file1"
        }
    ],
    "outputs": [
        {
            "type": "int",
            "outputSource": "step1/output",
            "id": "count_output"
        }
    ],
    "steps": [
        {
            "run": {
                "class": "CommandLineTool",
                "requirements": [
                    {
                        "class": "InlineJavascriptRequirement"
                    }
                ],
                "inputs": [
                    {
                        "type": {
                            "type": "array",
                            "items": "File"
                        },
                        "inputBinding": {},
                        "id": "file1"
                    }
                ],
                "outputs": [
                    {
                        "type": "int",
                        "outputBinding": {
                            "glob": "output.txt",
                            "loadContents": true,
                            "outputEval": "${\n  var s = self[0].contents.split(/\\r?\\n/);\n  return parseInt(s[s.length-2]);\n}\n"
                        },
                        "id": "output"
                    }
                ],
                "stdout": "output.txt",
                "baseCommand": "wc",
                "id": "count-lines19-wf.cwl:step_step1:wc3-tool.cwl"
            },
            "in": [
                {
                    "source": [
                        "file1"
                    ],
                    "linkMerge": "merge_nested",
                    "id": "file1"
                }
            ],
            "out": [
                "output"
            ],
            "id": "step1"
        }
    ],
    "requirements": [
        {
            "class": "SubworkflowFeatureRequirement"
        },
        {
            "class": "InlineJavascriptRequirement"
        }
    ],
    "id": "count-lines19-wf.cwl"
}

It looks like the problem is that IDs are parsed by UriLoader, which calls LoadingOptions.expandUrl, which mucks with things that have ":" in them. So I think we need to find a different delimiter for the auto-generated IDs.

Confirm that it works if I replace ':' with ';' in the auto-generated IDs. I'll close this and open an issue in cwlpack.