Skip to content
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

cwltool throws an error when secondaryFiles are specified as a list in a workflow and as a single element in a tool #1912

Open
ThomasHickman opened this issue Sep 22, 2023 · 0 comments

Comments

@ThomasHickman
Copy link
Member

Expected Behavior

No error should be thrown

Actual Behavior

An error is thrown

Workflow Code

workflow.cwl

cwlVersion: v1.2
class: Workflow

inputs:
  file: 
    type: File
    secondaryFiles:
      - .csi

steps:
  - id: run tool
    run: tool.cwl
    in:
      file: file
    out: []

outputs: []

tool.cwl

cwlVersion: v1.2
class: CommandLineTool

inputs:
  file: 
    type: File
    secondaryFiles: .csi

outputs: []

Full Traceback

$ cwltool --debug --validate ./workflow.cwl
INFO /home/user/Documents/checkouts/cwltool/venv/bin/cwltool 3.1.20230630061538
INFO Resolved './workflow.cwl' to 'file:///home/user/test-folder/workflow.cwl'
ERROR I'm sorry, I couldn't load this CWL file.
The error was: 
Traceback (most recent call last):
  File "/home/user/Documents/checkouts/cwltool/cwltool/main.py", line 1119, in main
    tool = make_tool(uri, loadingContext)
  File "/home/user/Documents/checkouts/cwltool/cwltool/load_tool.py", line 588, in make_tool
    tool = loadingContext.construct_tool_object(processobj, loadingContext)
  File "/home/user/Documents/checkouts/cwltool/cwltool/workflow.py", line 55, in default_make_tool
    return Workflow(toolpath_object, loadingContext)
  File "/home/user/Documents/checkouts/cwltool/cwltool/workflow.py", line 137, in __init__
    static_checker(
  File "/home/user/Documents/checkouts/cwltool/cwltool/checker.py", line 211, in static_checker
    sinksf = sorted(
  File "/home/user/Documents/checkouts/cwltool/cwltool/checker.py", line 212, in <genexpr>
    p["pattern"] for p in sink.get("secondaryFiles", []) if p.get("required", True)
AttributeError: 'str' object has no attribute 'get'

Your Environment

  • cwltool version:
    Check using cwltool --version
$ cwltool --version
/home/user/Documents/checkouts/cwltool/venv/bin/cwltool 3.1.20230630061538

(this is using the latest commit in main)

I think the cause of this is two-fold:

  • The code that checks whether secondaryFiles are compatible warns even if the src and sink are the same, but one represented as an array, and one as a single value in secondaryFiles
  • The code that reports this doesn't account for the fact that secondaryFiles properties may be an array or a single element
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

1 participant