-
Notifications
You must be signed in to change notification settings - Fork 3
/
__init__.py
48 lines (37 loc) · 1.35 KB
/
__init__.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
45
46
47
48
from flask import Flask
from Helper import Log
from Status import Status
from flask_bootstrap import Bootstrap
from flask_moment import Moment
from Helper import Config
from Facility import Facility
from .heartbeat import HeartBeat
from dotenv import load_dotenv
import os
load_dotenv(dotenv_path='./.flaskenv', verbose=True)
config = Config()
print("Config validation:")
for level, message in config.Validation:
print(f" {level.name:8}: {message}", flush=True)
Facility.Reload()
print("Facility validation:")
for level, message in Facility.Validation:
print(f" {level.name:8}: {message}", flush=True)
app = Flask(__name__)
app.secret_key = os.getenv('SECRET_KEY')
bootstrap = Bootstrap(app)
moment = Moment(app)
Log.Initialize(app)
Status.Initialize()
HeartBeat.Initialize()
from Scheduler.execution import bp as ExecutionBp
app.register_blueprint(ExecutionBp, url_prefix='/execution')
from Scheduler.dispatcher import bp as DispatcherBp
app.register_blueprint(DispatcherBp, url_prefix='/api/v0')
from Scheduler.facility import bp as FacilityBp
app.register_blueprint(FacilityBp, url_prefix='/facility')
if config.EastWest.Enabled:
from Scheduler.east_west import bp as EastwestBp
app.register_blueprint(EastwestBp, url_prefix='/distributed')
Log.I(f'Optional East/West interface is {Log.State(config.EastWest.Enabled)}')
from Scheduler import routes