)
        )
        
        self.state = TaskInstanceState.UP_FOR_RESCHEDULE
        
        
        self._try_number -= 1
        self.clear_next_method_args()
        session.merge(self)
        session.commit()
        self.log.info("Rescheduling task, marking task as UP_FOR_RESCHEDULE")
    @staticmethod
    def get_truncated_error_traceback(error: BaseException, truncate_to: Callable) -> TracebackType | None:
        """
        Truncate the traceback of an exception to the first frame called from within a given function.
        :param error: exception to get traceback from
        :param truncate_to: Function to truncate TB to. Must have a ``__code__`` attribute
        :meta private:
        """
        tb = error.__traceback__
        code = truncate_to.__func__.__code__  
        while tb is not None:
            if tb.tb_frame.f_code is code:
                return tb.tb_next
            tb = tb.tb_next
        return tb or error.__traceback__
    @classmethod
    @internal_api_call
    @provide_session
    def fetch_handle_failure_context(