added cache status

This commit is contained in:
Alok Saldanha
2019-09-16 13:40:50 -04:00
parent 1e1de19878
commit 1b053092b4
2 changed files with 62 additions and 2 deletions
+6 -2
View File
@@ -161,8 +161,7 @@ def filecrawl():
@app.route("/view/<path:path>", methods=["GET", "PUT", "POST"])
def do_GET(path):
def do_view(path):
dataset = get_dataset(path)
file_path = get_file_path(dataset)
match = cache.check_entry(dataset)
@@ -182,6 +181,11 @@ def do_GET(path):
elif match.status == "error":
raise ProcessException.from_pid_object(match)
@app.route("/cache_status", methods=["GET"])
def do_GET_status():
return render_template(
"cache_status.html", entry_list=cache.entry_list
)
def main():
env.validate()
@@ -0,0 +1,56 @@
<!--
Copyright 2019 Novartis Institutes for BioMedical Research Inc. Licensed
under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the License.
-->
<html>
<head>
<title>Cellxgene Gateway - FILE CRAWLER</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="icon" type="image/png" href="{{ url_for('static', filename='nibr.ico') }}">
{% for script in extra_scripts %}
<script src="{{ script }}"></script>
{% endfor %}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
</head>
<body>
<header class="navbar navbar-expand navbar-dark flex-column flex-md-row bd-navbar">
<h3>Cellxgene Gateway - Cache Status</h3>
</header>
<br>
<table class="table">
<thead>
<tr>
<th>PID</th>
<th>dataset</th>
<th>port</th>
<th>launchtime</th>
<th>timestamp</th>
<th>status</th>
<th>message</th>
<th>http_status</th>
</tr>
</thead>
<tbody>
{% for entry in entry_list %}
<tr>
<td>{{ entry.pid }}</td>
<td>{{ entry.dataset }}</td>
<td>{{ entry.port }}</td>
<td>{{ entry.launchtime }}</td>
<td>{{ entry.timestamp }}</td>
<td>{{ entry.status }}</td>
<td>{{ entry.message }}</td>
<td>{{ entry.http_status }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>