Implement FastAPI Temporal MVP pipeline

This commit is contained in:
Codex
2026-03-27 00:10:28 +08:00
commit cc03da8a94
52 changed files with 3619 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
"""Temporal client helpers."""
import asyncio
from temporalio.client import Client
from app.config.settings import get_settings
_client: Client | None = None
_client_lock = asyncio.Lock()
async def get_temporal_client() -> Client:
"""Return a cached Temporal client."""
global _client
if _client is not None:
return _client
async with _client_lock:
if _client is None:
settings = get_settings()
_client = await Client.connect(
settings.temporal_address,
namespace=settings.temporal_namespace,
)
return _client
def set_temporal_client(client: Client | None) -> None:
"""Override the cached Temporal client, primarily for tests."""
global _client
_client = client