Skip to content

Commit 1b2d4f9

Browse files
committed
doc:update readme
1 parent 348fd7b commit 1b2d4f9

File tree

3 files changed

+62
-128
lines changed

3 files changed

+62
-128
lines changed

README.md

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,68 @@ Django Tasks Scheduler
66

77
Documentation can be found in https://django-tasks-scheduler.readthedocs.io/
88

9+
# Usage
10+
11+
1. Update `settings.py` to include scheduler configuration:
12+
13+
```python
14+
import os
15+
from typing import Dict
16+
from scheduler.types import SchedulerConfiguration, Broker, QueueConfiguration
17+
18+
INSTALLED_APPS = [
19+
# ...
20+
'scheduler',
21+
# ...
22+
]
23+
SCHEDULER_CONFIG = SchedulerConfiguration(
24+
EXECUTIONS_IN_PAGE=20,
25+
SCHEDULER_INTERVAL=10,
26+
BROKER=Broker.REDIS,
27+
CALLBACK_TIMEOUT=60, # Callback timeout in seconds (success/failure/stopped)
28+
# Default values, can be overriden per task/job
29+
DEFAULT_SUCCESS_TTL=10 * 60, # Time To Live (TTL) in seconds to keep successful job results
30+
DEFAULT_FAILURE_TTL=365 * 24 * 60 * 60, # Time To Live (TTL) in seconds to keep job failure information
31+
DEFAULT_JOB_TTL=10 * 60, # Time To Live (TTL) in seconds to keep job information
32+
DEFAULT_JOB_TIMEOUT=5 * 60, # timeout (seconds) for a job
33+
# General configuration values
34+
DEFAULT_WORKER_TTL=10 * 60, # Time To Live (TTL) in seconds to keep worker information after last heartbeat
35+
DEFAULT_MAINTENANCE_TASK_INTERVAL=10 * 60, # The interval to run maintenance tasks in seconds. 10 minutes.
36+
DEFAULT_JOB_MONITORING_INTERVAL=30, # The interval to monitor jobs in seconds.
37+
SCHEDULER_FALLBACK_PERIOD_SECS=120, # Period (secs) to wait before requiring to reacquire locks
38+
)
39+
SCHEDULER_QUEUES: Dict[str, QueueConfiguration] = {
40+
'default': QueueConfiguration(URL='redis://localhost:6379/0'),
41+
}
42+
```
43+
44+
2. Update `urls.py` to include scheduler urls:
45+
46+
```python
47+
from django.urls import path, include
48+
49+
urlpatterns = [
50+
# ...
51+
path('scheduler/', include('scheduler.urls')),
52+
]
53+
```
54+
55+
3. Run migrations:
56+
57+
```bash
58+
python manage.py migrate
59+
```
60+
61+
4. Check out the admin views:
62+
![](./docs/media/admin-tasks-list.jpg)
63+
964
# Sponsor
1065

1166
django-tasks-scheduler is developed for free.
1267

1368
You can support this project by becoming a sponsor using [this link](https://github.com/sponsors/cunla).
1469

70+
# Contributing
1571

16-
# Contributing
17-
18-
Interested in contributing, providing suggestions, or submitting bugs? See guidelines [at this link](.github/CONTRIBUTING.md).
72+
Interested in contributing, providing suggestions, or submitting bugs? See
73+
guidelines [at this link](.github/CONTRIBUTING.md).

poetry.lock

Lines changed: 1 addition & 122 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ classifiers = [
2525
'License :: OSI Approved :: MIT License',
2626
'Operating System :: OS Independent',
2727
'Programming Language :: Python',
28+
'Programming Language :: Python :: 3.10',
2829
'Programming Language :: Python :: 3.11',
2930
'Programming Language :: Python :: 3.12',
3031
'Programming Language :: Python :: 3.13',
@@ -51,12 +52,11 @@ sentry-sdk = { version = "^2.19", optional = true }
5152

5253
[tool.poetry.group.dev.dependencies]
5354
time-machine = "^2.16.0"
54-
poetry = "^2.1.2"
55+
poetry = "^2.1"
5556
ruff = "^0.11"
5657
coverage = "^7.6"
57-
fakeredis = { version = "^2.21", extras = ['lua'] }
58+
fakeredis = "^2.28"
5859
pyyaml = "^6"
59-
freezegun = "^1.5"
6060

6161
[tool.poetry.extras]
6262
yaml = ["pyyaml"]

0 commit comments

Comments
 (0)