common-workflow-language / cwl-utils

Python utilities for CWL

Home Page:https://cwl-utils.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

expr refactor: quoting in generated javascript is sometimes wrong

mr-c opened this issue · comments

@mvdbeek to provide a specific example

One example is https://github.com/mvdbeek/galaxy/blob/debug_stuff/test/unit/tools/cwl_tools/v1.0/v1.0/count-lines11-null-step-wf-noET.cwl, which results in

#!/usr/bin/env cwl-runner
class: Workflow
id: file:///Users/mvandenb/src/galaxy/test/functional/tools/cwl_tools/v1.0/v1.0/count-lines11-null-step-wf-noET.cwl
inputs: []
outputs:
- id: wc_output
  outputSource: step1/output
  type: File
cwlVersion: v1.0
steps:
- id: step0
  in: []
  out:
  - output
  run:
    class: CommandLineTool
    id: null-expression3-tool.cwl
    inputs: []
    outputs:
    - id: output
      type: Any
    requirements:
    - class: InitialWorkDirRequirement
      listing:
      - entryname: expression.js
        entry: |-
          "use strict";
          var inputs=$/(inputs);
          var runtime=$/(runtime);
          var ret = function(){{'output': null }}();
          process.stdout.write(JSON.stringify(ret));
    hints:
    - class: DockerRequirement
      dockerPull: node:slim
    - class: SoftwareRequirement
      packages:
      - package: nodejs
    cwlVersion: v1.0
    baseCommand:
    - nodejs
    - expression.js
    stdout: cwl.output.json
- id: step1
  in:
  - id: file1
    source: step0/output
    default:
      class: File
      location: whale.txt
  out:
  - output
  run:
    class: CommandLineTool
    id: wc-tool.cwl
    inputs:
    - id: file1
      type: File
    outputs:
    - id: output
      outputBinding:
        glob: output
      type: File
    hints:
    - ramMin: 8
      class: ResourceRequirement
    cwlVersion: v1.0
    baseCommand:
    - wc
    - -l
    stdin: $(inputs.file1.path)
    stdout: output

This is for cwl-utils updated this morning from the master branch.

Thanks for this! Found an error in a CWL conformance test and cwltool!

common-workflow-language/cwltool#1369
common-workflow-language/common-workflow-language#916

I've tried #47 with #916 and it doesn't look quite right ?

#!/usr/bin/env cwl-runner
class: Workflow
id: file:///Users/mvandenb/src/galaxy/test/functional/tools/cwl_tools/v1.0/v1.0/count-lines11-null-step-wf-noET.cwl
inputs: []
outputs:
- id: wc_output
  outputSource: step1/output
  type: File
cwlVersion: v1.0
steps:
- id: step0
  in: []
  out:
  - output
  run:
    class: CommandLineTool
    id: null-expression3-tool.cwl
    inputs: []
    outputs:
    - id: output
      type:
      - 'null'
      - Any
    requirements:
    - class: InitialWorkDirRequirement
      listing:
      - entryname: expression.js
        entry: |-
          "use strict";
          var inputs=$/(inputs);
          var runtime=$/(runtime);
          var ret = function(){{'output': null }}();
          process.stdout.write(JSON.stringify(ret));
    hints:
    - class: DockerRequirement
      dockerPull: node:slim
    - class: SoftwareRequirement
      packages:
      - package: nodejs
    cwlVersion: v1.0
    baseCommand:
    - nodejs
    - expression.js
    stdout: cwl.output.json
- id: step1
  in:
  - id: file1
    source: step0/output
    default:
      class: File
      location: whale.txt
  out:
  - output
  run:
    class: CommandLineTool
    id: wc-tool.cwl
    inputs:
    - id: file1
      type: File
    outputs:
    - id: output
      outputBinding:
        glob: output
      type: File
    hints:
    - ramMin: 8
      class: ResourceRequirement
    cwlVersion: v1.0
    baseCommand:
    - wc
    - -l
    stdin: $(inputs.file1.path)
    stdout: output

- 'null' looks odd (but maybe it's not), and the quoting still seems off.

OK, used the wrong tool ... sorry.