broadinstitute / wdl4s

Scala bindings for WDL
3 stars 5 forks source link

WDL->WOM: Nested expressions must be able to access outer values #217

Closed cjllanwarne closed 7 years ago

cjllanwarne commented 7 years ago

EG this can be converted from WDL to WOM:

import "import_me.wdl" as import_me

workflow outer {

  Array[Int] xs
  scatter (x in xs) {
    Boolean b
    if (b) {
      call import_me.inner as inner { input: i = x }
    }
  }
  output {
    Array[String?] outer_out = inner.out
  }
}

But if we move the b outside the scatter:

import "import_me.wdl" as import_me

workflow outer {
  Boolean b
  Array[Int] xs
  scatter (x in xs) {
    if (b) {
      call import_me.inner as inner { input: i = x }
    }
  }
  output {
    Array[String?] outer_out = inner.out
  }
}

Then we get an error:

Exception in thread "main" java.lang.Exception: Can't build WOM executable from WDL namespace:
No input b found evaluating inputs for expression b
key not found: b
Horneth commented 7 years ago

This has implications in Cromwell. Namely if b was a Call instead of being a boolean, and import_me.inner depended on an output of b, when we evaluate the inputs of import_me.inner it will make a difference whether or not b is a sibling of import_me.inner. If it is we want to get the output with the same shard number from the output store, otherwise the output with no index (if we rule out nested scatters). We could simplify and say "always look for the same index and if it's not there take the output with no index" but it would be better to know for sure which one we need.

mcovarr commented 7 years ago

Sorry if this is a dumb question, but do you understand what's going wrong here? It's obvious looking at this statically what b is supposed to be whether it's inside or outside the scatter. Also it seems a little weird to me that b can even be a GraphInputNode inside the scatter...

katevoss commented 7 years ago

Issue moved to broadinstitute/cromwell #2724 via ZenHub