api.v1.serializers.daemon_serializers package¶
api.v1.serializers.daemon_serializers package containing serializers for the core.models.Daemon data.
- class api.v1.serializers.daemon_serializers.BaseDaemonSerializer(*args, **kwargs)[source]¶
Bases:
ModelSerializerThe base serializer for
core.models.Daemon.Includes all viable fields from the model. Sets all constraints that must be implemented in all serializers. Other serializers for
core.models.Daemonshould inherit from this.- interval¶
The interval is serialized by
api.v1.serializers.django_celery_beat_serializers.IntervalScheduleSerializer. It can be altered.
- celery_task¶
The celery_task is serialized by
api.v1.serializers.django_celery_beat_serializers.PeriodicTaskSerializer.
- class Meta[source]¶
Bases:
objectMetadata class for the base serializer.
Contains constraints that must be implemented by all serializers. Other serializer metaclasses should inherit from this.
read_only_fieldsandexcludemust not be shortened in subclasses.- read_only_fields: Final[list[str]] = ['uuid', 'is_healthy', 'last_error', 'last_error_occurred_at', 'created', 'updated']¶
The
core.models.Daemon.Daemon.uuid,core.models.Daemon.Daemon.is_healthy,core.models.Daemon.Daemon.createdandcore.models.Daemon.Daemon.updatedfields are read-only.
- _declared_fields = {'celery_task': PeriodicTaskSerializer(read_only=True): enabled = BooleanField(help_text='Set to False to disable the schedule', read_only=True) last_run_at = DateTimeField(allow_null=True, help_text='Datetime that the schedule last triggered the task to run. Reset to None if enabled is set to False.', label='Last Run Datetime', read_only=True) total_run_count = IntegerField(help_text='Running count of how many times the schedule has triggered the task', label='Total Run Count', read_only=True), 'interval': IntervalScheduleSerializer(): id = IntegerField(label='ID', read_only=True) every = IntegerField(help_text='Number of interval periods to wait before running the task again', label='Number of Periods', max_value=2147483647, min_value=1) period = ChoiceField(choices=[('days', 'Days'), ('hours', 'Hours'), ('minutes', 'Minutes'), ('seconds', 'Seconds'), ('microseconds', 'Microseconds')], help_text='The type of period between task runs (Example: days)', label='Interval Period')}¶
- validate(attrs)[source]¶
Include full model-side validation to allow testing of account on submission.
- update(instance, validated_data)[source]¶
Extended to add the intervaldata to the instance.
Important
The nested intervaldata must be popped as update does not support nested dicts! There should not be duplicate IntervalSchedules. https://django-celery-beat.readthedocs.io/en/latest/index.html#example-creating-interval-based-periodic-task
- create(validated_data)[source]¶
Extended to add the intervaldata to the instance.
Important
The nested intervaldata must be popped as create does not support nested dicts! There should not be duplicate IntervalSchedules. https://django-celery-beat.readthedocs.io/en/latest/index.html#example-creating-interval-based-periodic-task