zappa_scheduler
Description
A db driven way to run tasks at a future point in time, or at a regular interval, for Django Zappa projects (https://github.com/Miserlou/Zappa).
Installation
pip install zappa_scheduler
To check for tasks every 4 minutes, add the below to zappa_settings.json:
{
"dev": {
"keep_warm": false,
"events": [
{
"function": "zappa_scheduler.zappa_check.now",
"expression": "rate(4 minutes)"
}
]
}
}
Usage
Low level currently, where you create and save your tasks straight to db.
def test_function(_arg1, _arg2, _kwarg1=1, _kwarg2=2):
return _arg1, _arg2, _kwarg1, _kwarg2
call_later = CallLater()
call_later.function = test_function
call_later.args = (3, 4) # for the above function
call_later.kwargs = {'_kwarg1': 11, '_kwarg2': 22} # for the above function
call_later.time_to_run = timezone.now() + timedelta(minutes=8)
call_later.save()
You can also repeatedly call your task:
call_later_twice.every = timedelta(seconds=1)
call_later_twice.repeat = 2
There are 2 types of failure:
- If a task fails to run, it is run on the next checking event. By default, there are 3 attempts to run a function.
- If a task takes too long to run, it is again run on the next checking event. By default, there are 3 retries.
...the task is labelled as problematic after repeated fails.
Metadata
Release files for zappa-scheduler 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| zappa_scheduler-1.0.7.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zappa_scheduler-1.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.4 kB
Release files / zappa_scheduler-1.0.7.tar.gz
| Download URL | zappa_scheduler-1.0.7.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16b996b02ee16e57704f0492c18aff96f7d24e58b7f864b8d1256eb1e4859a96
|
|
BLAKE2b-256 checksum How to use checksums |
363cb0be8fa80ad3da2ac6fd35d59be0ee44074d31c08e40f4b25f001d9f7793
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
|
Release files / zappa_scheduler-1.0.7-py3-none-any.whl
| Download URL | zappa_scheduler-1.0.7-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8e4f9a8ee61f5f78dc73fd3027bfc639fb8e4e6eb6d867e648f6e1b14a722b6
|
|
BLAKE2b-256 checksum How to use checksums |
ae9d3fa3825d789c5305fdf98fca80e662cb82557545b061c465d2e306d4e374
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
|