Commit c937f907 authored by Alok Saldanha's avatar Alok Saldanha
Browse files

#8 added endpoint to return status json

parent 464ee873
......@@ -12,6 +12,7 @@ import datetime
import os
import logging
from threading import Thread
import json
from flask import (
......@@ -194,6 +195,15 @@ def do_view(path):
def do_GET_status():
return render_template("cache_status.html", entry_list=cache.entry_list)
@app.route("/cache_status.json", methods=["GET"])
def do_GET_status_json():
return json.dumps({'launchtime':app.launchtime,
'dataset': entry.dataset,
'launchtime': entry.launchtime,
'last_access': entry.timestamp,
'status': entry.status
} for entry in cache.entry_list]})
@app.route("/relaunch/<path:path>", methods=["GET"])
def do_relaunch(path):
......@@ -216,9 +226,11 @@ def main():
logging.basicConfig(level=logging.INFO, format='%(asctime)s:%(name)s:%(levelname)s:%(message)s')
pruner = PruneProcessCache(cache)
background_thread = Thread(target=pruner)
app.launchtime = current_time_stamp()"", port=5005, debug=False)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment