feat(v2): wire worker role lifecycle
This commit is contained in:
@@ -7,13 +7,14 @@ import asyncio
|
||||
from collections.abc import Callable, Sequence
|
||||
from pathlib import Path
|
||||
|
||||
from alembic import command
|
||||
from alembic.config import Config
|
||||
|
||||
from alembic import command
|
||||
from backup_tool import __version__
|
||||
from backup_tool.config import Settings
|
||||
|
||||
from .db.engine import assert_schema_current, create_engine
|
||||
from .worker import run_worker
|
||||
|
||||
RoleHandler = Callable[[Settings], int]
|
||||
DATABASE_ROLES = ("web", "scheduler", "worker", "admin")
|
||||
@@ -23,7 +24,12 @@ def _placeholder_role(_settings: Settings) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
ROLE_HANDLERS: dict[str, RoleHandler] = {role: _placeholder_role for role in DATABASE_ROLES}
|
||||
ROLE_HANDLERS: dict[str, RoleHandler] = {
|
||||
"web": _placeholder_role,
|
||||
"scheduler": _placeholder_role,
|
||||
"worker": run_worker,
|
||||
"admin": _placeholder_role,
|
||||
}
|
||||
|
||||
|
||||
def build_parser() -> argparse.ArgumentParser:
|
||||
|
||||
Reference in New Issue
Block a user