Skip to main content

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


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.9.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

flask_jobs-0.0.9-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file flask_jobs-0.0.9.tar.gz.

File metadata

  • Download URL: flask_jobs-0.0.9.tar.gz
  • Upload date:
  • Size: 4.1 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

Hashes for flask_jobs-0.0.9.tar.gz
Algorithm Hash digest
SHA256 5d1225b50bead6ef8c27f69ba830003eee41222c7f1d796c7a9c4d6d510c49c1
MD5 0fa3c37161da6e479ab236b81089e198
BLAKE2b-256 2a3667f9d4e4a5c0ed75be08e1b110f98fb7c666255fe38cc80b7b11081d7b8a

See more details on using hashes here.

File details

Details for the file flask_jobs-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: flask_jobs-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 4.3 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

Hashes for flask_jobs-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 8f2f41a9f21631b543b3c497d913ce41d9763ba57d25782d448a5fa0877ce45f
MD5 55beda3dbaea8109b7e37d95ee36d280
BLAKE2b-256 d4e7349dc241170fcbe9e9f9d3f9d96bc8b1890ad68fd0d520bae722d39b894a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page