Commit 15460708 authored by Daniele Venzano's avatar Daniele Venzano
Browse files

Make history logs downloadable

parent 1d1a99eb
......@@ -263,6 +263,12 @@ class ZoeClient:
return ret
def log_history_get(self, execution_id):
execution = self.execution_get(execution_id)
if execution is None:
return None
return storage.logs_archive_download(execution)
def get_zoe_client():
if conf['client_rpyc_autodiscovery']:
from io import BytesIO
from zipfile import is_zipfile
from flask import Blueprint, jsonify, request, session
from flask import Blueprint, jsonify, request, session, abort, send_file
from zoe_client import get_zoe_client
from common.exceptions import ApplicationStillRunning
......@@ -102,3 +103,15 @@ def execution_terminate(exec_id):
return jsonify(status="ok")
def history_logs_get(execution_id):
client = get_zoe_client()
logs = client.log_history_get(execution_id)
if logs is None:
return abort(404)
return send_file(BytesIO(logs), mimetype="application/zip")
......@@ -108,7 +108,7 @@
{% endif %}
<td>{{ e[1]['finished_at']|format_timestamp }}</td>
{% if e[1]['started_at'] != None %}
<td><a href="">Logs</a></td>
<td><a href="{{ url_for('api.history_logs_get', execution_id=e[1]['id']) }}">Logs</a></td>
{% endif %}
{% endfor %}
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