Rename orchestration, splice and routes: a Renamer runs one rename at a time, closing the gate, taking the controller lock and holding the engine, each waiting without a limit and saying what it waits for (summary rename status, rename_waiting); DELETE on the pending request or a closed connection calls it off until the journal begins (409 aborted); then journal, steps and audit, retried in the background on failure (503 completing); splice_renamed rebuilds the affected flows under the held lock keeping stopped, paused and parked work, history limits and device wiring refreshed before activation; AlertManager.rename and EventBus.rename/settle follow the names; flow and dashboard rename routes answer by code and repeat stored results; renamed, dashboard_changed and pipeline_rebuilt after release; fluksio serve reads flow files without building a FlowStore

This commit is contained in:
2026-11-02 22:14:44 +01:00
parent 2d65118d82
commit ba4aae390d
16 changed files with 2174 additions and 22 deletions
+22
View File
@@ -50,7 +50,9 @@ from fluksio.flow.provision import load_provisioners
from fluksio.flow.queue import MemoryWorkQueue, RedisWorkQueue, WorkQueue
from fluksio.flow.remote import RemoteWorkerHub
from fluksio.flow.rename import (
RenameConflict,
RenameGate,
Renamer,
recover_documents,
recover_runtime,
retry_until_done,
@@ -464,6 +466,14 @@ async def lifespan(app: FastAPI) -> AsyncIterator[None]:
# On the app so a superuser can ask it to flush now.
app.state.metrics_collector = MetricsCollector(event_bus)
_background(app.state.metrics_collector.run(), "metrics-collector")
app.state.renamer = Renamer(
controller,
dashboards,
rename_gate,
event_bus,
alerts=alerts,
metrics=app.state.metrics_collector,
)
_background(_sweep_artifacts(artifacts, controller), "artifact-gc")
if volatile is not None:
_background(_trim_volatile(volatile), "artifact-ring")
@@ -688,6 +698,18 @@ async def engine_held(request: Request, exc: EngineHeld) -> JSONResponse: # noq
)
@app.exception_handler(RenameConflict)
async def rename_conflict(request: Request, exc: RenameConflict) -> JSONResponse: # noqa: ARG001
"""A rename answered with a code a client acts on, as the gate's 503 is:
a refusal or a stale request (409), a key that is no key (422), or one
finishing (503, which is worth retrying)."""
return JSONResponse(
status_code=exc.status,
content={"detail": exc.detail, "code": exc.code, **exc.extra},
headers={"Retry-After": "5"} if exc.status == 503 else None,
)
# Tagged because the operation-id builder reads the first tag; the route
# itself stays out of the schema.
@app.get(