Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: appengine/swarming/swarming_bot/bot_code/bot_main.py

Issue 2969463002: Use config.json to enable Isolated gRPC proxy (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | client/isolate_storage.py » ('j') | client/isolateserver.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 """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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 """Returns flags to pass to run_isolated. 568 """Returns flags to pass to run_isolated.
569 569
570 These are not meant to be processed by task_runner.py. 570 These are not meant to be processed by task_runner.py.
571 """ 571 """
572 settings = _get_settings(botobj) 572 settings = _get_settings(botobj)
573 partition = settings['free_partition'] 573 partition = settings['free_partition']
574 size = os_utilities.get_disk_size(THIS_FILE) 574 size = os_utilities.get_disk_size(THIS_FILE)
575 min_free = ( 575 min_free = (
576 _min_free_disk({'size_mb': size}, partition) + 576 _min_free_disk({'size_mb': size}, partition) +
577 partition['wiggle']) 577 partition['wiggle'])
578 return [ 578 args = [
579 '--cache', os.path.join(botobj.base_dir, 'isolated_cache'), 579 '--cache', os.path.join(botobj.base_dir, 'isolated_cache'),
580 '--min-free-space', str(min_free), 580 '--min-free-space', str(min_free),
581 '--named-cache-root', os.path.join(botobj.base_dir, 'c'), 581 '--named-cache-root', os.path.join(botobj.base_dir, 'c'),
582 '--max-cache-size', str(settings['caches']['isolated']['size']), 582 '--max-cache-size', str(settings['caches']['isolated']['size']),
583 '--max-items', str(settings['caches']['isolated']['items']), 583 '--max-items', str(settings['caches']['isolated']['items']),
584 ] 584 ]
585 585
586 # Get the gRPC proxy from the config, but allow an environment variable to
587 # override.
588 grpc_proxy = get_config().get('isolate-grpc-proxy')
Vadim Sh. 2017/06/29 19:00:18 use underscores, so it is a valid proto field name
aludwin 2017/06/29 19:14:30 Done.
589 grpc_proxy = os.environ.get('ISOLATE_GRPC_PROXY', grpc_proxy)
590 if grpc_proxy is not None:
591 logging.info('Isolate will use gRPC proxy %s', grpc_proxy)
592 args.extend(['--grpc-proxy', grpc_proxy])
593 return args
594
586 595
587 def _clean_cache(botobj): 596 def _clean_cache(botobj):
588 """Asks run_isolated to clean its cache. 597 """Asks run_isolated to clean its cache.
589 598
590 This may take a while but it ensures that in the case of a run_isolated run 599 This may take a while but it ensures that in the case of a run_isolated run
591 failed and it temporarily used more space than _min_free_disk, it can cleans 600 failed and it temporarily used more space than _min_free_disk, it can cleans
592 up the mess properly. 601 up the mess properly.
593 602
594 It will remove unexpected files, remove corrupted files, trim the cache size 603 It will remove unexpected files, remove corrupted files, trim the cache size
595 based on the policies and update state.json. 604 based on the policies and update state.json.
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 error = None 1232 error = None
1224 if len(args.unsupported) != 0: 1233 if len(args.unsupported) != 0:
1225 error = 'Unexpected arguments: %s' % args 1234 error = 'Unexpected arguments: %s' % args
1226 try: 1235 try:
1227 return _run_bot(error) 1236 return _run_bot(error)
1228 finally: 1237 finally:
1229 _call_hook_safe( 1238 _call_hook_safe(
1230 True, bot.Bot(None, None, None, None, base_dir, None), 1239 True, bot.Bot(None, None, None, None, base_dir, None),
1231 'on_bot_shutdown') 1240 'on_bot_shutdown')
1232 logging.info('main() returning') 1241 logging.info('main() returning')
OLDNEW
« no previous file with comments | « no previous file | client/isolate_storage.py » ('j') | client/isolateserver.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698