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

Conditional Workflow #77

Open
kokleong9406 opened this issue Dec 2, 2021 · 1 comment
Open

Conditional Workflow #77

kokleong9406 opened this issue Dec 2, 2021 · 1 comment
Assignees

Comments

@kokleong9406
Copy link

kokleong9406 commented Dec 2, 2021

Hi Michael,

My current cwltool version is 3.1.20211107152837. Currently I have a conditional workflow. When I tried to run using cwltool in command prompt, I am able to get the output successfully. But when I tried to run it in cwl-airflow, I am not able to. After checking the log file, this is what is shown:

Source 'out2a' of
                                                                                                                                         type ["null",
                                                                                                                                         "File"] may be
                                                                                                                                         incompatible
cwl_tmp_folder/***_11-conditional-workflow-v2_manual__2021-12-02T09_46_06.468109_00_00_ul3lyxy9/step2a/step2a_step_workflow.cwl:29:13:   with sink
                                                                                                                                           'step2a_out2a' of
                                                                                                                                           type "File"
cwl_tmp_folder/***_11-conditional-workflow-v2_manual__2021-12-02T09_46_06.468109_00_00_ul3lyxy9/step2a/step2a_step_workflow.cwl:27:9:    Source is from
                                                                                                                                           conditional step
                                                                                                                                           and may produce
                                                                                                                                           `null`

Below is how my conditional workflow file looks like:

#!/usr/bin/env cwl-runner

class: Workflow
cwlVersion: v1.2

inputs:
  value: int

steps:
  step1:
    in:
      in1: value
    run: 11-foo-v2.cwl
    out: [out1]
  step2a:
    in:
      in2a: step1/out1
    run: 11-step2a-v2.cwl
    when: $(inputs.in2a > 5)
    out: [out2a]
  step2b:
    in:
      in2b: step1/out1
    run: 11-step2b-v2.cwl
    when: $(inputs.in2b < 5)
    out: [out2b]

outputs:
  out2:
    type: 
      - File
      - "null"
    outputSource: 
      - step2a/out2a
      - step2b/out2b
    pickValue: the_only_non_null

requirements:
  InlineJavascriptRequirement: {}
  MultipleInputFeatureRequirement: {}

[Edit: Further supplement with the other CommandLineTool]

Step1: 11-foo-v2.cwl

#!/usr/bin/env cwl-runner

class: CommandLineTool

cwlVersion: v1.2

requirements:
  - class: InlineJavascriptRequirement
  - class: InitialWorkDirRequirement
    listing:
      - entryname: echo_job.sh
        entry: |-
          echo $(inputs.in1) > hello1.txt
          echo $(inputs.in1) hahaha > hello2.txt

baseCommand: [sh]

arguments: [echo_job.sh]

inputs:
  in1: 
    type: int

outputs: 
  out1:
    type: int
    outputBinding:
      glob: 
        - "hello1.txt"
      loadContents: true
      outputEval: $(parseInt(self[0].contents))

Step2a: 11-step2a-v2.cwl

#!/usr/bin/env cwl-runner

class: CommandLineTool

cwlVersion: v1.2

requirements:
  - class: InlineJavascriptRequirement

baseCommand: [echo]

arguments:
  - $(inputs.in2a)

inputs:
  in2a:
    type: int

outputs:
  out2a:
    type: stdout

stdout: out2a.txt

Step2b: 11-step2b-v2.cwl

#!/usr/bin/env cwl-runner

class: CommandLineTool

cwlVersion: v1.2

requirements:
  - class: InlineJavascriptRequirement

baseCommand: [echo]

arguments:
  - $(inputs.in2b)

inputs:
  in2b:
    type: int

outputs:
  out2b:
    type: stdout

stdout: out2b.txt

I have already specify that out2 may accept "File" and "null" from the outputSource though. Meanwhile I will explore whether there is anything wrong with my cwl syntax despite having ran it successfully with "cwltool". DO you know why I am encountering this when ran in cwl-airflow?

@michael-kotliar
Copy link
Member

@kokleong9406 Thank you for submitting an issue. I will investigate it and come back to you shortly.

Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants