File/String? coercion to File not allowed
See original GitHub issueHi,
I’ve been developing using WDL for quite some time now, and while I find the language powerful, there’s always been one validation error that prevents me from optimally structuring my workflows.
Whenever I make a task optional and try to pipe a File to a mandatory task I get the error “Cannot coerce expression of type ‘File?’ to 'File’”. The same goes for coercing a String? to File.
See the following example:
version 1.0
import "A.wdl" as A
import "B.wdl" as B
workflow AB_driver {
input {
Boolean run_A
File? preexisting_foo #For when the user sets run_A=false
}
if (run_A) {
call task A.A_workflow as A {
input:
…
#output:
# File foo # Reference file that takes a long while to generate and the user will reuse for future workflow submissions with run_A=false.
}
}
call task B.B_workflow as B {
input:
foo=if (run_A) then A.foo else preexisting_foo # validation with womtools throws the error and disallows me from uploading the workflow
}
output {…}
}
From my standpoint, I know that either A.foo will be generated by workflow A or the user will skip A and provide their own preexisting_foo. I do realize there is the chance that the user could accidentally set run_A to false
and not provide the preexisting foo File, which would result in a failure. Ideally I would like that possibility to be permitted with a warning and for me to be able to catch and handle that error on my own.
There are plenty of alternatives to structuring a WDL script like this, such as having users visit A and B individually to launch them one after the other, but for my work I have the specific purpose of needing one overarching workflow that can run all subworkflows back-to-back on the Single Cell Portal. In the past I have been able to achieve this goal using some imperfect workarounds, but it would be much more desirable to be able to structure my workflows as shown in the above example.
Thanks! James
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
As @yfarjoun mentioned
select_first
seems like it would solve your problem. As a side note, you could omit therun_A
input boolean and use! defined(preexisting_foo)
instead, then you won’t have the issue of foo being absent at all. Unless you want to be able to runA
even ifpreexisting_foo
is provided.can you use
?