You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-11Lines changed: 23 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,9 @@ Supported and tested against:
16
16
17
17
Install from PIP
18
18
19
-
pip install django-db-queue
19
+
```
20
+
pip install django-db-queue
21
+
```
20
22
21
23
Add `django_dbq` to your installed apps
22
24
@@ -29,7 +31,9 @@ INSTALLED_APPS = [
29
31
30
32
Run migrations
31
33
32
-
manage.py migrate
34
+
```
35
+
manage.py migrate
36
+
```
33
37
34
38
### Upgrading from 1.x to 2.x
35
39
@@ -112,7 +116,9 @@ JOBS = {
112
116
113
117
In another terminal:
114
118
115
-
`python manage.py worker`
119
+
```
120
+
python manage.py worker
121
+
```
116
122
117
123
### Create a job
118
124
@@ -186,11 +192,13 @@ def my_task(job):
186
192
187
193
Tasks within a single job can use the workspace to communicate with each other. A single task can edit the workspace, and the modified workspace will be passed on to the next task in the sequence. For example:
The workspace can be queried like any [JSONField](https://docs.djangoproject.com/en/3.2/topics/db/queries/#querying-jsonfield). For instance, if you wanted to display a list of jobs that a certain user had initiated, add `user_id` to the workspace when creating the job:
196
204
@@ -212,9 +220,11 @@ A *worker process* is a long-running process, implemented as a Django management
212
220
213
221
Jobs are configured in the Django `settings.py` file. The `JOBS` setting is a dictionary mapping a *job name* (eg `import_cats`) to a *list* of one or more task function paths. For example:
@@ -263,7 +273,9 @@ to ensure the jobs table remains at a reasonable size.
263
273
##### manage.py worker
264
274
To start a worker:
265
275
266
-
manage.py worker [queue_name] [--rate_limit]
276
+
```
277
+
manage.py worker [queue_name] [--rate_limit]
278
+
```
267
279
268
280
-`queue_name` is optional, and will default to `default`
269
281
- The `--rate_limit` flag is optional, and will default to `1`. It is the minimum number of seconds that must have elapsed before a subsequent job can be run.
0 commit comments