| 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 datetime | 8 import datetime |
| 9 import getpass | 9 import getpass |
| 10 import glob | 10 import glob |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 'builder': os.environ.get('BUILDBOT_BUILDERNAME', 'unknown'), | 311 'builder': os.environ.get('BUILDBOT_BUILDERNAME', 'unknown'), |
| 312 'master': os.environ.get('BUILDBOT_MASTERNAME', 'unknown'), | 312 'master': os.environ.get('BUILDBOT_MASTERNAME', 'unknown'), |
| 313 'slave': os.environ.get('BUILDBOT_SLAVENAME', 'unknown'), | 313 'slave': os.environ.get('BUILDBOT_SLAVENAME', 'unknown'), |
| 314 'clobber': clobber, | 314 'clobber': clobber, |
| 315 'os': os.name, | 315 'os': os.name, |
| 316 'result': result} | 316 'result': result} |
| 317 start_time = GetCompilerProxyStartTime() | 317 start_time = GetCompilerProxyStartTime() |
| 318 if start_time: | 318 if start_time: |
| 319 counter['start_time'] = int( | 319 counter['start_time'] = int( |
| 320 (start_time - datetime.datetime.fromtimestamp(0)).total_seconds()) | 320 (start_time - datetime.datetime.fromtimestamp(0)).total_seconds()) |
| 321 cmd = [PLATFORM_RUN_CMD.get(os.name), | 321 run_cmd = PLATFORM_RUN_CMD.get(os.name) |
| 322 if not run_cmd: |
| 323 print 'Unknown os.name: %s' % os.name |
| 324 return |
| 325 cmd = [sys.executable, |
| 326 run_cmd, |
| 322 'infra.tools.send_ts_mon_values', '--verbose', | 327 'infra.tools.send_ts_mon_values', '--verbose', |
| 323 '--ts-mon-target-type', 'task', | 328 '--ts-mon-target-type', 'task', |
| 324 '--ts-mon-task-service-name', 'goma-client', | 329 '--ts-mon-task-service-name', 'goma-client', |
| 325 '--ts-mon-task-job-name', 'default', | 330 '--ts-mon-task-job-name', 'default', |
| 326 '--counter', json.dumps(counter)] | 331 '--counter', json.dumps(counter)] |
| 327 cmd_filter = chromium_utils.FilterCapture() | 332 cmd_filter = chromium_utils.FilterCapture() |
| 328 retcode = chromium_utils.RunCommand( | 333 retcode = chromium_utils.RunCommand( |
| 329 cmd, filter_obj=cmd_filter, | 334 cmd, filter_obj=cmd_filter, |
| 330 max_time=30) | 335 max_time=30) |
| 331 if retcode: | 336 if retcode: |
| 332 print('Execution of send_ts_mon_values failed with code %s' | 337 print('Execution of send_ts_mon_values failed with code %s' |
| 333 % retcode) | 338 % retcode) |
| 334 print '\n'.join(cmd_filter.text) | 339 print '\n'.join(cmd_filter.text) |
| 335 | 340 |
| 336 except Exception as ex: | 341 except Exception as ex: |
| 337 print('error while sending ts mon json_file=%s: %s' % (json_file, ex)) | 342 print('error while sending ts mon json_file=%s: %s' % (json_file, ex)) |
| OLD | NEW |