| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """This module contains functionality for starting build try jobs via HTTP. | 5 """This module contains functionality for starting build try jobs via HTTP. |
| 6 | 6 |
| 7 This includes both sending a request to start a job, and also related code | 7 This includes both sending a request to start a job, and also related code |
| 8 for querying the status of the job. | 8 for querying the status of the job. |
| 9 | 9 |
| 10 This module can be either run as a stand-alone script to send a request to a | 10 This module can be either run as a stand-alone script to send a request to a |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 class ServerAccessError(Exception): | 49 class ServerAccessError(Exception): |
| 50 | 50 |
| 51 def __str__(self): | 51 def __str__(self): |
| 52 return '%s\nSorry, cannot connect to server.' % self.args[0] | 52 return '%s\nSorry, cannot connect to server.' % self.args[0] |
| 53 | 53 |
| 54 | 54 |
| 55 def PostTryJob(host, port, params): | 55 def PostTryJob(host, port, params): |
| 56 """Sends a build request to the server using the HTTP protocol. | 56 """Sends a build request to the server using the HTTP protocol. |
| 57 | 57 |
| 58 The required parameters are: | 58 The required parameters are: |
| 59 'revision': "src@rev", where rev is an SVN Revision to build. | 59 'revision': "src@rev", where rev is a git hash or SVN revision. |
| 60 'bot': Name of builder bot to use, e.g. "win_perf_bisect_builder". | 60 'bot': Name of builder bot to use, e.g. "win_perf_bisect_builder". |
| 61 | 61 |
| 62 Args: | 62 Args: |
| 63 host: Hostname of the try server. | 63 host: Hostname of the try server. |
| 64 port: Port of the try server. | 64 port: Port of the try server. |
| 65 params: A dictionary of parameters to be sent in the POST request. | 65 params: A dictionary of parameters to be sent in the POST request. |
| 66 | 66 |
| 67 Returns: | 67 Returns: |
| 68 True if the request is posted successfully. | 68 True if the request is posted successfully. |
| 69 | 69 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 options, _ = parser.parse_args() | 360 options, _ = parser.parse_args() |
| 361 if not options.host or not options.port: | 361 if not options.host or not options.port: |
| 362 parser.print_help() | 362 parser.print_help() |
| 363 return 1 | 363 return 1 |
| 364 params = _GetRequestParams(options) | 364 params = _GetRequestParams(options) |
| 365 PostTryJob(options.host, options.port, params) | 365 PostTryJob(options.host, options.port, params) |
| 366 | 366 |
| 367 | 367 |
| 368 if __name__ == '__main__': | 368 if __name__ == '__main__': |
| 369 sys.exit(Main(sys.argv)) | 369 sys.exit(Main(sys.argv)) |
| OLD | NEW |