OLD | NEW |
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 from google.appengine.api import users | 6 from google.appengine.api import users |
7 from google.appengine.ext import db | 7 from google.appengine.ext import db |
8 from google.appengine.ext import webapp | 8 from google.appengine.ext import webapp |
9 from google.appengine.ext.webapp import template | 9 from google.appengine.ext.webapp import template |
10 from google.appengine.ext.webapp.util import run_wsgi_app | 10 from google.appengine.ext.webapp.util import run_wsgi_app |
11 | 11 |
12 | 12 |
13 class CommandInvocation(db.Model): | 13 class CommandInvocation(db.Model): |
14 command_id = db.StringProperty() | 14 command_id = db.StringProperty() |
15 remote_addr = db.StringProperty() | 15 remote_addr = db.StringProperty() |
16 attempt = db.IntegerProperty() | 16 attempt = db.IntegerProperty() |
17 retries = db.IntegerProperty() | 17 retries = db.IntegerProperty() |
18 cwd = db.StringProperty() | 18 cwd = db.StringProperty() |
19 command = db.StringProperty() | 19 command = db.StringProperty() |
20 returncode = db.IntegerProperty() | 20 returncode = db.IntegerProperty() |
21 stdout = db.StringProperty(multiline=True) | 21 stdout = db.StringProperty(multiline=True) |
22 stderr = db.StringProperty(multiline=True) | 22 stderr = db.StringProperty(multiline=True) |
23 runtime = db.FloatProperty() | 23 runtime = db.FloatProperty() |
24 timestamp = db.DateTimeProperty(auto_now_add=True) | 24 timestamp = db.DateTimeProperty(auto_now_add=True) |
25 uname_sysname = db.StringProperty() | 25 uname_sysname = db.StringProperty() |
26 uname_nodename = db.StringProperty() | 26 uname_nodename = db.StringProperty() |
27 uname_release = db.StringProperty() | 27 uname_release = db.StringProperty() |
28 uname_version = db.StringProperty() | 28 uname_version = db.StringProperty() |
29 uname_machine = db.StringProperty() | 29 uname_machine = db.StringProperty() |
30 uname_machine = db.StringProperty() | 30 uname_processor = db.StringProperty() |
31 | 31 |
32 | 32 |
33 class LogHandler(webapp.RequestHandler): | 33 class LogHandler(webapp.RequestHandler): |
34 """Handle requests to log events.""" | 34 """Handle requests to log events.""" |
35 | 35 |
36 def post(self): | 36 def post(self): |
37 ci = CommandInvocation() | 37 ci = CommandInvocation() |
38 ci.remote_addr = self.request.remote_addr | 38 ci.remote_addr = self.request.remote_addr |
39 ci.command_id = str(self.request.get('command_id')) | 39 ci.command_id = str(self.request.get('command_id')) |
40 ci.attempt = int(self.request.get('attempt')) | 40 ci.attempt = int(self.request.get('attempt')) |
41 ci.retries = int(self.request.get('retries')) | 41 ci.retries = int(self.request.get('retries')) |
42 ci.cwd = str(self.request.get('cwd')) | 42 ci.cwd = str(self.request.get('cwd')) |
43 ci.command = str(self.request.get('command')) | 43 ci.command = str(self.request.get('command')) |
44 ci.returncode = int(self.request.get('returncode')) | 44 ci.returncode = int(self.request.get('returncode')) |
45 ci.stdout = str(self.request.get('stdout')) | 45 ci.stdout = str(self.request.get('stdout')) |
46 ci.stderr = str(self.request.get('stderr')) | 46 ci.stderr = str(self.request.get('stderr')) |
47 ci.runtime = float(self.request.get('runtime')) | 47 ci.runtime = float(self.request.get('runtime')) |
48 ci.uname_sysname = str(self.request.get('uname_sysname')) | 48 ci.uname_sysname = str(self.request.get('uname_sysname')) |
49 ci.uname_nodename = str(self.request.get('uname_nodename')) | 49 ci.uname_nodename = str(self.request.get('uname_nodename')) |
50 ci.uname_release = str(self.request.get('uname_release')) | 50 ci.uname_release = str(self.request.get('uname_release')) |
51 ci.uname_version = str(self.request.get('uname_version')) | 51 ci.uname_version = str(self.request.get('uname_version')) |
52 ci.uname_machine = str(self.request.get('uname_machine')) | 52 ci.uname_machine = str(self.request.get('uname_machine')) |
| 53 ci.uname_processor = str(self.request.get('uname_processor')) |
53 ci.put() | 54 ci.put() |
54 | 55 |
55 | 56 |
56 class ViewerHandler(webapp.RequestHandler): | 57 class ViewerHandler(webapp.RequestHandler): |
57 """View log info.""" | 58 """View log info.""" |
58 | 59 |
59 def get(self): | 60 def get(self): |
60 user = users.get_current_user() | 61 user = users.get_current_user() |
61 if not user: | 62 if not user: |
62 uri = self.request.uri | 63 uri = self.request.uri |
(...skipping 18 matching lines...) Expand all Loading... |
81 ('/', ViewerHandler), | 82 ('/', ViewerHandler), |
82 ], debug=False) | 83 ], debug=False) |
83 | 84 |
84 | 85 |
85 def main(): | 86 def main(): |
86 run_wsgi_app(APPLICATION) | 87 run_wsgi_app(APPLICATION) |
87 | 88 |
88 | 89 |
89 if __name__ == '__main__': | 90 if __name__ == '__main__': |
90 main() | 91 main() |
OLD | NEW |