{% extends "base.html" %}

{% block body %}

<div id="task_status" class="container">
<table class="table table-striped table-bordered table-condensed table-hover">
    <caption><h4>Task Info</h4></caption>
    <tbody>
    <tr>
        <td><div class="text-right">ID:</div></td>
        <td>{{ id }}</td>
    </tr>
    <tr>
        <td><div class="text-top text-right">Project:</div></td>
        <td>{{ result.session.project.name|linebreaks }}</td>
    </tr>
    <tr>
        <td><div class="text-right">Session:</div></td>
        <td><div id="sessions">{{result.session.name}}</div></td>
    </tr>
    <tr>
        <td><div class="text-right">Overall status:</div></td>
        <td>{{ overall_status }}</td>
    </tr>
    <tr>
        <td><div class="text-right">Tasks completed:</div></td>
        <td>{{ num_completed }}</td>
    </tr>
    <tr>
        <td><div class="text-right">Start time:</div></td>
        <td>{{ result.creation_time }}</td>
    </tr>
    <tr>
        <td><div class="text-right">Completion time:</div></td>
        <td>{{ completion_time }}</td>
    </tr>
    <tr>
        <td><div class="text-right">Total runtime:</div></td>
        <td>{{ total_runtime }}</td>
    </tr>
    {% if result.pipeline_knobs %}
    <tr>
        <td><div class="text-right">Ranked Knobs:</div></td>
        <td><a href="{% url 'pipeline_data_view' result.pipeline_knobs.pk %}">Ranked Knobs</td>
    </tr>
    {% endif %}
    {% if result.pipeline_metrics %}
    <tr>
        <td><div class="text-right">Pruned Metrics:</div></td>
        <td><a href="{% url 'pipeline_data_view' result.pipeline_metrics.pk %}">Pruned Metrics</td>
    </tr>
    {% endif %}
    </tbody>
</table>

{% for task_name, task in tasks %}
<table class="table table-striped table-bordered table-condensed table-hover">
    <caption><h4>{{ task_name }}</h4></caption>
    <tbody>
	    <tr>
	        <td><div class="text-right">Status:</div></td>
	        <td>{{ task.status }} </td>
	    </tr>
	    {% if task.traceback %}
	    <tr>
	        <td><div class="text-right">Traceback:</div></td>
	        <td>{{ task.traceback }} </td>
	    </tr>
	    {% endif %}
	    <tr>
	        <td><div class="text-right">Result:</div></td>
	        <td>{{ task.result|linebreaks }} </td>
	    </tr>
    </tbody>
</table>
{% endfor %}
</div>


{% endblock body %}
