common-workflow-language / schema_salad

Semantic Annotations for Linked Avro Data

Home Page:https://www.commonwl.org/v1.2/SchemaSalad.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Python codegen] Error validating CWL v1.2.1_proposed conformance test 139 after loading and saving

ZimmerA opened this issue · comments

I've tried loading and saving conformance test 139 with models generated by the python codegen for the cwl 1.2.1_proposed schema, which resuled in the following output:

#!/usr/bin/env cwl-runner

cwlVersion: v1.2
class: Workflow

requirements:
- class: MultipleInputFeatureRequirement
- class: ScatterFeatureRequirement
- class: SubworkflowFeatureRequirement

inputs:
- id: file1
  type:
    name: _:6ab9cda0-e8a1-4192-a121-5aca8bae2575
    type: array
    items: File

outputs:
- id: count_output
  type:
    name: _:cd3682f4-97ee-46ea-99a8-f59714ca6ed8
    type: array
    items: int
  outputSource: step1/count_output

steps:
- id: step1
  in:
  - id: file1
    source: file1
  scatter: file1
  run:
    class: Workflow

    inputs:
    - id: |-
        file:///home/adrian/Dokumente/Coding/CWL/cwl-v1.2/tests/count-lines18-wf.cwl#step1/file1
      type: File

    outputs:
    - id: |-
        file:///home/adrian/Dokumente/Coding/CWL/cwl-v1.2/tests/count-lines18-wf.cwl#step1/count_output
      type: int
      outputSource: step2/output

    steps:
    - id: |-
        file:///home/adrian/Dokumente/Coding/CWL/cwl-v1.2/tests/count-lines18-wf.cwl#step1/step1
      in:
      - id: file1
        source: step1/file1
      run: wc-tool.cwl
      out:
      - output
    - id: |-
        file:///home/adrian/Dokumente/Coding/CWL/cwl-v1.2/tests/count-lines18-wf.cwl#step1/step2
      in:
      - id: file1
        source: step1/step1/output
      run: parseInt-tool.cwl
      out:
      - output
    id: _:82ea28c4-1a3e-4d13-af9d-4e626ed52b80
  out:
  - count_output
id: file:///home/adrian/Dokumente/Coding/CWL/cwl-v1.2/tests/count-lines18-wf.cwl

Validating this file with cwltool lead to the following error:

(env) adrian@adrian-ubuntu:~/Dokumente/Coding/CWL/schema_salad/cwl-ts-auto$ cwltool --validate --debug ./problem.cwl
INFO /home/adrian/.local/bin/cwltool 3.1.20210628163208
INFO Resolved './problem.cwl' to 'file:///home/adrian/Dokumente/Coding/CWL/schema_salad/cwl-ts-auto/problem.cwl'
problem.cwl:36:7: object id `../../cwl-v1.2/tests/count-lines18-wf.cwl#step1/file1` previously defined
ERROR I'm sorry, I couldn't load this CWL file.
The error was: 
Traceback (most recent call last):
  File "/home/adrian/.local/lib/python3.9/site-packages/cwltool/main.py", line 1072, in main
    tool = make_tool(uri, loadingContext)
  File "/home/adrian/.local/lib/python3.9/site-packages/cwltool/load_tool.py", line 460, in make_tool
    tool = loadingContext.construct_tool_object(processobj, loadingContext)
  File "/home/adrian/.local/lib/python3.9/site-packages/cwltool/workflow.py", line 51, in default_make_tool
    return Workflow(toolpath_object, loadingContext)
  File "/home/adrian/.local/lib/python3.9/site-packages/cwltool/workflow.py", line 105, in __init__
    self.make_workflow_step(
  File "/home/adrian/.local/lib/python3.9/site-packages/cwltool/workflow.py", line 150, in make_workflow_step
    return WorkflowStep(toolpath_object, pos, loadingContext, parentworkflowProv)
  File "/home/adrian/.local/lib/python3.9/site-packages/cwltool/workflow.py", line 228, in __init__
    self.embedded_tool = loadingContext.construct_tool_object(
  File "/home/adrian/.local/lib/python3.9/site-packages/cwltool/workflow.py", line 51, in default_make_tool
    return Workflow(toolpath_object, loadingContext)
  File "/home/adrian/.local/lib/python3.9/site-packages/cwltool/workflow.py", line 135, in __init__
    static_checker(
  File "/home/adrian/.local/lib/python3.9/site-packages/cwltool/checker.py", line 199, in static_checker
    step_inputs_val = check_all_types(src_dict, step_inputs, "source", param_to_step)
  File "/home/adrian/.local/lib/python3.9/site-packages/cwltool/checker.py", line 392, in check_all_types
    srcs_of_sink = [src_dict[parm_id]]
KeyError: 'file:///home/adrian/Dokumente/Coding/CWL/cwl-v1.2/tests/count-lines18-wf.cwl#step1/step1/file1'

I generated the file using the following 2 lines and copying the output into the file problem.cwl

a = load_document(doc="/home/adrian/Dokumente/Coding/CWL/cwl-v1.2/tests/count-lines18-wf.cwl")
print(a.save())