fix: honor live scheduling revisions at dispatch
This commit is contained in:
@@ -494,7 +494,7 @@ def test_rpc_server_cli_enable_scheduler_with_store_root_builds_app(
|
||||
assert result.exit_code == 0, result.output
|
||||
assert captured["server"] is not None
|
||||
assert captured["app"] is not None
|
||||
assert captured["lifespan"] is not None
|
||||
assert callable(captured["lifespan"])
|
||||
|
||||
|
||||
def test_rpc_server_cli_config_scheduler_section_enables_without_flag(
|
||||
@@ -528,7 +528,7 @@ def test_rpc_server_cli_config_scheduler_section_enables_without_flag(
|
||||
result = CliRunner().invoke(app, ["--config", str(config_path)])
|
||||
|
||||
assert result.exit_code == 0, result.output
|
||||
assert captured["lifespan"] is not None
|
||||
assert callable(captured["lifespan"])
|
||||
|
||||
|
||||
def test_rpc_server_cli_flag_overrides_disabled_config_scheduler(
|
||||
|
||||
@@ -18,6 +18,7 @@ from wf_server.scheduling import (
|
||||
scheduler_lifespan,
|
||||
server_scheduler_config,
|
||||
)
|
||||
from wf_transport_rpc_http import create_rpc_app
|
||||
|
||||
|
||||
def test_server_scheduler_config_disabled_by_default() -> None:
|
||||
@@ -147,3 +148,25 @@ async def test_scheduler_lifespan_releases_lock_on_exit(tmp_path: Path) -> None:
|
||||
assert probe.held is True
|
||||
finally:
|
||||
probe.release()
|
||||
|
||||
|
||||
async def test_rpc_scheduler_lifespan_factory_starts_and_stops_service(
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""The RPC app receives a callable that lazily owns scheduler startup."""
|
||||
server = build_local_static_workflow_server(tmp_path)
|
||||
config = SchedulerServiceConfig(auto_tick=False)
|
||||
app = create_rpc_app(
|
||||
server,
|
||||
lifespan=lambda _app: scheduler_lifespan(server, config),
|
||||
)
|
||||
|
||||
async with app.router.lifespan_context(app):
|
||||
assert server.api.schedules._schedule_store().root == tmp_path
|
||||
|
||||
probe = SchedulerOwnership(tmp_path, owner="probe")
|
||||
probe.acquire()
|
||||
try:
|
||||
assert probe.held is True
|
||||
finally:
|
||||
probe.release()
|
||||
|
||||
Reference in New Issue
Block a user