Clarifying "Absence of presence" and "presence of absence" (optional -> non optional task input with default)
See original GitHub issueEssentially, if I have some workflow and task that connections an optional value to a non-optional value. This should be a validation failure right?
workflow SmallWorkflow {
input {
String? myString
}
call Print {
input:
inp=myString
}
}
task Print {
input {
String inp = "default"
}
command <<<
echo '{inp}'
>>>
output {
String out = read_string(stdout())
}
}
How about if you slightly change the workflow to have:
task Print {
input {
String? inp = "default"
}
#...
}
My interpretation is:
- providing a value that is null => value becomes null
- not providing a value (ie, it’s not present in the
input: map
=> default is applied
But I don’t think the spec clarifies this, and looks like there is ambiguity in Cromwell and MiniWDL.
Edit: I believe the way to apply a default in a task is to do:
task Print {
input {
String? inp
String _inp = select_first([inp, "default"])
}
#...
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
crowd-input - Amazon SageMaker - AWS Documentation
A preset that becomes the default if the worker does not provide input. ... should be able to handle the presence or absence...
Read more >Allow Task Group parameters to be optional
I would like to have Task Group parameters to be optional, like having a checkmark in the UI. Currently there's only a default...
Read more >AWS step functions and optional parameters - Stack Overflow
I'm solving this using a combination of the Choice and Pass states. Given that a state machine at least gets an empty input...
Read more >The YANG 1.1 Data Modeling Language RFC 7950
A container node without a "presence" statement and that has at least one mandatory node as a child. o module: A YANG module...
Read more >RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
Router Advertisement: Routers advertise their presence together with various ... but not frequently enough to rely on an absence of advertisements to detect ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
miniwdl has a command-line flag
--no-quant-check
that relaxes some of the static checks and would probably make this pass validation.However, I’m not certain whether it would then exhibit the same runtime behavior as Cromwell. In particular, if
task Print
receives an explicit binding ofinp
toNone
, miniwdl would consider that a runtime error since its type is not optional; but another interpretation might use the default value in that case.By analogy, consider this python function
f() == 1
butf(x=None) == None
. “Absence of presence” isn’t the same as “presence of absence” (in python)I tried out your example, after adding
version 1.0
and fixing a typo. miniwdl check rejects it (correctly), cromwell allows it (incorrectly). To me this looks like a bug in cromwell. It looks like the presence of a default value is affecting the type cromwell creates for the task input.