is_missing methods for variables
To check in the task run method whether an input or output is missing, you can do either of these things:
-
self.inputs.myvar is self.MISSING_DATA
: problem whenMISSING_DATA
gets copied somehow -
self.inputs.myvar == self.MISSING_DATA
: problem when for example a numpy array
The best check is this
isinstance(self.inputs.myvar, hashing.MissingData)
This MR adds helpers to the Task
class to do this:
class MyTask(Task, input_names=["a"]):
def run(self):
# missing namespace
if self.missing_inputs.a:
...
else:
...
# getter with default when missing
value = self.get_input_value("a", default=10)
Edited by Wout De Nolf