INNER CODE UNIT · Python

_safe_call

IDSIA/sacred · sacred/run.py:417

    def _safe_call(self, obs, method, **kwargs):
        if obs not in self._failed_observers:
            try:
                getattr(obs, method)(**kwargs)
            except Exception as e:
                self._failed_observers.append(obs)
                self.run_logger.warning(
                    "An error ocurred in the '{}' " "observer: {}".format(obs, e)
                )

    def _final_call(self, observer, method, **kwargs):
        try:
            getattr(observer, method)(**kwargs)
        except Exception:
            # Feels dirty to catch all exceptions, but it is just for
            # finishing up, so we don't want one observer to kill the
            # others
            self.run_logger.error(tb.format_exc())

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…