You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by wi...@apache.org on 2014/05/12 19:19:10 UTC

git commit: Add return code to task/process pages

Repository: incubator-aurora
Updated Branches:
  refs/heads/master 41eb1e9e2 -> 289d0ea24


Add return code to task/process pages

Reviewed at https://reviews.apache.org/r/20394/


Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/289d0ea2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/289d0ea2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/289d0ea2

Branch: refs/heads/master
Commit: 289d0ea244fdcd7fbb0b58cea0ae2b0d0bd2a031
Parents: 41eb1e9
Author: David McLaughlin <da...@dmclaughlin.com>
Authored: Mon May 12 10:18:53 2014 -0700
Committer: Brian Wickman <wi...@apache.org>
Committed: Mon May 12 10:18:53 2014 -0700

----------------------------------------------------------------------
 .../apache/thermos/observer/http/http_observer.py       | 12 ++----------
 .../apache/thermos/observer/http/templates/process.tpl  |  6 +++---
 .../apache/thermos/observer/http/templates/task.tpl     |  6 ++++--
 .../python/apache/thermos/observer/task_observer.py     |  3 +++
 4 files changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/289d0ea2/src/main/python/apache/thermos/observer/http/http_observer.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/thermos/observer/http/http_observer.py b/src/main/python/apache/thermos/observer/http/http_observer.py
index 118bd2f..caceabc 100644
--- a/src/main/python/apache/thermos/observer/http/http_observer.py
+++ b/src/main/python/apache/thermos/observer/http/http_observer.py
@@ -126,13 +126,6 @@ class BottleObserver(HttpServer, StaticAssets, TaskObserverFileBrowser, TaskObse
     all_processes[current_run_number] = current_run
     for run in range(current_run_number):
       all_processes[run] = self._observer.process(task_id, process_id, run)
-    def convert_process_tuple(run_tuple):
-      process_tuple = dict(state = run_tuple['state'])
-      if 'start_time' in run_tuple:
-        process_tuple.update(start_time = run_tuple['start_time'])
-      if 'stop_time' in run_tuple:
-        process_tuple.update(stop_time = run_tuple['stop_time'])
-      return process_tuple
 
     template = {
       'task_id': task_id,
@@ -143,7 +136,6 @@ class BottleObserver(HttpServer, StaticAssets, TaskObserverFileBrowser, TaskObse
       },
     }
     template['process'].update(**all_processes[current_run_number].get('used', {}))
-    template['runs'] = dict((run, convert_process_tuple(run_tuple))
-        for run, run_tuple in all_processes.items())
-    log.info('Rendering template is: %s' % template)
+    template['runs'] = all_processes
+    log.debug('Rendering template is: %s' % template)
     return template

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/289d0ea2/src/main/python/apache/thermos/observer/http/templates/process.tpl
----------------------------------------------------------------------
diff --git a/src/main/python/apache/thermos/observer/http/templates/process.tpl b/src/main/python/apache/thermos/observer/http/templates/process.tpl
index a7fb90d..3a3b942 100644
--- a/src/main/python/apache/thermos/observer/http/templates/process.tpl
+++ b/src/main/python/apache/thermos/observer/http/templates/process.tpl
@@ -75,14 +75,13 @@ ${escape(process["cmdline"])}
      <table class="table table-bordered table-condensed table-striped" style="empty-cells:show;">
      <thead>
        <tr>
-         <th colspan=2> </th>
+         <th colspan=3> </th>
          <th colspan=2> time </th>
          <th colspan=2> logs </th>
        </tr>
 
        <tr>
-         <th> run </th>
-         <th> status </th>
+         <th> run </th> <th> status </th> <th>return code</th>
          <th> started </th> <th> finished </th>
          <th> stdout </th> <th> stderr </th>
        </tr>
@@ -93,6 +92,7 @@ ${escape(process["cmdline"])}
        <tr>
          <td> ${run} </td>
          <td> ${process_dict["state"]} </td>
+         <td> ${process_dict["return_code"] if "return_code" in process_dict else ""} </td>
          <td> ${pretty_time(process_dict["start_time"]) if "start_time" in process_dict else ""} </td>
          <td> ${pretty_time(process_dict["stop_time"]) if "stop_time" in process_dict else ""} </td>
          <td> <a href="/logs/${task_id}/${process["name"]}/${run}/stdout">stdout</a> </td>

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/289d0ea2/src/main/python/apache/thermos/observer/http/templates/task.tpl
----------------------------------------------------------------------
diff --git a/src/main/python/apache/thermos/observer/http/templates/task.tpl b/src/main/python/apache/thermos/observer/http/templates/task.tpl
index b71c80d..1b3f16a 100644
--- a/src/main/python/apache/thermos/observer/http/templates/task.tpl
+++ b/src/main/python/apache/thermos/observer/http/templates/task.tpl
@@ -104,14 +104,15 @@
      <table class="table table-bordered table-condensed table-striped" style="empty-cells:show;">
      <thead>
        <tr>
-         <th colspan=3> process </th>
+         <th colspan=4> process </th>
          <th colspan=2> time </th>
          <th colspan=2> used </th>
          <th colspan=2> logs </th>
        </tr>
 
        <tr>
-         <th> name </th> <th> run </th> <th> status </th> <th> started </th> <th> finished </th>
+         <th> name </th> <th> run </th> <th> status </th> <th> return code </th>
+         <th> started </th> <th> finished </th>
          <th> cpu </th> <th> ram </th>
          <th> stdout </th> <th> stderr </th>
        </tr>
@@ -123,6 +124,7 @@
          <td> <a href="/process/${task_id}/${proc["process_name"]}">${proc["process_name"]}</a> </td>
          <td> ${proc["process_run"]} </td>
          <td> ${proc["state"]} </td>
+         <td> ${proc["return_code"] if "return_code" in proc else ""} </td>
          <td> ${pretty_time(proc["start_time"]) if "start_time" in proc else ""} </td>
          <td> ${pretty_time(proc["stop_time"]) if "stop_time" in proc else ""} </td>
          <td> ${'%.3f' % proc["used"]["cpu"] if "used" in proc else ""} </td>

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/289d0ea2/src/main/python/apache/thermos/observer/task_observer.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/thermos/observer/task_observer.py b/src/main/python/apache/thermos/observer/task_observer.py
index ea40bfa..8feaa40 100644
--- a/src/main/python/apache/thermos/observer/task_observer.py
+++ b/src/main/python/apache/thermos/observer/task_observer.py
@@ -442,6 +442,7 @@ class TaskObserver(ExceptionalThread, Lockable):
       {
         process_name: string
         process_run: int
+        (optional) return_code: int
         state: string [WAITING, FORKED, RUNNING, SUCCESS, KILLED, FAILED, LOST]
         (optional) start_time: seconds from epoch
         (optional) stop_time: seconds from epoch
@@ -463,6 +464,8 @@ class TaskObserver(ExceptionalThread, Lockable):
         d.update(start_time=process_run.start_time)
       if process_run.stop_time:
         d.update(stop_time=process_run.stop_time)
+      if process_run.return_code:
+        d.update(return_code=process_run.return_code)
       return d
 
   @Lockable.sync