dj-scheduledtasks
Run tasks at a scheduled time
Installation
pip install
pip install dj-scheduledtasks
add to installed apps:
INSTALLED_APPS = [
...
'scheduledtasks',
]
Getting started
from scheduledtasks.models import ScheduledTask
Adding a reverse lookup to your model
You might want to be able to access the list of scheduled tasks on a model. To make this easy, you can add a GenericRelation field
from django.contrib.contenttypes.fields import GenericRelation
from scheduledtasks.models import ScheduledTask
class Todo(models.Model):
...
scheduled_tasks = GenericRelation(ScheduledTask)
You can then access scheduled_tasks_set just as you would any other ForeignKey field
Schedule a task:
Explicit schedule
# minimal usage
ScheduledTask.schedule('example_project.tasks.remind_if_due')
# minimal usage
ScheduledTask.schedule('remind_if_due')
Schedule from a related object
You can also schedule infer the scheduled time from an object by passing the object instance, a field and an offset. e.g.:
# run a task 60 minutes after the due date
ScheduledTask.schedule_by_object(
todo,
'example_project.tasks.remind_if_due',
'due_date',
offset=60
)
.. or just use the model directly
Create a task
Ways to run a task
Cleanup old tasks
Metadata
Release files for dj-scheduledtasks 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dj-scheduledtasks-0.0.3.tar.gz | 4.8 kB | Without provenance | Details |
Release files / dj-scheduledtasks-0.0.3.tar.gz
| Download URL | dj-scheduledtasks-0.0.3.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f43847c72c264f7bf3fdaa3d9b4372b5606dbbbb00fb7df6172456d5f05310b8
|
|
BLAKE2b-256 checksum How to use checksums |
70f4aa80b5fedde1954f70736b80ee39f2b7ec6a84c12407b5610398a71c935c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5
|
Security for dj-scheduledtasks 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.