diff --git a/main.py b/main.py index 9f3a5a7..17d374f 100644 --- a/main.py +++ b/main.py @@ -22,6 +22,8 @@ from utilities.constants import UUID from utilities.constants import VALUE_APP from utilities.constants import VALUE_JOB_PENDING from utilities.constants import VALUE_JOB_RUNNING +from utilities.constants import VALUE_JOB_DONE +from utilities.web import web from utilities.envvar import get_env_var_with_default from utilities.envvar import get_env_var from utilities.times import wait_for_seconds @@ -179,7 +181,7 @@ def get_jobs(): jobs.append(job) all_matching_completed_jobs = local_completed_jobs.get(req[API_KEY], {}) if UUID in req: - all_matching_completed_jobs = all_matching_completed_jobs.get(req[UUID]) + all_matching_completed_jobs = all_matching_completed_jobs.get(req[UUID], {}) for key in all_matching_completed_jobs.keys(): jobs.append(all_matching_completed_jobs[key]) @@ -190,6 +192,10 @@ def get_jobs(): ) return jsonify({"jobs": jobs}) +@app.route("/") +def index(): + return web() + def backend(event_termination): model = load_model(logger) @@ -240,7 +246,7 @@ def main(): # ugly solution for now # TODO: use a database to track instead of internal memory try: - app.run() + app.run(host='0.0.0.0') thread.join() except KeyboardInterrupt: event_termination.set() diff --git a/utilities/BUILD b/utilities/BUILD index dfe4aee..20b62ee 100644 --- a/utilities/BUILD +++ b/utilities/BUILD @@ -82,3 +82,8 @@ py_test( srcs=["times_test.py"], deps=[":times"], ) + +py_library( + name="web", + srcs=["web.py"], +) \ No newline at end of file diff --git a/utilities/web.py b/utilities/web.py new file mode 100644 index 0000000..87c3ac7 --- /dev/null +++ b/utilities/web.py @@ -0,0 +1,156 @@ +def javascript(): + return """ + + """ + +def stylesheet(): + return """ + """ + +def content(): + return """ +
+ +