feat: enable requested source collection schedules
Some checks failed
Mostovik Backend CI/CD / Tests and lint (push) Failing after 6s
Mostovik Backend CI/CD / Build linux/amd64 release images (push) Has been skipped
Mostovik Backend CI/CD / Deploy dev (push) Has been skipped
Mostovik Backend CI/CD / Deploy and verify internal main (push) Has been skipped

This commit is contained in:
Aleksandr Meshchryakov
2026-10-05 18:31:13 +02:00
parent 24616d160f
commit af02d1ce8a
8 changed files with 143 additions and 19 deletions

View File

@@ -0,0 +1,35 @@
"""Activate the five source schedules explicitly requested by the owner."""
from django.db import migrations
SCHEDULE_NAMES = (
"parser:fssp-enforcement-proceedings:daily",
"parser:stock-exchange-activity:daily",
"parser:checko-leasing:monthly",
"parser:checko-messages:monthly",
"parser:checko-licenses:monthly",
)
def enable_schedules(apps, schema_editor):
tasks = apps.get_model("django_celery_beat", "PeriodicTask")
for name in SCHEDULE_NAMES:
task = tasks.objects.get(name=name)
task.enabled = True
task.description = (
"Enabled by explicit owner request on 2026-10-05. "
"Runtime failures preserve previous data; readiness requires a successful run."
)
task.save(update_fields=["enabled", "description"])
def disable_schedules(apps, schema_editor):
tasks = apps.get_model("django_celery_beat", "PeriodicTask")
for task in tasks.objects.filter(name__in=SCHEDULE_NAMES):
task.enabled = False
task.save(update_fields=["enabled"])
class Migration(migrations.Migration):
dependencies = [("parsers", "0047_exchange_disabled_schedule")]
operations = [migrations.RunPython(enable_schedules, disable_schedules)]