Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions keckdrpframework/primitives/base_primitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def _perform (self):
@author: skwok
"""

import traceback

class BasePrimitive:
"""
Expand All @@ -53,12 +54,16 @@ def _perform(self):
raise Exception("Not yet implemented")

def apply(self):
if self._pre_condition():
self.output = self._perform()
if self._post_condition():
return self.output
try:
if self._pre_condition():
self.output = self._perform()
if self._post_condition():
return self.output
except Exception as e:
self.logger.error(f"Failed executing primitive {self.__class__.__name__}: {e}\n{traceback.format_exc()}")
raise(e)
return None

def __call__(self):
"""
Makes objects of this calls callable.
Expand Down