celery / django-celery-beat

Celery Periodic Tasks backed by the Django ORM
Other
1.69k stars 428 forks source link

Validate schedule objects on save for faster, more informative failures #484

Open stevecj opened 2 years ago

stevecj commented 2 years ago

Summary:

When an instance of a schedule model (e.g. CrontabSchedule) has a field with an invalid value, no error is displayed, and the task is (silently) not added to the current schedule. If an exception occurred when trying to create the record, then the problem would be much easier to detect and then much easier to diagnose once detected.

Exact steps to reproduce the issue:

  1. Create a CrontabSchedule instance with an invalid value in any of its crontab fields.
  2. Create a PeriodicTask instance with the above CrontabSchedule instance as its .crontab value.
  3. See that the task never runs.
auvipy commented 2 years ago

is this from the discussion you opened?

stevecj commented 2 years ago

It is related to that. Yes. I was able to solve the problem that I opened the discussion about, but I it was very complicated to track down the cause.

auvipy commented 2 years ago

ok, can you check this PR https://github.com/celery/django-celery-beat/pull/478?

lvelvee commented 2 years ago

https://github.com/celery/django-celery-beat/blob/eb2af29453a91281c3a7855813d73aab9df0cfc1/django_celery_beat/schedulers.py#L243-L250

stevecj commented 2 years ago

@lvelvee Thanks for pasting that code that I should have included in my original description of the problem.

@auvipy I might be wrong, but I don't see that PR #478 addresses this issue of mine — though I really like what you're doing there.

auvipy commented 2 years ago

ok if you are welcome to come with a proposed improvement with a failing test