attempt_logs.mako 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. ## Licensed to Cloudera, Inc. under one
  2. ## or more contributor license agreements. See the NOTICE file
  3. ## distributed with this work for additional information
  4. ## regarding copyright ownership. Cloudera, Inc. licenses this file
  5. ## to you under the Apache License, Version 2.0 (the
  6. ## "License"); you may not use this file except in compliance
  7. ## with the License. You may obtain a copy of the License at
  8. ##
  9. ## http://www.apache.org/licenses/LICENSE-2.0
  10. ##
  11. ## Unless required by applicable law or agreed to in writing, software
  12. ## distributed under the License is distributed on an "AS IS" BASIS,
  13. ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ## See the License for the specific language governing permissions and
  15. ## limitations under the License.
  16. <%!
  17. from desktop.views import commonheader, commonfooter
  18. from django.utils.translation import ugettext as _
  19. %>
  20. <%namespace name="comps" file="jobbrowser_components.mako" />
  21. ${commonheader(_('Task Attempt: %(attemptId)s - Job Browser') % dict(attemptId=attempt.attemptId_short), "jobbrowser", user)}
  22. <div class="container-fluid">
  23. <h1>${_('Task Attempt: %(attemptId)s - Job Browser') % dict(attemptId=attempt.attemptId_short)}</h1>
  24. <div class="row-fluid">
  25. <div class="span2">
  26. <div class="well sidebar-nav">
  27. <ul class="nav nav-list">
  28. <li class="nav-header">${_('Attempt ID')}</li>
  29. <li>${attempt.attemptId_short}</li>
  30. <li class="nav-header">${_('Task')}</li>
  31. <li><a href="${url('jobbrowser.views.single_task', jobid=joblnk.jobId, taskid=taskid)}" title="${_('View this task')}">${task.taskId_short}</a>
  32. </li>
  33. <li class="nav-header">${_('Job')}</li>
  34. <li><a href="${url('jobbrowser.views.single_job', jobid=joblnk.jobId)}" title="${_('View this job')}">${joblnk.jobId_short}</a></li>
  35. <li class="nav-header">${_('Status')}</li>
  36. <li>
  37. <%
  38. status = attempt.state.lower()
  39. %>
  40. % if status == 'running' or status == 'pending':
  41. <span class="label label-warning">${status}</span>
  42. % elif status == 'succeeded':
  43. <span class="label label-success">${status}</span>
  44. % else:
  45. <span class="label">${status}</span>
  46. % endif
  47. </li>
  48. </ul>
  49. </div>
  50. </div>
  51. <div class="span10">
  52. <ul class="nav nav-tabs">
  53. <li><a href="${ url('jobbrowser.views.single_task_attempt', jobid=joblnk.jobId, taskid=task.taskId, attemptid=attempt.attemptId) }#tmetadata">${_('Metadata')}</a></li>
  54. <li><a href="${ url('jobbrowser.views.single_task_attempt', jobid=joblnk.jobId, taskid=task.taskId, attemptid=attempt.attemptId) }#tcounters">${_('Counters')}</a></li>
  55. <li class="active"><a href="#logs" data-toggle="tab">${_('Logs')}</a></li>
  56. </ul>
  57. <div class="tab-content">
  58. <div class="tab-pane active" id="logs">
  59. <%
  60. log_diagnostic = logs[0]
  61. log_stdout = logs[1]
  62. log_stderr = logs[2]
  63. log_syslog = logs[3]
  64. %>
  65. <%def name="format_log(raw)">
  66. ## have to remove any indentation here or it breaks inside the pre tags
  67. % for line in raw.split('\n'):
  68. ${ line | h,trim }
  69. % endfor
  70. </%def>
  71. <h2>${_('task diagnostic log')}</h2>
  72. % if not log_diagnostic:
  73. <pre>-- empty --</pre>
  74. % else:
  75. <pre>${format_log(log_diagnostic)}</pre>
  76. % endif
  77. <h2>${_('stdout')}</h2>
  78. % if not log_stdout:
  79. <pre>-- empty --</pre>
  80. % else:
  81. <pre>${format_log(log_stdout)}</pre>
  82. % endif
  83. <h2>${_('stderr')}</h2>
  84. % if not log_stderr:
  85. <pre>-- empty --</pre>
  86. % else:
  87. <pre>${format_log(log_stderr)}</pre>
  88. % endif
  89. <h2>${_('syslog')}</h2>
  90. % if not log_syslog:
  91. <pre>-- empty --</pre>
  92. % else:
  93. <pre>${format_log(log_syslog)}</pre>
  94. % endif
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. <script type="text/javascript" charset="utf-8">
  101. $(document).ready(function(){
  102. $("#metadataTable").dataTable({
  103. "bPaginate": false,
  104. "bLengthChange": false,
  105. "bInfo": false,
  106. "bAutoWidth": false,
  107. "bFilter": false,
  108. "aoColumns": [
  109. { "sWidth": "30%" },
  110. { "sWidth": "70%" }
  111. ]
  112. });
  113. $(".taskCountersTable").dataTable({
  114. "bPaginate": false,
  115. "bLengthChange": false,
  116. "bInfo": false,
  117. "bFilter": false,
  118. "bAutoWidth": false,
  119. "aoColumns": [
  120. { "sWidth": "30%" },
  121. { "sWidth": "70%" }
  122. ]
  123. });
  124. });
  125. </script>
  126. ${commonfooter(messages)}