Skip to content

Commit 79e7423

Browse files
committed
doc:update
1 parent d406f68 commit 79e7423

11 files changed

+44
-28
lines changed

docs/media/add-scheduled-job.jpg

-437 KB
Binary file not shown.

docs/media/add-scheduled-task.jpg

449 KB
Loading

docs/media/admin-job-details.jpg

223 KB
Loading

docs/media/admin-queue-registry.jpg

251 KB
Loading

docs/media/admin-queues-list.jpg

143 KB
Loading

docs/media/admin-task-details.jpg

304 KB
Loading

docs/media/admin-tasks-list.jpg

229 KB
Loading

docs/media/admin-worker-details.jpg

231 KB
Loading

docs/media/admin-workers-list.jpg

126 KB
Loading

docs/usage.md

+43-26
Original file line numberDiff line numberDiff line change
@@ -39,29 +39,51 @@ def long_running_func():
3939
long_running_func.delay() # Enqueue function with a timeout of 3600 seconds.
4040
```
4141

42-
You can set in `settings.py` a default value for `DEFAULT_RESULT_TTL` and `DEFAULT_TIMEOUT`.
42+
You can set in `settings.py` a default value for `DEFAULT_JOB_TTL` and `DEFAULT_JOB_TIMEOUT`.
4343

4444
```python
4545
# settings.py
46-
SCHEDULER_CONFIG = {
47-
'DEFAULT_RESULT_TTL': 360,
48-
'DEFAULT_TIMEOUT': 60,
49-
}
46+
SCHEDULER_CONFIG = SchedulerConfig(
47+
DEFAULT_SUCCESS_TTL=10 * 60, # Time To Live (TTL) in seconds to keep successful job results
48+
DEFAULT_FAILURE_TTL=365 * 24 * 60 * 60, # Time To Live (TTL) in seconds to keep job failure information
49+
DEFAULT_JOB_TTL=10 * 60, # Time To Live (TTL) in seconds to keep job information
50+
DEFAULT_JOB_TIMEOUT=5 * 60, # timeout (seconds) for a job
51+
)
5052
```
5153

52-
## Scheduling a job Through django-admin
54+
## Managing tasks through the Django Admin
55+
56+
### Viewing list of scheduled tasks
57+
58+
![](media/admin-tasks-list.jpg)
59+
60+
### Viewing details of a scheduled task
61+
62+
It is possible to view list of executions of a task, as well as the details of a specific execution.
63+
![](media/admin-task-details.jpg)
64+
65+
### Scheduling a task Through django-admin
5366

5467
* Sign in to the Django Admin site (e.g., http://localhost:8000/admin/) and locate the `Tasks Scheduler` section.
55-
* Click on the **Add** link for the type of job you want to add (`Scheduled Task` - run once, `Repeatable Task` - run
56-
multiple times, `Cron Task` - Run based on cron schedule).
57-
* Enter a unique name for the job in the **Name** field.
68+
* Click on the **Add** on `Tasks`
69+
* Enter a unique name for the task in the **Name** field.
70+
* Select the task type, and according to the type, the form will change for the scheduling details.
71+
* For `Repeatable task`
72+
* Enter an Interval, and choose the Interval unit. This will calculate the time before the function is called
73+
again.
74+
* In the Repeat field, enter the number of times the job is to be run. Leaving the field empty, means the job
75+
will be scheduled to run forever.
76+
* For `Cron task`
77+
* In the Repeat field, enter the number of times the job is to be run. Leaving the field empty, means the job
78+
will be scheduled to run forever.
79+
* In the cron string field, enter a cron string describing how often the job should run.
5880
* In the **Callable** field, enter a Python dot notation path to the method that defines the job. For the example
5981
above, that would be `myapp.jobs.count`
6082
* Choose your **Queue**.
6183
The queues listed are defined in your app `settings.py` under `SCHEDULER_QUEUES`.
6284
* Enter the time in UTC the job is to be executed in the **Scheduled time** field.
6385

64-
![](media/add-scheduled-job.jpg)
86+
![](media/add-scheduled-task.jpg)
6587

6688
#### Optional fields:
6789

@@ -75,33 +97,28 @@ SCHEDULER_CONFIG = {
7597

7698
Once you are done, click **Save** and your job will be persisted to django database.
7799

78-
### Support for arguments for jobs
100+
#### Support for arguments for tasks
79101

80-
django-tasks-scheduler supports scheduling jobs calling methods with arguments, as well as arguments that should be
102+
django-tasks-scheduler supports scheduling tasks calling methods with arguments, as well as arguments that should be
81103
calculated in runtime.
82104

83105
![](media/add-args.jpg)
84106

85-
### Scheduled Task: run once
107+
### Viewing queue statistics
86108

87-
No additional steps are required.
109+
![](media/admin-queues-list.jpg)
88110

89-
### Repeatable Task: Run a job multiple time based on interval
111+
### Viewing queue specific registry jobs
90112

91-
These additional fields are required:
113+
![](media/admin-queue-registry.jpg)
92114

93-
* Enter an **Interval**, and choose the **Interval unit**. This will calculate the time before the function is called
94-
again.
95-
* In the **Repeat** field, enter the number of time the job is to be run. Leaving the field empty, means the job will
96-
be scheduled to run forever.
115+
### Viewing workers list
97116

98-
### Cron Task: Run a job multiple times based on cron
117+
![](media/admin-workers-list.jpg)
99118

100-
These additional fields are required:
119+
### Viewing worker details
101120

102-
* In the **Repeat** field, enter the number of time the job is to be run. Leaving the field empty, means the job will be
103-
scheduled to run forever.
104-
* In the **cron string** field, enter a cron string describing how often the job should run.
121+
![](media/admin-worker-details.jpg)
105122

106123
## Enqueue jobs using the command line
107124

@@ -123,7 +140,7 @@ usage: manage.py scheduler_worker [-h] [--pid PIDFILE] [--name NAME] [--worker-t
123140
[queues ...]
124141
```
125142

126-
More information about the different parameters can be found in the [commands documentation](commands.md).
143+
More information about the different parameters can be found in the [commands documentation](commands.md).
127144

128145
### Running multiple workers as unix/linux services using systemd
129146

scheduler/admin/task_admin.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,10 @@ class Media:
6666
JobArgInline,
6767
JobKwargInline,
6868
]
69-
list_filter = ("enabled",)
69+
list_filter = ("enabled", "task_type", "queue")
7070
list_display = (
7171
"enabled",
7272
"name",
73-
"job_name",
7473
"function_string",
7574
"is_scheduled",
7675
"queue",

0 commit comments

Comments
 (0)