mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
- 删除全部 Python 源码 (src/) 及 Alembic 迁移脚本,归档至 _deprecated_py_src/ - 重构 Rust gateway ai_pipeline: 拆分 planner/finalize 模块,新增 contracts/adaptation 层 - 重组 handlers 模块为 admin/public/proxy/internal/shared 子模块结构 - 新增 executor 模块,引入 Rust 原生数据库迁移 (aether-data/migrations) - 简化 CI/Docker 构建流程,移除 base image 二级构建,统一为单一 app image - 移除 Python 相关基础设施文件 (entrypoint.sh, gunicorn_conf.py, Dockerfile.base)
50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from enum import Enum
|
|
|
|
|
|
class RetryMode(str, Enum):
|
|
"""Retry mode for candidate attempts."""
|
|
|
|
PRE_EXPAND = "pre_expand" # pre-create retry slots (sync)
|
|
ON_DEMAND = "on_demand" # create retry record only when retry happens
|
|
DISABLED = "disabled" # no retry
|
|
|
|
|
|
class FailoverAction(str, Enum):
|
|
"""Failover decision after an attempt error."""
|
|
|
|
STOP = "stop" # stop failover (client error / non-retriable)
|
|
CONTINUE = "continue" # continue with next candidate
|
|
RETRY = "retry" # retry current candidate
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class RetryPolicy:
|
|
"""Unified retry policy."""
|
|
|
|
mode: RetryMode = RetryMode.DISABLED
|
|
max_retries: int = 1
|
|
retry_on_cached_only: bool = True
|
|
|
|
@classmethod
|
|
def for_sync_task(cls) -> "RetryPolicy":
|
|
return cls(mode=RetryMode.PRE_EXPAND, max_retries=2)
|
|
|
|
@classmethod
|
|
def for_async_task(cls) -> "RetryPolicy":
|
|
return cls(mode=RetryMode.DISABLED, max_retries=1)
|
|
|
|
@classmethod
|
|
def for_async_submit_with_retry(cls) -> "RetryPolicy":
|
|
return cls(mode=RetryMode.ON_DEMAND, max_retries=2)
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class SkipPolicy:
|
|
"""Rules for skipping unsupported candidates."""
|
|
|
|
allow_format_conversion: bool = True
|
|
supported_auth_types: set[str] | None = None
|