akvo.rsr.usecases.django_q.schedules module

class akvo.rsr.usecases.django_q.schedules.ScheduleSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

class Meta[source]

Bases: object

fields = ['name', 'func', 'args', 'kwargs', 'cron']
model

alias of Schedule

class akvo.rsr.usecases.django_q.schedules.SyncAction(to_add: List[Schedule], to_modify: List[Schedule], to_delete: List[Schedule])[source]

Bases: object

The operations to be done on the DB in order to sync the django-q schedules from the settings with the existing django-q schedules in the DB

to_add: List[Schedule]
to_delete: List[Schedule]
to_modify: List[Schedule]
akvo.rsr.usecases.django_q.schedules.apply_sync(action: SyncAction) QuerySet[source]

Applies the operations required to sync the schedules in the settings with the schedules in the DB

akvo.rsr.usecases.django_q.schedules.calc_sync(setting_schedules: List[Schedule], db_schedules: List[Schedule] | None = None) SyncAction[source]
Calculates the operations that have to be taken in order to sync the schedules in the settings

with the schedules in the db

akvo.rsr.usecases.django_q.schedules.get_setting_schedules() List[Schedule][source]

Converts the schedules configuration in the app settings to django-q schedule objects

akvo.rsr.usecases.django_q.schedules.sync_with_settings()[source]

Synchronizes the django-q schedules in the DB with those defined in the app settings