https://github.com/saasitive/dynamically-update-periodic-tasks
Dynamically update periodic tasks in Celery
https://github.com/saasitive/dynamically-update-periodic-tasks
celery celery-tasks celerybeat django django-framework django-rest-framework periodic-tasks python
Last synced: 9 months ago
JSON representation
Dynamically update periodic tasks in Celery
- Host: GitHub
- URL: https://github.com/saasitive/dynamically-update-periodic-tasks
- Owner: saasitive
- License: mit
- Created: 2022-10-17T08:41:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-17T12:51:38.000Z (over 3 years ago)
- Last Synced: 2025-04-08T23:01:41.464Z (about 1 year ago)
- Topics: celery, celery-tasks, celerybeat, django, django-framework, django-rest-framework, periodic-tasks, python
- Language: Python
- Homepage: https://saasitive.com/tutorial/dynamically-update-periodic-tasks-celery/
- Size: 70.3 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# Dynamically update periodic tasks in Celery and Django
Example project showing how to dynamically add and remove periodic tasks in Celery and Django. It is using `PeriodicTask` class from [**`django-celery-beat`**](https://github.com/celery/django-celery-beat) package.
This example repository is very simple demo of [uptime monitoring service](https://monitor-uptime.com). User can add server address and interval at which server uptime status will be checked. Tasks can be dynamically added or removed.
You can read more about [dynamic periodic tasks in the article](https://saasitive.com/tutorial/dynamically-update-periodic-tasks-celery/).
## Sequence diagram of uptime monitoring
```mermaid
sequenceDiagram
actor U as User
participant S as Server
participant DB as Database
participant B as Celery Beat
participant W as Celery Worker
U->>S: Create monitor
Note right of S: Create objects in DB
S->>DB: Create Monitor object
S->>DB: Create IntervalSchedule object
S->>DB: Create Periodictack object
loop every beat period
DB->>B: Get info about periodic tasks
end
loop Every interval period
B->>W: Create task
Note right of W: Execute task
W->>DB: Save task result (request data)
end
```