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.11.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for flask_jobs-0.0.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39391409f3220206a868c68a59ca26679a68b0f9193ff4cd5db857fdf8403118 |
|
MD5 | 37538ea43f740de454a33fd6e563ab52 |
|
BLAKE2b-256 | d881bf733ad4c7bc772841761fdb2025b9f047ea1ce8642791ea0e06b21e856e |