| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Triggers a ton of fake jobs to test its handling under high load. | 6 """Triggers a ton of fake jobs to test its handling under high load. |
| 7 | 7 |
| 8 Generates an histogram with the latencies to process the tasks and number of | 8 Generates an histogram with the latencies to process the tasks and number of |
| 9 retries. | 9 retries. |
| 10 """ | 10 """ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 from third_party import colorama | 29 from third_party import colorama |
| 30 | 30 |
| 31 from utils import graph | 31 from utils import graph |
| 32 from utils import net | 32 from utils import net |
| 33 from utils import threading_utils | 33 from utils import threading_utils |
| 34 | 34 |
| 35 # Line too long (NN/80) | 35 # Line too long (NN/80) |
| 36 # pylint: disable=C0301 | 36 # pylint: disable=C0301 |
| 37 | 37 |
| 38 | 38 OS_NAME = 'Comodore64' |
| 39 TASK_OUTPUT = 'This task ran with great success' | 39 TASK_OUTPUT = 'This task ran with great success' |
| 40 | 40 |
| 41 | 41 |
| 42 def print_results(results, columns, buckets): | 42 def print_results(results, columns, buckets): |
| 43 delays = [i for i in results if isinstance(i, float)] | 43 delays = [i for i in results if isinstance(i, float)] |
| 44 failures = [i for i in results if not isinstance(i, float)] | 44 failures = [i for i in results if not isinstance(i, float)] |
| 45 | 45 |
| 46 print('%sDELAYS%s:' % (colorama.Fore.RED, colorama.Fore.RESET)) | 46 print('%sDELAYS%s:' % (colorama.Fore.RED, colorama.Fore.RESET)) |
| 47 graph.print_histogram( | 47 graph.print_histogram( |
| 48 graph.generate_histogram(delays, buckets), columns, ' %.3f') | 48 graph.generate_histogram(delays, buckets), columns, ' %.3f') |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 # and | 110 # and |
| 111 # https://chromium.googlesource.com/chromium/tools/build.git/ \ | 111 # https://chromium.googlesource.com/chromium/tools/build.git/ \ |
| 112 # +/master/scripts/tools/swarm_bootstrap/swarm_bootstrap.py | 112 # +/master/scripts/tools/swarm_bootstrap/swarm_bootstrap.py |
| 113 # for more details. | 113 # for more details. |
| 114 self._attributes = { | 114 self._attributes = { |
| 115 'dimensions': { | 115 'dimensions': { |
| 116 # Use improbable values to reduce the chance of interferring with real | 116 # Use improbable values to reduce the chance of interferring with real |
| 117 # slaves. | 117 # slaves. |
| 118 'bits': '36', | 118 'bits': '36', |
| 119 'machine': os.uname()[4] + '-experimental', | 119 'machine': os.uname()[4] + '-experimental', |
| 120 'os': ['Comodore64'], | 120 'os': [OS_NAME], |
| 121 }, | 121 }, |
| 122 'id': self._machine_id, | 122 'id': self._machine_id, |
| 123 'try_count': 0, | 123 'try_count': 0, |
| 124 'tag': self._machine_id, | 124 'tag': self._machine_id, |
| 125 'version': swarm_bot_hash, | 125 'version': swarm_bot_hash, |
| 126 } | 126 } |
| 127 | 127 |
| 128 self._thread = threading.Thread(target=self._run, name='bot%d' % index) | 128 self._thread = threading.Thread(target=self._run, name='bot%d' % index) |
| 129 self._thread.daemon = True | 129 self._thread.daemon = True |
| 130 self._thread.start() | 130 self._thread.start() |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 results = events.queue | 317 results = events.queue |
| 318 print_results(results, options.columns, options.buckets) | 318 print_results(results, options.columns, options.buckets) |
| 319 if options.dump: | 319 if options.dump: |
| 320 with open(options.dump, 'w') as f: | 320 with open(options.dump, 'w') as f: |
| 321 json.dump(results, f, separators=(',',':')) | 321 json.dump(results, f, separators=(',',':')) |
| 322 return 0 | 322 return 0 |
| 323 | 323 |
| 324 | 324 |
| 325 if __name__ == '__main__': | 325 if __name__ == '__main__': |
| 326 sys.exit(main()) | 326 sys.exit(main()) |
| OLD | NEW |