def METHOD_NAME(self, trainer, pl_module, exception):
    if isinstance(exception, SIGTERMException):
        caller = inspect.trace()[-1]
        class_name = caller[0].f_locals["self"].__class__.__name__
        self.raising_method = f"{class_name}:{caller.function}"