Barski-lab / cwl-airflow

Python package to extend Airflow functionality with CWL1.1 support
https://barski-lab.github.io/cwl-airflow
Apache License 2.0
185 stars 32 forks source link

Directory loadListing is ignored during execution #45

Closed mmcentre closed 3 years ago

mmcentre commented 3 years ago

Describe the bug My workflow has an input that is a directory and a step calls a sub-workflow to obtain a listing of this directory. It works with cwltool, but fails with cwl-airflow.

As I understand, the problem is that cwl-airflow parser creates a separate workflow file and does not propagate loadListing parameter.

Here is the original inputs:

inputs:
  input_path:
    type: Directory
    loadListing: shallow_listing

and here is what was generated by cwl-airflow:

    "inputs": [
        {
            "id": "input_path",
            "type": "Directory"
        }
    ],

(Fle: /Users/misha/harvard/projects/gis/tmp/bug_manual__2020-10-22T03_03_00.648020_00_00_m3t01st4/list/list_step_workflow.cwl)

To Reproduce

Run this workflow:

#!/usr/bin/env cwl-runner

cwlVersion: v1.1
class: Workflow

inputs:
  input_path:
    type: Directory
    loadListing: shallow_listing

outputs:
  final_data:
    type: File[]
    outputSource: list/files

steps:
  list:
    run: ls.cwl
    in:
      dir: input_path
    out: [files]

Where ls.cwl is:

#!/usr/bin/env cwl-runner

cwlVersion: v1.1
class: ExpressionTool

requirements:
  InlineJavascriptRequirement: {}

inputs:
  dir: Directory

outputs:
  files: Any[]

expression: '${return {"files": inputs.dir.listing};}'

With Job description (replace path to something on your system):

{
  "job": {
    "input_path": {
      "class": "Directory",
      "location": "/Users/misha/harvard/projects/gis/shapes/zip_shape_files"
    }
 }
}

Expected behavior To work correctly

Screenshots and logs From Log:

[workflow ] start [workflow ] starting step list [step list] start [step list] Output is missing expected field file:///Users/misha/harvard/projects/versions/master/climate_data_pipeline/cwl/bug.cwl#list/files [step list] completed permanentFail

Desktop (please complete the following information):

michael-kotliar commented 3 years ago

@mmcentre Thank you for submitting a bug report. The latest commit in master branch should fix this problem. Trying to keep up with all cool features of CWL standard:)