OLD | NEW |
---|---|
1 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2015 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 """Functions specific to handle goma related info. | 5 """Functions specific to handle goma related info. |
6 """ | 6 """ |
7 | 7 |
8 import base64 | 8 import base64 |
9 import datetime | 9 import datetime |
10 import getpass | 10 import getpass |
(...skipping 23 matching lines...) Expand all Loading... | |
34 | 34 |
35 TIMESTAMP_PATTERN = re.compile('(\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2})') | 35 TIMESTAMP_PATTERN = re.compile('(\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2})') |
36 TIMESTAMP_FORMAT = '%Y/%m/%d %H:%M:%S' | 36 TIMESTAMP_FORMAT = '%Y/%m/%d %H:%M:%S' |
37 | 37 |
38 | 38 |
39 def GetShortHostname(): | 39 def GetShortHostname(): |
40 """Get this machine's short hostname in lower case.""" | 40 """Get this machine's short hostname in lower case.""" |
41 return socket.gethostname().split('.')[0].lower() | 41 return socket.gethostname().split('.')[0].lower() |
42 | 42 |
43 | 43 |
44 def GetGomaTmpDirectory(): | 44 def GetGomaTmpDirectory(): |
ukai
2016/08/16 05:39:47
GetGomaLogDirectory()?
tikuta
2016/08/16 05:46:01
Done.
| |
45 """Get goma's temp directory.""" | 45 """Get goma's temp directory.""" |
46 candidates = ['GOMA_TMP_DIR', 'TEST_TMPDIR', 'TMPDIR', 'TMP'] | 46 candidates = ['TEST_TMPDIR', 'TMPDIR', 'TMP'] |
47 for candidate in candidates: | 47 for candidate in candidates: |
48 value = os.environ.get(candidate) | 48 value = os.environ.get(candidate) |
49 if value and os.path.isdir(value): | 49 if value and os.path.isdir(value): |
50 return value | 50 return value |
51 return '/tmp' | 51 return '/tmp' |
52 | 52 |
53 | 53 |
54 def GetLatestGlogInfoFile(pattern): | 54 def GetLatestGlogInfoFile(pattern): |
55 """Get a filename of the latest google glog INFO file. | 55 """Get a filename of the latest google glog INFO file. |
56 | 56 |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
348 retcode = chromium_utils.RunCommand( | 348 retcode = chromium_utils.RunCommand( |
349 cmd, filter_obj=cmd_filter, | 349 cmd, filter_obj=cmd_filter, |
350 max_time=30) | 350 max_time=30) |
351 if retcode: | 351 if retcode: |
352 print('Execution of send_ts_mon_values failed with code %s' | 352 print('Execution of send_ts_mon_values failed with code %s' |
353 % retcode) | 353 % retcode) |
354 print '\n'.join(cmd_filter.text) | 354 print '\n'.join(cmd_filter.text) |
355 | 355 |
356 except Exception as ex: | 356 except Exception as ex: |
357 print('error while sending ts mon json_file=%s: %s' % (json_file, ex)) | 357 print('error while sending ts mon json_file=%s: %s' % (json_file, ex)) |
OLD | NEW |