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

WDL optional output support [BA-6545] #5720

Merged
merged 9 commits into from
Aug 7, 2020
Merged

Conversation

mcovarr
Copy link
Contributor

@mcovarr mcovarr commented Aug 5, 2020

No description provided.

Copy link
Contributor

@cjllanwarne cjllanwarne left a 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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.

Copy link
Contributor Author

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?

Copy link
Contributor

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"
Copy link
Contributor

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 = ...?

Copy link
Contributor

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: ... }

Copy link
Contributor

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

Copy link

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?

Copy link
Contributor

@cjllanwarne cjllanwarne Aug 6, 2020

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

Copy link
Contributor Author

@mcovarr mcovarr Aug 6, 2020

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. 🙂

Copy link

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)
Copy link
Contributor

@cjllanwarne cjllanwarne Aug 6, 2020

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 FileEvaluations 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
}

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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
Copy link
Contributor

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 WomObjects with defined shapes)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in progress

@lchabot-sm lchabot-sm requested a review from grsterin August 7, 2020 14:49
task unsupported_structs {
command {
touch yes
# no no touching
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcovarr mcovarr force-pushed the mlc_wdl_optional_outputs branch from a23d3a0 to ae8c84c Compare August 7, 2020 16:26
@mcovarr mcovarr merged commit 90e83fb into develop Aug 7, 2020
@mcovarr mcovarr deleted the mlc_wdl_optional_outputs branch August 7, 2020 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants