Commit e9cc819f authored by Ye Kuang's avatar Ye Kuang Committed by Commit Bot

Use luci-go isolate client in mb.py

Because go's "check" subcommand doesn't generate isolated file, the '-s' flag is dropped. This is fine because Go isolate doesn't consume isolated file at all. More details in crbug.com/1059668.

#Benchmark

Benchmark is done using the "archive" subcommand. Note that the first invocation will upload to isolate-server, which we want to *exclude*. So the results were taken from the second invocation.

##blink_web_tests:

* PY: 1m15s~1m40s (python tools/swarming_client/isolate.py archive -i out/Release/blink_web_tests.isolate -s out/Release/blink_web_tests.isolated -I https://isolateserver.appspot.com)
* GO: ~8s (tools/luci-go/isolate archive -i out/Release/blink_web_tests.isolate -s out/Release/blink_web_tests.isolated -I https://isolateserver.appspot.com)

##browsers_tests:

* PY: 31s
* GO: 3s

Bug: 1059167
Change-Id: Idffb6c33e2482c2829f54c56e753623f26997a10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094482
Commit-Queue: Ye Kuang <yekuang@google.com>
Reviewed-by: default avatarTakuto Ikuta <tikuta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749557}
parent 99e66d37
...@@ -99,6 +99,8 @@ class MetaBuildWrapper(object): ...@@ -99,6 +99,8 @@ class MetaBuildWrapper(object):
self.masters = {} self.masters = {}
self.buckets = {} self.buckets = {}
self.mixins = {} self.mixins = {}
self.isolate_exe = 'isolate.exe' if self.platform.startswith(
'win') else 'isolate'
def Main(self, args): def Main(self, args):
self.ParseArgs(args) self.ParseArgs(args)
...@@ -564,11 +566,10 @@ class MetaBuildWrapper(object): ...@@ -564,11 +566,10 @@ class MetaBuildWrapper(object):
try: try:
zip_dir = self.TempDir() zip_dir = self.TempDir()
remap_cmd = [ remap_cmd = [
self.executable, self.PathJoin(self.chromium_src_dir, 'tools', 'luci-go',
self.PathJoin(self.chromium_src_dir, 'tools', 'swarming_client', self.isolate_exe), 'remap', '-i',
'isolate.py'), 'remap', '--collapse_symlinks', '-s', self.PathJoin(self.args.path, self.args.target + '.isolate'),
self.PathJoin(self.args.path, self.args.target + '.isolated'), '-o', '-outdir', zip_dir
zip_dir
] ]
self.Run(remap_cmd) self.Run(remap_cmd)
...@@ -647,13 +648,16 @@ class MetaBuildWrapper(object): ...@@ -647,13 +648,16 @@ class MetaBuildWrapper(object):
dimensions += ['-d', k, v] dimensions += ['-d', k, v]
cmd = [ cmd = [
self.executable, self.PathJoin(self.chromium_src_dir, 'tools', 'luci-go',
self.PathJoin('tools', 'swarming_client', 'isolate.py'), self.isolate_exe),
'archive', 'archive',
'-s', self.ToSrcRelPath('%s/%s.isolated' % (build_dir, target)), '-s',
'-I', isolate_server, self.ToSrcRelPath('%s/%s.isolated' % (build_dir, target)),
'--namespace', namespace, '-I',
] isolate_server,
'-namespace',
namespace,
]
# Talking to the isolateserver may fail because we're not logged in. # Talking to the isolateserver may fail because we're not logged in.
# We trap the command explicitly and rewrite the error output so that # We trap the command explicitly and rewrite the error output so that
...@@ -694,12 +698,12 @@ class MetaBuildWrapper(object): ...@@ -694,12 +698,12 @@ class MetaBuildWrapper(object):
def _RunLocallyIsolated(self, build_dir, target): def _RunLocallyIsolated(self, build_dir, target):
cmd = [ cmd = [
self.executable, self.PathJoin(self.chromium_src_dir, 'tools', 'luci-go',
self.PathJoin('tools', 'swarming_client', 'isolate.py'), self.isolate_exe),
'run', 'run',
'-s', '-i',
self.ToSrcRelPath('%s/%s.isolated' % (build_dir, target)), self.ToSrcRelPath('%s/%s.isolate' % (build_dir, target)),
] ]
if self.args.extra_args: if self.args.extra_args:
cmd += ['--'] + self.args.extra_args cmd += ['--'] + self.args.extra_args
ret, _, _ = self.Run(cmd, force_verbose=True, buffer_output=False) ret, _, _ = self.Run(cmd, force_verbose=True, buffer_output=False)
...@@ -1287,14 +1291,13 @@ class MetaBuildWrapper(object): ...@@ -1287,14 +1291,13 @@ class MetaBuildWrapper(object):
return ret return ret
ret, _, _ = self.Run([ ret, _, _ = self.Run([
self.executable, self.PathJoin(self.chromium_src_dir, 'tools', 'luci-go',
self.PathJoin('tools', 'swarming_client', 'isolate.py'), self.isolate_exe),
'check', 'check',
'-i', '-i',
self.ToSrcRelPath('%s/%s.isolate' % (build_dir, target)), self.ToSrcRelPath('%s/%s.isolate' % (build_dir, target)),
'-s', ],
self.ToSrcRelPath('%s/%s.isolated' % (build_dir, target))], buffer_output=False)
buffer_output=False)
return ret return ret
......
...@@ -842,7 +842,7 @@ class UnitTest(unittest.TestCase): ...@@ -842,7 +842,7 @@ class UnitTest(unittest.TestCase):
} }
def run_stub(cmd, **_kwargs): def run_stub(cmd, **_kwargs):
if 'isolate.py' in cmd[1]: if os.path.join('tools', 'luci-go', 'isolate') in cmd[0]:
return 0, 'fake_hash base_unittests', '' return 0, 'fake_hash base_unittests', ''
else: else:
return 0, '', '' return 0, '', ''
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment