def _try_run(self, run_func: Callable[[], None]) -> None:
        """
        Try running the given function (training/prediction).

        Calls
            - :py:meth:`cxflow.hooks.AbstractHook.before_training`
            - :py:meth:`cxflow.hooks.AbstractHook.after_training`

        :param run_func: function to be run
        """
        # Initialization: before_training
        for hook in self._hooks:
            hook.before_training()

        try:
            run_func()
        except TrainingTerminated as ex:
            logging.info('Training terminated: %s', ex)

        # After training: after_training
        for hook in self._hooks:
            hook.after_training()