-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
31 lines (22 loc) · 790 Bytes
/
main.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
import json
import os
from flask import Flask
from flask import request
from jit.core import jit_cleaner
from jit.utils import config
from jit.utils.logger import jit_logger
app = Flask(__name__)
conf = config.parse_env()
@app.route("/scheduler", methods=['POST'])
def scheduler():
"""cloud scheduler handler"""
jit_logger.info("scheduler api")
content_type = request.headers.get('Content-Type')
if content_type != 'application/json':
return "Content type is not supported."
jit_cleaner.run_jit_cleaner(conf)
return json.dumps({})
if __name__ == "__main__":
jit_logger.info("starting application at port: %s",
int(os.environ.get("PORT", 8080)))
app.run(debug=True, host="0.0.0.0", port=int(os.environ.get("PORT", 8080)))