Update: July 26, 2019
This section of the forum is now closed; we are working on a new support model for WDL that we will share here shortly. For Cromwell-specific issues, see the Cromwell docs and post questions on Github.

Can't use sub function on output from a previous task

mshandmshand Member, Broadie, Dev ✭✭

The following wdl thows an error:

# Calculates sum of a list of floats
task SumFloats {
  Array[Float] sizes
  Int preemptible_tries

  command <<<
  python -c "print ${sep="+" sizes}"
  output {
    Float total_size = read_float(stdout())
  runtime {
    docker: "python:2.7"
    preemptible: preemptible_tries

workflow PairedEndSingleSampleWorkflow {

  Array[Float] a = [".5",".3",".4","1.0"]

  # Sum the read group bam sizes to approximate the aggregated bam size
  call SumFloats {
      sizes = a,
      preemptible_tries = 0

  Int md_total_disk_size = sub(SumFloats.total_size, "\\..*", "")

The error (on version 26) is:

Workflow has invalid declarations: Could not evaluate workflow declarations:
    Invalid parameters for engine function sub: (Failure(wdl4s.exception.OutputVariableLookupException: Could not find outputs for call PairedEndSingleSampleWorkflow.SumFloats at index None),Success(WdlString(\..*)),Success(WdlString())).

I don't know if this is still an issue on other versions besides 26. I did try using wdltool to generate a graph and the sub function does have the correct arrow coming from the SumFloats task.


Sign In or Register to comment.