<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Run Report</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <!-- Le styles -->
        <link href="css/bootstrap.css" rel="stylesheet">
        <link href="css/pygments.css" rel="stylesheet">
        <style>
            body {
                padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
            }
        </style>
        <link href="css/bootstrap-responsive.css" rel="stylesheet">

        <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
    </head>

    <body>

        <div class="navbar navbar-inverse navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container">
                    <a class="brand" href="#">Dexy Run Report</a>
                    <div class="nav-collapse collapse">
                        <ul class="nav">
                            <li><a href="#log">Log</a></li>
                        </ul>
                        <ul class="nav">
                            <li><a href="http://dexy.it">Dexy Website</a></li>
                        </ul>
                    </div><!--/.nav-collapse -->
                </div>
            </div>
        </div>

        <div class="container">

            <h1>Dexy Run Report</h1>

            <h2>Tree</h2>
            <p>Click on Document Keys to Expand/Collapse Sections</p>
            {% for node in wrapper.roots -%}
            {{ print_children(node) }}
            {% endfor -%}

            <h2>Timing</h2>
            <p>The total elapsed time was {{ "%0.2f" % batch.elapsed() }} seconds ({{ "%0.2f" % (float(batch.elapsed())/60)}} minutes).</p>

            {% if False -%}
            <h3>Slowest Tasks</h3>
            <ul>
                {% for task in batch.tasks_by_elapsed() -%}
                {% if task and task.elapsed -%}
                <li>{{ "%0.3f" % task.elapsed }} - <a href="#{{ task.doc.websafe_key() }}">{{ task.key }}</a> ({{ task.content_source }})</li>
                {% endif -%}
                {% endfor -%}
            </ul>
            {% endif -%}

            <h2>Documents</h2>
            {% for doc in wrapper.documents() -%}
            <hr />
            <h3 style="padding-top: 60px;" id="{{ doc.output_data().websafe_key() }}">{{ doc.key }} &nbsp;&nbsp;&nbsp; <a href="#top">&uarr;</a></h3>
            {% set args = printable_args(doc.setting_values()) -%}
            {% if len(args) > 0 -%}
            <h4>Arguments</h4>
<pre><code>{% for k in sorted(args) -%}
{% set v = args[k] -%}
{% if isinstance(v, dict) -%}
{{ k }}:
{% for kk, vv in v.items() -%}
&nbsp;&nbsp;&nbsp;&nbsp;{{ kk }}: {{ vv }}
{% endfor -%}
{% else -%}
{{ k }}: {{ v }}
{% endif -%}
{% endfor -%}
</code></pre>
{% endif -%}

            {% if False -%}
            {% if len(doc.inputs) > 0 %}
            <br />
            <h4>Inputs</h4>
            <ul>
                {% for d in doc.children %}
                <li><a href="#{{ d.websafe_key() }}">{{ d.key }}</a></li>
                {% endfor %}
            </ul>
            {% endif %}
            {% endif %}

            <br />

            <h4>Artifacts</h4>
            <table style="width: 800px; border: thin solid black; border-collapse: collapse;">
                <tr>
                    <th>Key</th><th>Link</th><th>Elapsed</th><th>Sections</th>
                    {% if wrapper.state == 'error' -%}
                    <th>wd</th>
                    {% endif -%}
                </tr>

                {% if hasattr(doc.initial_data, 'storage') -%}
                <tr>
                    <td style="padding-left: 10px; padding-right: 10px; border:thin solid black;">{{ doc.initial_data.key }}</td>
                    <td style="padding-left: 10px; padding-right: 10px; border:thin solid black;"><a title="{{ doc.initial_data.storage.data_file() }}" href="../../../{{ doc.initial_data.storage.data_file() }}">{{ doc.initial_data.basename() }}</a></td>
                    <td style="padding-left: 10px; padding-right: 10px; border:thin solid black; text-align:center;"></td>
                    <td style="padding-left: 10px; padding-right: 10px; border:thin solid black;">
                        {% if hasattr(doc.initial_data, 'keys') -%}
                        {% for counter, k in enumerate(doc.initial_data.keys()) -%}
                        {% if counter < 10 -%}
                        {{ k }}<br />
                        {% endif -%}
                        {% endfor -%}
                        {% endif -%}
                    </td>
                    {% if wrapper.state == 'error' -%}
                    <td style="padding-left: 10px; padding-right: 10px; border:thin solid black;">
                    </td>
                    {% endif -%},
                </tr>
                {% endif %}

                {% for a in doc.filters -%}
                {% if hasattr(a.output_data, 'storage') -%}
                <tr>
                    <td style="padding-left: 10px; padding-right: 10px; border:thin solid black;">{{ a.key }}</td>
                    <td style="padding-left: 10px; padding-right: 10px; border:thin solid black;"><a title="{{ a.output_data.storage.data_file() }}" href="../../../{{ a.output_data.storage.data_file() }}">{{ a.output_data.basename() }}</a></td>
                    <td style="padding-left: 10px; padding-right: 10px; border:thin solid black; text-align:center;">{{ "%0.4f" % (a.elapsed or 0) }}</td>
                    <td style="padding-left: 10px; padding-right: 10px; border:thin solid black;">
                        {% if hasattr(a.output_data, 'keys') and a.output_data.has_data() -%}
                        {% for counter, k in enumerate(a.output_data.keys()) -%}
                        {% if counter < 10 -%}
                        {{ k }}<br />
                        {% elif counter == 10 -%}
                        ...<br />
                        {% endif -%}
                        {% endfor -%}
                        {% endif -%}
                    </td>
                    {% if wrapper.state == 'error' -%}
                    <td style="padding-left: 10px; padding-right: 10px; border:thin solid black;">
                        <a href="../../../{{ a.workspace() }}">wd</a>
                    </td>
                    {% endif -%}
                </tr>
                {% endif -%}
                {% endfor -%}
            </table>

            <h4>Logs</h4>
            <p>
            To find entries in the <a href="#logs">logs</a> for this doc, search for
            <code><a onclick="window.find('{{ doc.hashid }}')">{{ doc.hashid }}</a></code> or
            <code><a onclick="window.find('{{ doc.key_with_class() }}:')">{{ doc.key_with_class() }}:</a></code>.
            </p>
            <p>Run dexy again with <code>--loglevel DEBUG</code> if you need more detail in the logs.</p>
            {% endfor %}


        <h3 id="log">Log <a href="#top">&uarr;</a></h3>
<pre class="small">
{{ log_contents }}
</pre>

        </div> <!-- /container -->

        <br />
        <br />

        <!-- Le javascript
        ================================================== -->
        <!-- Placed at the end of the document so the pages load faster -->
        <script src="http://code.jquery.com/jquery-latest.js"></script>
        <script src="js/bootstrap.min.js"></script>

    </body>
</html>
