-
Notifications
You must be signed in to change notification settings - Fork 360
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
WDL optional output support [BA-6545] #5720
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good as is but knowing even more about what cases we support would be great.
CHANGELOG.md
Outdated
|
||
### Bug fixes | ||
|
||
* Wired through support for WDL optional output files on the PAPI v2 backend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Wired through support for WDL optional output files on the PAPI v2 backend. | |
* Added support for WDL optional output files on the PAPI v2 backend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this still belong under 'Bug fixes' if it's an addition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it's new functionality not a bug fix
echo "No file is being generated here..." | ||
} | ||
output { | ||
File? nope = "nope" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For completeness do you also want a File? yup = ...
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And maybe:
Array[File?] nopes_and_yups = ...
Map[String, File?] nopes_and_yups_map = { "yup": ..., "nope": ... }
Struct foo = object { yup_field: ..., nope_field: ... }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some all or none of the above additions might or might not work, I think it's valuable even just to know which we're enabling and which are still TODO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're autogenerating WDL wrappers for all GATK and Picard tools, and one case we 're hoping to get support for is:
output {
File? nope = ${stringVariableInitializedToNull}
}
Currently this fails (v51 anyway, see https://broadworkbench.atlassian.net/projects/BA/issues/BA-6530). The only workaround I can see at the moment is to use a non-null, made-up fake file name, and hope it doesn't exist. Or maybe there is some other solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cmnbroad I think you'd be better off not wrapping it in ${}
? That's interpolating a null into a string, creating a (non-null) empty String which isn't the same as a null string. I suspect there might still be some fixup to make it work but that's probably a necessary first step
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cmnbroad I ran a test with these changes using your WDL from BA-6530. createFile = true
and createFile = false
jobs now succeed on PAPI but the createFile = false
variant subsequently fails with
Bad output 'no_optional_output_task.createdFile': IllegalArgumentException: Cannot coerce the empty String value "" into a File.
at cromwell.backend.standard.StandardAsyncExecutionActor.$anonfun$handleExecutionSuccess$1(StandardAsyncExecutionActor.scala:916)
at scala.util.Success.$anonfun$map$1(Try.scala:255)
at scala.util.Success.map(Try.scala:213)
at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
...
which seems like a different / additional problem; I would defer to @cjllanwarne as to whether we should expect this coercion to work. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like @cjllanwarne's suggestion seems to work with my simple test case. I'll make that change to my WDL generator code and rerun my tests (which take hours to run...) but I suspect that will do it. Thanks to you both for your help!
|
||
override def evaluateFiles(inputs: Map[String, WomValue], ioFunctionSet: IoFunctionSet, coerceTo: WomType): ErrorOr[Set[FileEvaluation]] = { | ||
expressionElement.evaluateFilesNeededToEvaluate(inputs, ioFunctionSet, coerceTo) map { _ map { | ||
FileEvaluation(_, optional = areAllFileTypesInWomTypeOptional(coerceTo), secondary = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess ideally the evaluateFilesNeededToEvaluate
would return FileEvaluation
s natively rather than having to map in this all-or-nothing way. This way is still infinitely better than the current state of the world but it has a slight potential for risk in edge cases like:
Struct foo {
File bam
File? bai
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or Pair[File, File?]
, I suppose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But happy to leave this as a TODO after the release and/or if anyone cares about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exactly. Given the current state of file evaluation I'm going to make this cautious and only mark files as optional for unambiguous cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh btw call caching appears to be broken with missing optional output files so I'll need to make a ticket for that too 🤕
case WomArrayType(inner) => areAllFileTypesInWomTypeOptional(inner) | ||
case WomMapType(_, inner) => areAllFileTypesInWomTypeOptional(inner) | ||
case WomPairType(leftType, rightType) => areAllFileTypesInWomTypeOptional(leftType) && areAllFileTypesInWomTypeOptional(rightType) | ||
case _ => false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a case for structs (which I believe are expressed as WomObject
s with defined shapes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in progress
task unsupported_structs { | ||
command { | ||
touch yes | ||
# no no touching |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a23d3a0
to
ae8c84c
Compare
No description provided.