def METHOD_NAME(self, reason: str):
    """Stop the current task.
    This method is to be called by the Learner's training or validation code when it runs into
    a situation that the task processing cannot continue.
    Args:
        reason: why the task cannot continue
    Returns:
    """
    self.log_error(self.fl_ctx, f"Task stopped: {reason}")
    raise TaskExecutionError(reason)