Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Made 'size' accept empty file? values #2422
Conversation
| @@ -2,7 +2,7 @@ import sbt._ | ||
| object Dependencies { | ||
| lazy val lenthallV = "0.25" | ||
| - lazy val wdl4sV = "0.13" | ||
| + lazy val wdl4sV = "0.14-c3be413-SNAP" |
cjllanwarne
Jul 10, 2017
Contributor
hmm, that's automatic when we push to WDL4S develop though, right?
| @@ -122,11 +122,20 @@ trait ReadLikeFunctions extends PathFactory { this: WdlStandardLibraryFunctions | ||
| override def size(params: Seq[Try[WdlValue]]): Try[WdlFloat] = { | ||
| def toUnit(wdlValue: Try[WdlValue]) = wdlValue flatMap { unit => Try(MemoryUnit.fromSuffix(unit.valueString)) } | ||
| + def optionalSafeFileSize(value: WdlValue): Try[Double] = value match { | ||
| + case f: WdlFile => Try(buildPath(f.valueString).size.toDouble) | ||
| + case f if WdlFileType.isCoerceableFrom(f.wdlType) => WdlFileType.coerceRawValue(f) map { coerced => buildPath(coerced.asInstanceOf[WdlFile].valueString).size.toDouble } |
mcovarr
Jul 6, 2017
Contributor
rather than map and essentially duplicate the line above, you could flatMap and recurse
mcovarr
Jul 6, 2017
Contributor
i.e.
case f if WdlFileType.isCoerceableFrom(f.wdlType) => WdlFileType.coerceRawValue(f) flatMap optionalSafeFileSize
|
oh and some tests wouldn't hurt |
|
Including centaur :) |
|
Added some tests. @geoffjentry I think these unit tests are comprehensive enough without (re-)testing that Cromwell wires variables into engine functions correctly in centaur. Hope you agree? |
|
@cjllanwarne My centaur comment was more that ideally we'd be testing every function in centaur. I'm sure this wouldn't be the first one we're slacking on, don't let me hold you up. |
|
@geoffjentry I'll rephrase:
|
|
I'll file that under the "don't let me hold you up" part |
|
@cjllanwarne realized you were probably looping back due to lack of |
cjllanwarne
added some commits
Jul 5, 2017
|
Will return... |
cjllanwarne commentedJul 5, 2017
No description provided.