aboutsummaryrefslogtreecommitdiff
path: root/src/argaze/DataFeatures.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/argaze/DataFeatures.py')
-rw-r--r--src/argaze/DataFeatures.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/argaze/DataFeatures.py b/src/argaze/DataFeatures.py
index 0791d5e..b4874d3 100644
--- a/src/argaze/DataFeatures.py
+++ b/src/argaze/DataFeatures.py
@@ -857,6 +857,7 @@ class PipelineStepObject():
self.__image_parameters = {}
# Init protected attributes
+ self._catch_exceptions = False
self._image_parameters = {}
self._draw_parameters = {}
@@ -941,6 +942,21 @@ class PipelineStepObject():
return self.__execution_times
@property
+ def catch_exceptions(self) -> bool:
+ """Catch pipeline step method exception instead of crashing execution."""
+ return self._catch_exceptions
+
+ @catch_exceptions.setter
+ def catch_exceptions(self, catch_exceptions: bool):
+
+ self._catch_exceptions = catch_exceptions
+
+ # Propagate to children
+ for child in self.children():
+
+ child.catch_exceptions = self._catch_exceptions
+
+ @property
def image_parameters(self) -> dict:
"""image method parameters dictionary."""
return self._image_parameters
@@ -1138,8 +1154,7 @@ def PipelineStepMethod(method):
PipelineStepMethod must have a timestamp as first argument.
"""
- def wrapper(self, *args, timestamp: int | float = None, unwrap: bool = False, catch_exceptions: bool = True,
- **kwargs):
+ def wrapper(self, *args, timestamp: int | float = None, unwrap: bool = False, **kwargs):
"""Wrap pipeline step method to measure execution time.
Parameters:
@@ -1148,7 +1163,6 @@ def PipelineStepMethod(method):
timestamp: optional method call timestamp (unit doesn't matter) if first args parameter is not a
TimestampedObject instance.
unwrap: extra arguments used in wrapper function to call wrapped method directly.
- catch_exceptions: extra arguments used in wrapper function to catch exception.
"""
if timestamp is None and len(args) > 0:
@@ -1169,7 +1183,7 @@ def PipelineStepMethod(method):
exception = None
result = None
- if not catch_exceptions:
+ if not self._catch_exceptions:
# Execute wrapped method without catching exceptions
result = method(self, *args, **kwargs)