OLD | NEW |
1 # Copyright 2013 The LUCI Authors. All rights reserved. | 1 # Copyright 2013 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
4 | 4 |
5 """Runs a Swarming task. | 5 """Runs a Swarming task. |
6 | 6 |
7 Downloads all the necessary files to run the task, executes the command and | 7 Downloads all the necessary files to run the task, executes the command and |
8 streams results back to the Swarming server. | 8 streams results back to the Swarming server. |
9 | 9 |
10 The process exit code is 0 when the task was executed, even if the task itself | 10 The process exit code is 0 when the task was executed, even if the task itself |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 params['bot_overhead'] -= run_isolated_result.get( | 571 params['bot_overhead'] -= run_isolated_result.get( |
572 'cipd', {}).get('duration', 0) | 572 'cipd', {}).get('duration', 0) |
573 if params['bot_overhead'] < 0: | 573 if params['bot_overhead'] < 0: |
574 params['bot_overhead'] = 0 | 574 params['bot_overhead'] = 0 |
575 isolated_stats = run_isolated_result.get('stats', {}).get('isolated') | 575 isolated_stats = run_isolated_result.get('stats', {}).get('isolated') |
576 if isolated_stats: | 576 if isolated_stats: |
577 params['isolated_stats'] = isolated_stats | 577 params['isolated_stats'] = isolated_stats |
578 cipd_stats = run_isolated_result.get('stats', {}).get('cipd') | 578 cipd_stats = run_isolated_result.get('stats', {}).get('cipd') |
579 if cipd_stats: | 579 if cipd_stats: |
580 params['cipd_stats'] = cipd_stats | 580 params['cipd_stats'] = cipd_stats |
| 581 cipd_pins = run_isolated_result.get('cipd_pins') |
| 582 if cipd_pins: |
| 583 params['cipd_pins'] = cipd_pins |
581 except (IOError, OSError, ValueError) as e: | 584 except (IOError, OSError, ValueError) as e: |
582 logging.error('Swallowing error: %s', e) | 585 logging.error('Swallowing error: %s', e) |
583 if not must_signal_internal_failure: | 586 if not must_signal_internal_failure: |
584 must_signal_internal_failure = '%s\n%s' % ( | 587 must_signal_internal_failure = '%s\n%s' % ( |
585 e, traceback.format_exc()[-2048:]) | 588 e, traceback.format_exc()[-2048:]) |
586 # TODO(maruel): Send the internal failure here instead of sending it through | 589 # TODO(maruel): Send the internal failure here instead of sending it through |
587 # bot_main, this causes a race condition. | 590 # bot_main, this causes a race condition. |
588 if exit_code is None: | 591 if exit_code is None: |
589 exit_code = -1 | 592 exit_code = -1 |
590 params['hard_timeout'] = had_hard_timeout | 593 params['hard_timeout'] = had_hard_timeout |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 options.start = now | 639 options.start = now |
637 | 640 |
638 try: | 641 try: |
639 load_and_run( | 642 load_and_run( |
640 options.in_file, options.swarming_server, options.cost_usd_hour, | 643 options.in_file, options.swarming_server, options.cost_usd_hour, |
641 options.start, options.out_file, options.min_free_space, | 644 options.start, options.out_file, options.min_free_space, |
642 options.bot_file, options.auth_params_file) | 645 options.bot_file, options.auth_params_file) |
643 return 0 | 646 return 0 |
644 finally: | 647 finally: |
645 logging.info('quitting') | 648 logging.info('quitting') |
OLD | NEW |