Chromium Code Reviews| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 slave_utils.GSUtilCopy(temp.name, gs_path, override_gsutil=override_gsutil) | 108 slave_utils.GSUtilCopy(temp.name, gs_path, override_gsutil=override_gsutil) |
| 109 print "Copied log file to %s" % gs_path | 109 print "Copied log file to %s" % gs_path |
| 110 finally: | 110 finally: |
| 111 os.remove(temp.name) | 111 os.remove(temp.name) |
| 112 return log_path | 112 return log_path |
| 113 | 113 |
| 114 | 114 |
| 115 def UploadGomaCompilerProxyInfo(override_gsutil=None): | 115 def UploadGomaCompilerProxyInfo(override_gsutil=None): |
| 116 """Upload goma compiler_proxy.INFO to Google Storage.""" | 116 """Upload goma compiler_proxy.INFO to Google Storage.""" |
| 117 latest_subproc_info = GetLatestGomaCompilerProxySubprocInfo() | 117 latest_subproc_info = GetLatestGomaCompilerProxySubprocInfo() |
| 118 | |
| 119 clobber = 0 | |
| 120 if os.environ.get('BUILDBOT_CLOBBER'): | |
| 121 clobber = 1 | |
| 122 metadata = { | |
| 123 'master': os.environ.get('BUILDBOT_MASTERNAME', 'unknown'), | |
| 124 'slave': os.environ.get('BUILDBOT_SLAVENAME', 'unknown'), | |
| 125 'builder': os.environ.get('BUILDBOT_BUILDERNAME', 'unknown'), | |
| 126 'clobber': clobber | |
| 127 'os': chromium_utils.PlatformName(), | |
| 128 'env': {}, | |
|
tikuta
2016/09/01 09:12:54
Why don't you use os.environ.clone()?
shinyak
2016/09/01 09:25:38
There is no method clone() in os.environ.
json.dum
| |
| 129 } | |
|
ukai
2016/09/02 05:06:31
sucproc info name?
| |
| 130 for k, v in os.environ.iteritems(): | |
| 131 metadata['env'][k] = v | |
| 132 | |
| 133 text_to_append = '# end of compiler proxy log\n' + json.dumps(metadata) | |
| 134 | |
| 118 if latest_subproc_info: | 135 if latest_subproc_info: |
| 119 UploadToGomaLogGS(latest_subproc_info, | 136 UploadToGomaLogGS(latest_subproc_info, |
| 120 os.path.basename(latest_subproc_info), | 137 os.path.basename(latest_subproc_info), |
| 121 override_gsutil=override_gsutil) | 138 override_gsutil=override_gsutil) |
| 122 else: | 139 else: |
| 123 print 'No compiler_proxy-subproc.INFO to upload' | 140 print 'No compiler_proxy-subproc.INFO to upload' |
| 124 latest_info = GetLatestGomaCompilerProxyInfo() | 141 latest_info = GetLatestGomaCompilerProxyInfo() |
| 125 if not latest_info: | 142 if not latest_info: |
| 126 print 'No compiler_proxy.INFO to upload' | 143 print 'No compiler_proxy.INFO to upload' |
| 127 return | 144 return |
| 128 # Since a filename of compiler_proxy.INFO is fairly unique, | 145 # Since a filename of compiler_proxy.INFO is fairly unique, |
| 129 # we might be able to upload it as-is. | 146 # we might be able to upload it as-is. |
| 130 log_path = UploadToGomaLogGS( | 147 log_path = UploadToGomaLogGS( |
| 131 latest_info, os.path.basename(latest_info), | 148 latest_info, os.path.basename(latest_info), |
| 149 text_to_append=text_to_append, | |
| 132 override_gsutil=override_gsutil) | 150 override_gsutil=override_gsutil) |
| 133 viewer_url = ('http://chromium-build-stats.appspot.com/compiler_proxy_log/' | 151 viewer_url = ('http://chromium-build-stats.appspot.com/compiler_proxy_log/' |
| 134 + log_path) | 152 + log_path) |
| 135 print 'Visualization at %s' % viewer_url | 153 print 'Visualization at %s' % viewer_url |
| 136 | 154 |
| 137 | 155 |
| 138 def UploadNinjaLog( | 156 def UploadNinjaLog( |
| 139 outdir, compiler, command, exit_status, override_gsutil=None): | 157 outdir, compiler, command, exit_status, override_gsutil=None): |
| 140 """Upload .ninja_log to Google Cloud Storage (gs://chrome-goma-log), | 158 """Upload .ninja_log to Google Cloud Storage (gs://chrome-goma-log), |
| 141 in the same folder with goma's compiler_proxy.INFO. | 159 in the same folder with goma's compiler_proxy.INFO. |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 retcode = chromium_utils.RunCommand( | 366 retcode = chromium_utils.RunCommand( |
| 349 cmd, filter_obj=cmd_filter, | 367 cmd, filter_obj=cmd_filter, |
| 350 max_time=30) | 368 max_time=30) |
| 351 if retcode: | 369 if retcode: |
| 352 print('Execution of send_ts_mon_values failed with code %s' | 370 print('Execution of send_ts_mon_values failed with code %s' |
| 353 % retcode) | 371 % retcode) |
| 354 print '\n'.join(cmd_filter.text) | 372 print '\n'.join(cmd_filter.text) |
| 355 | 373 |
| 356 except Exception as ex: | 374 except Exception as ex: |
| 357 print('error while sending ts mon json_file=%s: %s' % (json_file, ex)) | 375 print('error while sending ts mon json_file=%s: %s' % (json_file, ex)) |
| OLD | NEW |