diff --git a/bonobo/config/configurables.py b/bonobo/config/configurables.py index 50f41fc..eedd6ed 100644 --- a/bonobo/config/configurables.py +++ b/bonobo/config/configurables.py @@ -77,7 +77,6 @@ except: PartiallyConfigured = functools.partial else: - class PartiallyConfigured(_functools.partial): @property # TODO XXX cache this def _options_values(self): diff --git a/bonobo/execution/contexts/base.py b/bonobo/execution/contexts/base.py index 953f13c..4647d91 100644 --- a/bonobo/execution/contexts/base.py +++ b/bonobo/execution/contexts/base.py @@ -3,10 +3,9 @@ import sys from contextlib import contextmanager from logging import ERROR -from mondrian import term - from bonobo.util import deprecated from bonobo.util.objects import Wrapper, get_name +from mondrian import term @contextmanager @@ -23,7 +22,7 @@ def unrecoverable(error_handler): yield except Exception as exc: # pylint: disable=broad-except error_handler(*sys.exc_info(), level=ERROR) - raise # raise unrecoverableerror from x ? + raise # raise unrecoverableerror from exc ? class Lifecycle: @@ -60,7 +59,10 @@ class Lifecycle: @property def status(self): - """One character status for this node. """ + """ + One character status for this node. + + """ if self._defunct: return '!' if not self.started: diff --git a/bonobo/execution/contexts/node.py b/bonobo/execution/contexts/node.py index 316d9b8..cf9ec67 100644 --- a/bonobo/execution/contexts/node.py +++ b/bonobo/execution/contexts/node.py @@ -77,11 +77,18 @@ class NodeExecutionContext(BaseContext, WithStatistics): initial = self._get_initial_context() self._stack = ContextCurrifier(self.wrapped, *initial.args, **initial.kwargs) if isconfigurabletype(self.wrapped): - # Not normal to have a partially configured object here, so let's warn the user instead of having get into - # the hard trouble of understanding that by himself. - raise TypeError( - 'Configurables should be instanciated before execution starts.\nGot {!r}.\n'.format(self.wrapped) - ) + try: + self.wrapped = self.wrapped(_final=True) + except Exception as exc: + # Not normal to have a partially configured object here, so let's warn the user instead of having get into + # the hard trouble of understanding that by himself. + raise TypeError( + 'Configurables should be instanciated before execution starts.\nGot {!r}.\n'.format(self.wrapped) + ) from exc + else: + raise TypeError( + 'Configurables should be instanciated before execution starts.\nGot {!r}.\n'.format(self.wrapped) + ) self._stack.setup(self) except Exception: # Set the logging level to the lowest possible, to avoid double log.