-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
41 lines (26 loc) · 687 Bytes
/
app.py
File metadata and controls
41 lines (26 loc) · 687 Bytes
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
from flask import Flask
from flask_apscheduler import APScheduler
# config scheduling class
from statuschecker import get_health_status
class Config(object):
JOBS = [
{
'id': 'check_health',
'func': 'app:check_health',
'trigger': 'interval',
'seconds': 1800
}
]
SCHEDULER_API_ENABLED = True
# function triggered every 30 minutes
def check_health():
return get_health_status();
# flask startup
app = Flask(__name__)
app.config.from_object(Config())
# initiate scheduler
scheduler = APScheduler()
scheduler.init_app(app)
scheduler.start()
if __name__ == '__main__':
app.run(host='0.0.0.0')