Key error function find_output with undeclared output parameters
This problem will cause critical failure with OTBTF PatchesExtraction
, may be any other app when using in memory.
Steps to reproduce :
- init PatchesExtraction with outputlabels param but skip other source*.out parameters
e.g. you want to set parameters type later using
.write
The app will run as intended. Later, the problem will occur when setting thefinished
attribute : here I added a function to check parameters outputs, my bad :
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Input In [31], in <cell line: 1>()
----> 1 a.execute()
File ~/Code/git/pyotb/pyotb/core.py:616, in App.execute(self)
613 except RuntimeError:
614 pass # this is when there is no value for key
--> 616 return self.finished
File ~/Code/git/pyotb/pyotb/core.py:531, in App.finished(self)
525 @property
526 def finished(self):
527 """
528 Property to store whether App has been executed
529 :return: True or False
530 """
--> 531 if self._finished and self.find_output():
532 return True
533 return False
File ~/Code/git/pyotb/pyotb/core.py:628, in App.find_output(self)
626 missing = []
627 for param in self.output_parameters_keys:
--> 628 filename = self.parameters[param]
629 if Path(filename).exists():
630 files.append(filename)
KeyError: 'source1.out'
So here in output_parameters_keys, we have every available param, but they don't exists in self.parameters
TODO: catch key error, make this more user friendly + enhance .finished and find_outputs()
Edited by Vincent Delbar