Marbaloo Schedule
Schedule support for cherrypy.
Installation
pip install marbaloo_schedule
Usage
# app.py
import cherrypy
import marbaloo_schedule
schedule_plugin = marbaloo_schedule.Plugin(cherrypy.engine)
schedule_plugin.subscribe()
cherrypy.tools.schedule = marbaloo_schedule.Tool()
class Root(object):
job_started = False
def do_jobs(self):
import schedule
# request level jobs
# e.g: send emails
# if my_job_completed:
# schedule.CancelJob
pass
@cherrypy.expose
def index(self):
schedule = cherrypy.request.schedule
if self.job_started is False:
schedule.every(5).seconds.do(self.do_jobs)
return 'jobs started :)'
else:
return 'jobs already started!'
config = {
'/': {
'tools.schedule.on': True
}
}
cherrypy.quickstart(Root(), '/', config)
And for server level jobs something like this:
import cherrypy
import marbaloo_schedule
schedule_plugin = marbaloo_schedule.Plugin(cherrypy.engine)
schedule_plugin.subscribe()
class Root:
pass
cherrypy.tree.mount(Root(), '/', {})
cherrypy.engine.signals.subscribe()
cherrypy.engine.start()
def do_server_jobs():
# server level jobs
print('Job is Done')
schedule_plugin.schedule.every(5).seconds.do(do_server_jobs)
cherrypy.engine.block()
P.S: For stop jobs anywhere, use schedule tags.
Metadata
Release files for marbaloo_schedule 0.1.0
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 | Actions |
|---|---|---|---|---|
| marbaloo_schedule-0.1.0.tar.gz | 2.7 kB | Without provenance | Details for marbaloo_schedule-0.1.0.tar.gz |
Release files / marbaloo_schedule-0.1.0.tar.gz
| Download URL | marbaloo_schedule-0.1.0.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d3c35a85d9a12c9c7ae107ed29dfd5a85f52b33f7c3553aba0a984c868d05dc5
|
|
BLAKE2b-256 checksum How to use checksums |
3f23ed45a1b3ba5418b89c4941c2c3b244f8339308515caaf63973f1c516ad44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for marbaloo_schedule 0.1.0
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.