PageRenderTime 164ms CodeModel.GetById 160ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 1ms

/templates/admin/jobs.mako

https://bitbucket.org/cistrome/cistrome-harvard/
Mako | 135 lines | 126 code | 9 blank | 0 comment | 4 complexity | c5a934df1c3cc837fa30374f092f59cb MD5 | raw file
  1<%inherit file="/base.mako"/>
  2<%namespace file="/message.mako" import="render_msg" />
  3
  4<%def name="javascripts()">
  5    ${parent.javascripts()}
  6    <script type="text/javascript">
  7        function toggle_all(source) {
  8            // sets all checkboxes in source's parent form to match source element.
  9            $.each($(source).closest("form").find(":checkbox"), function(i, v){
 10                v.checked = source.checked;
 11            });
 12        }
 13    </script>
 14</%def>
 15
 16<%def name="title()">Jobs</%def>
 17
 18<h2>Jobs</h2>
 19
 20%if message:
 21    ${render_msg( message, status )}
 22%endif
 23
 24<p>
 25    All unfinished jobs are displayed here.  To display only jobs that have not
 26    had their job state updated recently, set a cutoff value in the 'cutoff'
 27    box below.
 28</p>
 29<p>
 30    If any jobs are displayed, you may choose to stop them.  Your stop message
 31    will be displayed to the user as: "This job was stopped by an
 32    administrator: <b>&lt;YOUR MESSAGE&gt;</b>  For more information or help,
 33    report this error".
 34</p>
 35
 36
 37<p/>
 38
 39%if jobs:
 40<form name="jobs" action="${h.url_for(controller='admin', action='jobs')}" method="POST">
 41    <table class="manage-table colored" border="0" cellspacing="0" cellpadding="0" width="100%">
 42        <tr class="header">
 43            <td><input type="checkbox" onClick="toggle_all(this)"/></td>
 44            <td>Job ID</td>
 45            <td>User</td>
 46            <td>Last Update</td>
 47            <td>Tool</td>
 48            <td>State</td>
 49            <td>Inputs</td>
 50            <td>Command Line</td>
 51            <td>Job Runner</td>
 52            <td>PID/Cluster ID</td>
 53        </tr>
 54        %for job in jobs:
 55                <td>
 56                    %if job.state == 'upload':
 57                        &nbsp;
 58                    %else:
 59                        <input type="checkbox" name="stop" value="${job.id}"/>
 60                    %endif
 61                </td>
 62                <td>${job.id}</td>
 63                %if job.history and job.history.user:
 64                    <td>${job.history.user.email}</td>
 65                %else:
 66                    <td>anonymous</td>
 67                %endif
 68                <td>${last_updated[job.id]} ago</td>
 69                <td>${job.tool_id}</td>
 70                <td>${job.state}</td>
 71                <%
 72                    try:
 73                        inputs = ", ".join( [ '%s&nbsp;%s' % ( da.dataset.id, da.dataset.state ) for da in job.input_datasets ] )
 74                    except:
 75                        inputs = 'Unable to determine inputs'
 76                %>
 77                <td>${inputs}</td>
 78                <td>${job.command_line}</td>
 79                <td>${job.job_runner_name}</td>
 80                <td>${job.job_runner_external_id}</td>
 81            </tr>
 82        %endfor
 83    </table>
 84    <p/>
 85    <div class="toolForm">
 86        <div class="toolFormTitle">
 87            Stop Jobs
 88        </div>
 89        <div class="toolFormBody">
 90            <div class="form-row">
 91                <label>
 92                    Stop message:
 93                </label>
 94                <div class="form-row-input">
 95                    <input type="text" name="stop_msg" size="40"/>
 96                </div>
 97                <div class="toolParamHelp" style="clear: both;">
 98                    to be displayed to the user
 99                </div>
100            </div>
101            <div class="form-row">
102                <input type="submit" class="primary-button" name="submit" value="Submit">
103            </div>
104        </div>
105    </div>
106    <p/>
107</form>
108%else:
109    <div class="infomessage">There are no unfinished jobs to show with current cutoff time.</div>
110    <p/>
111%endif
112<form name="jobs" action="${h.url_for(controller='admin', action='jobs')}" method="POST">
113    <div class="toolForm">
114        <div class="toolFormTitle">
115            Update Jobs
116        </div>
117        <div class="toolFormBody">
118
119            <div class="form-row">
120                <label>
121                    Cutoff:
122                </label>
123                <div class="form-row-input">
124                    <input type="text" name="cutoff" size="4" value="${cutoff}"/>
125                </div>
126                <div class="toolParamHelp" style="clear: both;">
127                    In seconds
128                </div>
129            </div>
130            <div class="form-row">
131                <input type="submit" class="primary-button" name="submit" value="Refresh">
132            </div>
133        </div>
134    </div>
135</form>