feat(scheduler): admin-editable job intervals (DB-backed, live reschedule)
Add scheduler_settings (per-job interval override, migration 0015) and a
PATCH /api/admin/scheduler/jobs/{id} that persists the override and live-
reschedules the running APScheduler job. Intervals load from the DB (env
defaults as fallback); the snapshot reports the live trigger interval.
This commit is contained in:
parent
bad7bba3f9
commit
79d645c2e2
4 changed files with 126 additions and 41 deletions
30
backend/alembic/versions/0015_scheduler_settings.py
Normal file
30
backend/alembic/versions/0015_scheduler_settings.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
"""scheduler job interval overrides
|
||||
|
||||
Revision ID: 0015_scheduler_settings
|
||||
Revises: 0014_demo_account
|
||||
Create Date: 2026-06-16
|
||||
|
||||
Adds scheduler_settings: a per-job run-interval override (minutes), editable from the admin
|
||||
Scheduler dashboard. Absent row = use the env/config default, so this is purely additive.
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision: str = "0015_scheduler_settings"
|
||||
down_revision: Union[str, None] = "0014_demo_account"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"scheduler_settings",
|
||||
sa.Column("job_id", sa.String(length=40), primary_key=True),
|
||||
sa.Column("interval_minutes", sa.Integer(), nullable=False),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_table("scheduler_settings")
|
||||
Loading…
Add table
Add a link
Reference in a new issue