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
Merge remote-tracking branch 'origin/master' into stopping-state
* origin/master:
Quote all versions in ci.yml
Correct support versions in README
Remove Django 2.2
Add Django 4.0 and Python 3.10 to test matrix, remove unsupported versions
Remove .python-version
Reformat to match new Black version
Blacken INSTALLED_APPS docs
Bump version
Blacken docs and reword slightly
Clarify workspace docs
Fix black formatting
formatted w/black; added note about Windows support to README
Test if `signal` has attribute `SIGQUIT`
Add instructions for migrating
Using the name you configured for your job in your settings, create an instance of Job.
113
120
114
121
```python
115
-
Job.objects.create(name='my_job')
122
+
Job.objects.create(name="my_job")
116
123
```
117
124
118
125
### Prioritising jobs
@@ -121,10 +128,11 @@ important emails to users. However, once an hour, you may need to run a _really_
121
128
of emails to be dispatched before it can begin.
122
129
123
130
In order to make sure that an important job is run before others, you can set the `priority` field to an integer higher than `0` (the default). For example:
Of course, the scheduled job will only be run if your `python manage.py worker` process is running at the time when the job is scheduled to run. Otherwise, it will run the next time you start your worker process after that time has passed.
@@ -150,24 +161,47 @@ The top-level abstraction of a standalone piece of work. Jobs are stored in the
150
161
151
162
Jobs are processed to completion by *tasks*. These are simply Python functions, which must take a single argument - the `Job` instance being processed. A single job will often require processing by more than one task to be completed fully. Creating the task functions is the responsibility of the developer. For example:
152
163
153
-
def my_task(job):
154
-
logger.info("Doing some hard work")
155
-
do_some_hard_work()
164
+
```python
165
+
defmy_task(job):
166
+
logger.info("Doing some hard work")
167
+
do_some_hard_work()
168
+
```
156
169
157
170
### Workspace
158
171
159
-
The *workspace* is an area that tasks within a single job can use to communicate with each other. It is implemented as a Python dictionary, available on the `job` instance passed to tasks as `job.workspace`. The initial workspace of a job can be empty, or can contain some parameters that the tasks require (for example, API access tokens, account IDs etc). A single task can edit the workspace, and the modified workspace will be passed on to the next task in the sequence. For example:
172
+
The *workspace* is an area that can be used 1) to provide additional arguments to task functions, and 2) to categorize jobs with additional metadata. It is implemented as a Python dictionary, available on the `job` instance passed to tasks as `job.workspace`. The initial workspace of a job can be empty, or can contain some parameters that the tasks require (for example, API access tokens, account IDs etc).
173
+
174
+
When creating a Job, the workspace is passed as a keyword argument:
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:
When creating a Job, the workspace is passed as a keyword argument:
195
+
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:
@@ -244,6 +278,10 @@ jobs in the "NEW" or "READY" states will be returned.
244
278
245
279
It may be necessary to supply a DATABASE_PORT environment variable.
246
280
281
+
## Windows support
282
+
283
+
Windows is supported on a best-effort basis only, and is not covered by automated or manual testing.
284
+
247
285
## Code of conduct
248
286
249
287
For guidelines regarding the code of conduct when contributing to this repository please review [https://www.dabapps.com/open-source/code-of-conduct/](https://www.dabapps.com/open-source/code-of-conduct/)
0 commit comments