Skip to content
Snippets Groups Projects
Commit da1d5077 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

Task #9607: added link to observation/pipeline logfiles

parent 27a38c61
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,7 @@ from threading import Condition
from datetime import datetime
import time
import logging
import subprocess
from dateutil import parser, tz
from flask import Flask
from flask import render_template
......@@ -546,6 +547,8 @@ def getTaskHtml(task_id):
html += '<h1>Task %s</h1>' % task_id
html += '<p><a href="/tasks/%s/log.html">%s log</a></p> ' % (task['id'], task['type'])
props = sorted(task.keys())
html += '<tr><th>key</th><th>value</th></tr>\n'
......@@ -631,7 +634,24 @@ def resourceClaimsForTaskHtml(task_id):
return html
@app.route('/tasks/<int:task_id>/log.html', methods=['GET'])
def getTaskLogHtml(task_id):
task = rarpc.getTask(task_id)
cmd = []
if task['type'] == 'pipeline':
cmd = ['ssh', '-t', 'lofarsys@head01.cep4.control.lofar', 'cat /data/log/pipeline-%s-*.log' % task['otdb_id']]
else:
cmd = ['ssh', '-t', 'mcu001.control.lofar', 'cat /opt/lofar/var/log/MCU001\\:ObservationControl\\[0\\]\\{%s\\}.log*' % task['otdb_id']]
logger.info(' '.join(cmd))
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = proc.communicate()
if proc.returncode == 0:
return out, 200, {'Content-Type': 'text/plain; charset=utf-8'}
else:
return err, 500, {'Content-Type': 'text/plain; charset=utf-8'}
def main():
# make sure we run in UTC timezone
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment