OLD | NEW |
1 # Copyright 2013 The Swarming Authors. All rights reserved. | 1 # Copyright 2013 The Swarming Authors. All rights reserved. |
2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed by the Apache v2.0 license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Swarming bot main process. | 5 """Swarming bot main process. |
6 | 6 |
7 This is the program that communicates with the Swarming server, ensures the code | 7 This is the program that communicates with the Swarming server, ensures the code |
8 is always up to date and executes a child process to run tasks and upload | 8 is always up to date and executes a child process to run tasks and upload |
9 results back. | 9 results back. |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 import os | 21 import os |
22 import shutil | 22 import shutil |
23 import subprocess | 23 import subprocess |
24 import sys | 24 import sys |
25 import tempfile | 25 import tempfile |
26 import time | 26 import time |
27 import traceback | 27 import traceback |
28 import zipfile | 28 import zipfile |
29 | 29 |
30 import bot | 30 import bot |
31 import logging_utils | |
32 import os_utilities | 31 import os_utilities |
33 import xsrf_client | 32 import xsrf_client |
| 33 from utils import logging_utils |
34 from utils import net | 34 from utils import net |
35 from utils import on_error | 35 from utils import on_error |
36 from utils import zip_package | 36 from utils import zip_package |
37 | 37 |
38 | 38 |
39 # Path to this file or the zip containing this file. | 39 # Path to this file or the zip containing this file. |
40 THIS_FILE = os.path.abspath(zip_package.get_main_script_path()) | 40 THIS_FILE = os.path.abspath(zip_package.get_main_script_path()) |
41 | 41 |
42 # Root directory containing this file or the zip containing this file. | 42 # Root directory containing this file or the zip containing this file. |
43 ROOT_DIR = os.path.dirname(THIS_FILE) | 43 ROOT_DIR = os.path.dirname(THIS_FILE) |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 logging_utils.set_console_level(levels[min(options.verbose, len(levels)-1)]) | 525 logging_utils.set_console_level(levels[min(options.verbose, len(levels)-1)]) |
526 if args: | 526 if args: |
527 parser.error('Unsupported args.') | 527 parser.error('Unsupported args.') |
528 except Exception as e: | 528 except Exception as e: |
529 # Do not reboot here, because it would just cause a reboot loop. | 529 # Do not reboot here, because it would just cause a reboot loop. |
530 error = str(e) | 530 error = str(e) |
531 try: | 531 try: |
532 return run_bot(error) | 532 return run_bot(error) |
533 finally: | 533 finally: |
534 call_hook(bot.Bot(None, None, None, ROOT_DIR, None), 'on_bot_shutdown') | 534 call_hook(bot.Bot(None, None, None, ROOT_DIR, None), 'on_bot_shutdown') |
OLD | NEW |