Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: scripts/slave/goma_utils.py

Issue 2245553002: Inherit appropiate environment variables in goma module for goma_utils.py (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: fix typo and etc. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/goma/api.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 GetGomaLogDirectory():
45 """Get goma's temp directory.""" 45 """Get goma's log 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
57 Args: 57 Args:
58 pattern: a string of INFO file pattern. 58 pattern: a string of INFO file pattern.
59 59
60 Returns: 60 Returns:
61 the latest glog INFO filename in fullpath. 61 the latest glog INFO filename in fullpath.
62 """ 62 """
63 dirname = GetGomaTmpDirectory() 63 dirname = GetGomaLogDirectory()
64 info_pattern = os.path.join(dirname, '%s.*.INFO.*' % pattern) 64 info_pattern = os.path.join(dirname, '%s.*.INFO.*' % pattern)
65 candidates = glob.glob(info_pattern) 65 candidates = glob.glob(info_pattern)
66 if not candidates: 66 if not candidates:
67 return None 67 return None
68 return sorted(candidates, reverse=True)[0] 68 return sorted(candidates, reverse=True)[0]
69 69
70 70
71 def GetLatestGomaCompilerProxyInfo(): 71 def GetLatestGomaCompilerProxyInfo():
72 """Get a filename of the latest goma comiler_proxy.INFO.""" 72 """Get a filename of the latest goma comiler_proxy.INFO."""
73 return GetLatestGlogInfoFile('compiler_proxy') 73 return GetLatestGlogInfoFile('compiler_proxy')
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
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))
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/goma/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698