An easy job scheduling interface for flask projects.
Project description
An easy job scheduling interface for flask projects.
Install
pip install flask_jobs
Schedule a job to run ASAP
from flask_jobs import AddJob def Callback(*args, **kwargs): print('The Callback function was called with args=', args, ' and kwargs=', kwargs) newJob = AddJob( func=Callback, a=(1, 'two', {'three': '4'}), k={'key': 'word'}, ) # The job will be run in a separate thread ASAP. # You can check the status of your job print('newJob['status']=', newJob['status']) # will return 'pending' or 'complete' or 'error' >> newJob['status']= complete
Schedule a job to happen once in the future
from flask_jobs import ScheduleJob import datetime def Callback(*args, **kwargs): print('The Callback function was called with args=', args, ' and kwargs=', kwargs) newJob = ScheduleJob( dt=datetime.datetime.utcnow() + datetime.timedelta(seconds=10), # all datetimes are in UTC func=Callback, a=(1, 'two', {'three': '4'}), k={'key': 'word'}, ) # The job will be run in a separate thread ASAP. # You can check the status of your job print('newJob['status']=', newJob['status']) # will return 'pending' or 'complete' or 'error' >> newJob['status']= pending # wait 10 seconds print('newJob['status']=', newJob['status']) >> newJob['status']= complete
Schedule a job to repeat indefinitely
from flask_jobs import RepeatJob def Callback(*args, **kwargs): print('The Callback function was called with args=', args, ' and kwargs=', kwargs) RepeatJob( dt=datetime.datetime.utcnow(), seconds=30, func=JobCallback, args=('Repeating',), kwargs={'key': 'val'} ) # All jobs are persistent. Even if you restart your server.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flask_jobs-0.0.5.tar.gz
(4.3 kB
view details)
Built Distribution
File details
Details for the file flask_jobs-0.0.5.tar.gz
.
File metadata
- Download URL: flask_jobs-0.0.5.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9db624a5ff100539670e7d57f478af490cdb73d70229a29630b324a3e2bc58d5 |
|
MD5 | 2d75d9e900acd78089e2b49a0e5d9e48 |
|
BLAKE2b-256 | 305759d98d53d0130e957fa49029c8713f514ef7c9ea2de804d7453eca1966af |
File details
Details for the file flask_jobs-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: flask_jobs-0.0.5-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38eab3cff24c37c9385491695f48e8358d4407990b88e6e2ec61087180fc26d2 |
|
MD5 | 670d39bbb8179ea22b725ee96b822a1a |
|
BLAKE2b-256 | 922500233dc2a6f0b86ad7101ff57dc9ebe0339e6ee107c00989cf31751bb13a |