Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/honmaple/maple-scheduler

scheduler
https://github.com/honmaple/maple-scheduler

apscheduler flask scheduler vue

Last synced: 2 minutes ago
JSON representation

scheduler

Awesome Lists containing this project

README

        

* mape-scheduler

[[https://docs.python.org/3/whatsnew/3.6.html][https://img.shields.io/badge/python-3.6-brightgreen.svg]]
[[LICENSE][https://img.shields.io/badge/license-BSD-blue.svg]]

[[https://raw.githubusercontent.com/honmaple/maple-scheduler/master/example.png]]

** Quickstart
#+BEGIN_SRC python
from flask import Flask
from sche import sche, api

app = Flask(__name__)
app.config.from_object("config")
sche.init_app(app, start=True)
api.init_app(app)

if __name__ == '__main__':
app.run()
#+END_SRC

** Configure
example:

#+BEGIN_SRC python
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
from pytz import timezone

APSCHEDULER = {
'jobstores': {
'default': SQLAlchemyJobStore(url='sqlite:///test_scheduler.db')
},
'executors': {
'default': {
'type': 'threadpool',
'max_workers': 20
}
},
'job_defaults': {
'coalesce': False,
'max_instances': 3
},
'timezone': timezone('Asia/Shanghai'),
'funcs': "jobs"
}
#+END_SRC

|--------------+--------------------------------------------|
| jobstores | apscheduler jobstores,default *None* |
| executors | apscheduler executors,default *None* |
| job_defaults | apscheduler job_defaults,default *None* |
| timezone | apscheduler timezone,default *UTC* |
| funcs | str or list, tasks where find,default *[]* |
|--------------+--------------------------------------------|

** Some Api
- */scheduler*
- GET:
get all jobs
- POST:
add a new job,the *func* is same as 'jobs:vvv'
- */scheduler/status*
- GET:
get scheduler status,include running,executors,job_defaults
- POST:
start scheduler.You can pass parameter *pause* (default: *False*)
#+BEGIN_EXAMPLE
# when pause in ['1',1,'true','True']
pause = True
#+END_EXAMPLE
- DELETE:
shutdown scheduler.You can pass parameter *wait* (default: *True*)
#+BEGIN_EXAMPLE
# when wait in ['0',0,'False','false']
wait = False
#+END_EXAMPLE

- */scheduler/*
- GET:
get a job with id.
- PUT:
modify a job with id.
- DELETE:
delete a job with id.
- */scheduler//pause*
- POST:
pause a job with id.
- */scheduler//resume*
- POST:
resume a job with id.
- */scheduler//execute*
- POST:
Executes a job with id right now.


** Example
#+BEGIN_SRC shell
python runserver
#+END_SRC