In Celery(v5.3.6), the celery.beat.Scheduler class has a class attribute schedule and an object attribute data, and their values seem to be the same.In the following part of the code, the class attribute schedule and the object attribute data are linked using the property() method. What's the purpose of this? Will it not cause confusion to use the Scheduler class and the Scheduler() object successively to assign values and query the schedule attribute?
code show as below:
class Scheduler:
"""Scheduler for periodic tasks.
...
Arguments:
schedule (~celery.schedules.schedule): see :attr:`schedule`.
max_interval (int): see :attr:`max_interval`.
lazy (bool): Don't set up the schedule.
"""
Entry = ScheduleEntry
#: The schedule dict/shelve.
schedule = None
#: Maximum time to sleep between re-checking the schedule.
max_interval = DEFAULT_MAX_INTERVAL
...
def __init__(self, app, schedule=None, max_interval=None,
Producer=None, lazy=False, sync_every_tasks=None, **kwargs):
self.app = app
self.data = maybe_evaluate({} if schedule is None else schedule)
...
...
def get_schedule(self):
return self.data
def set_schedule(self, schedule):
self.data = schedule
schedule = property(get_schedule, set_schedule)
I'm reading the source code, and I don't feel confused after reading this part. I hope someone can help me answer this part of the confusion?