Skip to content

Scatter before a when occurs #1668

Open
@jjkoehorst

Description

@jjkoehorst

Expected Behavior

We are using a when to check if a variable is given to a workflow or not to execute a specific step.
When this variable (a String[]) we apply a when: $(inputs.kraken_database !== null) check to see if this variable is given. In addition we apply a scatter on this variable to run it for each of the elements.

Actual Behavior

It tries to perform the scatter before the when is processed.

INFO [workflow ] starting step illumina_quality_kraken2
ERROR Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/cwltool/workflow_job.py", line 731, in try_make_job
    emptyscatter = [
  File "/usr/local/lib/python3.8/dist-packages/cwltool/workflow_job.py", line 732, in <listcomp>
    shortname(s) for s in scatter if len(cast(Sized, inputobj[s])) == 0
TypeError: object of type 'NoneType' has no len()
INFO [workflow ] completed permanentFail

Workflow Code

  illumina_quality_kraken2:
    label: Kraken2
    doc: Taxonomic classification of FASTQ reads
    when: $(inputs.kraken_database !== null)
    run: ../kraken2/kraken2.cwl
    scatter: database
    in:
      tmp_id: identifier
      identifier:
        valueFrom: $(inputs.tmp_id)_Qfiltered
      threads: threads
      kraken_database: kraken_database
      database: kraken_database
      forward_reads: phix_filter/out_forward_reads
      reverse_reads: phix_filter/out_reverse_reads
      paired_end: 
        default: true
    out: [sample_report]

Your Environment

  • cwltool version:
    /usr/local/bin/cwltool 3.1.20220224085855

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions