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

Unified Diff: client/example/common.py

Issue 1337633002: Reapply "Isolated task support in Endpoints API: client side (3/3)" and fixes" (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: Final fixes Created 5 years, 3 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 | « client/example/README ('k') | client/example/payload/hello_world.isolate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/example/common.py
diff --git a/client/example/common.py b/client/example/common.py
index 689ded01c0a4b05214721f505064534ee7772259..22d680fbd0f7e0d67af4b13b32ae72c440088d7d 100644
--- a/client/example/common.py
+++ b/client/example/common.py
@@ -4,6 +4,7 @@
import datetime
import getpass
+import hashlib
import optparse
import os
import subprocess
@@ -19,7 +20,7 @@ import colorama
CHROMIUM_SWARMING_OSES = {
'darwin': 'Mac',
'cygwin': 'Windows',
- 'linux2': 'Linux',
+ 'linux2': 'Ubuntu',
'win32': 'Windows',
}
@@ -99,3 +100,26 @@ def capture(cmd):
(colorama.Fore.GREEN, ' '.join(cmd), colorama.Fore.RESET))
cmd = [sys.executable, os.path.join('..', cmd[0])] + cmd[1:]
return subprocess.check_output(cmd)
+
+
+def isolate(tempdir, isolate_server, swarming_os, verbose):
+ """Archives the payload."""
+ # All the files are put in a temporary directory. This is optional and
+ # simply done so the current directory doesn't have the following files
+ # created:
+ # - hello_world.isolated
+ # - hello_world.isolated.state
+ isolated = os.path.join(tempdir, 'hello_world.isolated')
+ note('Archiving to %s' % isolate_server)
+ run(
+ [
+ 'isolate.py',
+ 'archive',
+ '--isolate', os.path.join('payload', 'hello_world.isolate'),
+ '--isolated', isolated,
+ '--isolate-server', isolate_server,
+ '--config-variable', 'OS', swarming_os,
+ ], verbose)
+ with open(isolated, 'rb') as f:
+ hashval = hashlib.sha1(f.read()).hexdigest()
+ return isolated, hashval
« no previous file with comments | « client/example/README ('k') | client/example/payload/hello_world.isolate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698