-
Notifications
You must be signed in to change notification settings - Fork 184
/
jobs.py
44 lines (30 loc) · 804 Bytes
/
jobs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""Basic Flask Example."""
from flask import Flask
from flask_apscheduler import APScheduler
class Config:
"""App configuration."""
JOBS = [
{
"id": "job1",
"func": "jobs:job1",
"args": (1, 2),
"trigger": "interval",
"seconds": 10,
}
]
SCHEDULER_API_ENABLED = True
def job1(var_one, var_two):
"""Demo job function.
:param var_two:
:param var_two:
"""
print(str(var_one) + " " + str(var_two))
if __name__ == "__main__":
app = Flask(__name__)
app.config.from_object(Config())
scheduler = APScheduler()
# it is also possible to enable the API directly
# scheduler.api_enabled = True # noqa: E800
scheduler.init_app(app)
scheduler.start()
app.run()