diff --git a/watcher/app.py b/watcher/app.py index 18248eb..ab8b3b2 100644 --- a/watcher/app.py +++ b/watcher/app.py @@ -1,6 +1,7 @@ -from flask import Flask,render_template import datetime +from flask import Flask, render_template + app = Flask(__name__) # We request users to send the run number to prevent accidentially getting old requests from a previous run @@ -12,28 +13,23 @@ app = Flask(__name__) # Save progress through time during 1 run # Save result of different runs -db = { - "current_run": 0, - "run_start_timer": None, - "run_data": { - } - } +db = {"current_run": 0, "run_start_timer": None, "run_data": {}} + @app.route("/") def index(): - return render_template("index.html") + return render_template('index.html') + @app.route("/start_run/") def start_run(run_index): db["current_run"] = run_index - starttime = datetime.datetime.now() - db["run_data"][run_index] = { - "starttime": starttime, - "data": {} - } + starttime = datetime.datetime.now() + db["run_data"][run_index] = {"starttime": starttime, "data": {}} # TODO send start request to the first person in the chain. Probably a zeus part already written as example return f'Run {run_index} started at {starttime}' + @app.route("/checkpoint/start//") def checkpoint_start(run, index): if db["current_run"] != run: @@ -51,5 +47,6 @@ def checkpoint_handoff(run, index): db["run_data"][run]["data"][index]["handoff"] = datetime.datetime.now() return "Success." -if __name__ == "__main__": + +if __name__ == '__main__': app.run(debug=True) diff --git a/watcher/index.html b/watcher/templates/index.html similarity index 75% rename from watcher/index.html rename to watcher/templates/index.html index aed39f5..407b841 100644 --- a/watcher/index.html +++ b/watcher/templates/index.html @@ -2,6 +2,6 @@ -

+

TEST