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

Unified Diff: appengine/swarming/server/bot_archive.py

Issue 2969513002: Add a default Isolate gRPC proxy in config (Closed)
Patch Set: Fix problem in tests Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/swarming/proto/config_pb2.py ('k') | appengine/swarming/server/bot_code.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/server/bot_archive.py
diff --git a/appengine/swarming/server/bot_archive.py b/appengine/swarming/server/bot_archive.py
index c652fd7aa26e75a4b183767458ac1fc84221f8ac..a656581ec9bde53f1cd6e9d90371b604bdc1e6c7 100644
--- a/appengine/swarming/server/bot_archive.py
+++ b/appengine/swarming/server/bot_archive.py
@@ -377,27 +377,26 @@ def resolve_symlink(path):
def yield_swarming_bot_files(
- root_dir, host, host_version, additionals, enable_ts_monitoring):
+ root_dir, host, host_version, additionals, settings):
"""Yields all the files to map as tuple(filename, content).
config.json is injected with json data about the server.
This function guarantees that the output is sorted by filename.
"""
- grpc_prefix = 'grpc://'
- is_grpc = host.startswith(grpc_prefix)
- if is_grpc:
- host = host[len(grpc_prefix):]
-
items = {i: None for i in FILES}
items.update(additionals)
config = {
- 'enable_ts_monitoring': enable_ts_monitoring,
- 'is_grpc': is_grpc,
'server': host.rstrip('/'),
'server_version': host_version,
}
+
+ if settings:
+ config['enable_ts_monitoring'] = settings.enable_ts_monitoring
+ config['isolate_grpc_proxy'] = settings.bot_isolate_grpc_proxy
+
items['config/config.json'] = json.dumps(config)
+ logging.debug('Bot config.json: %s', items['config/config.json'])
for item, content in sorted(items.iteritems()):
if content is not None:
yield item, content
@@ -407,7 +406,7 @@ def yield_swarming_bot_files(
def get_swarming_bot_zip(
- root_dir, host, host_version, additionals, enable_ts_monitoring):
+ root_dir, host, host_version, additionals, settings):
"""Returns a zipped file of all the files a bot needs to run.
Arguments:
@@ -425,7 +424,7 @@ def get_swarming_bot_zip(
h = hashlib.sha256()
with zipfile.ZipFile(zip_memory_file, 'w', zipfile.ZIP_DEFLATED) as zip_file:
for name, content in yield_swarming_bot_files(
- root_dir, host, host_version, additionals, enable_ts_monitoring):
+ root_dir, host, host_version, additionals, settings):
zip_file.writestr(name, content)
h.update(str(len(name)))
h.update(name)
@@ -441,7 +440,7 @@ def get_swarming_bot_zip(
def get_swarming_bot_version(
- root_dir, host, host_version, additionals, enable_ts_monitoring):
+ root_dir, host, host_version, additionals, settings):
"""Returns the SHA256 hash of the bot code, representing the version.
Arguments:
@@ -456,7 +455,7 @@ def get_swarming_bot_version(
try:
# TODO(maruel): Deduplicate from zip_package.genereate_version().
for name, content in yield_swarming_bot_files(
- root_dir, host, host_version, additionals, enable_ts_monitoring):
+ root_dir, host, host_version, additionals, settings):
h.update(str(len(name)))
h.update(name)
h.update(str(len(content)))
« no previous file with comments | « appengine/swarming/proto/config_pb2.py ('k') | appengine/swarming/server/bot_code.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698