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