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

Unified Diff: swarm_client/example/run_example_cad.py

Issue 69143004: Delete swarm_client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/
Patch Set: Created 7 years, 1 month 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 | « swarm_client/example/hello_world.py ('k') | swarm_client/example/run_example_local.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: swarm_client/example/run_example_cad.py
===================================================================
--- swarm_client/example/run_example_cad.py (revision 235167)
+++ swarm_client/example/run_example_cad.py (working copy)
@@ -1,85 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Runs hello_world.py, through hello_world.isolated, locally in a temporary
-directory with the files fetched from the remote Content-Addressed Datastore.
-"""
-
-import hashlib
-import optparse
-import os
-import shutil
-import subprocess
-import sys
-import tempfile
-
-ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
-
-
-def run(cmd):
- print('Running: %s' % ' '.join(cmd))
- cmd = [sys.executable, os.path.join(ROOT_DIR, '..', cmd[0])] + cmd[1:]
- if sys.platform != 'win32':
- cmd = ['time', '-p'] + cmd
- subprocess.check_call(cmd)
-
-
-def main():
- parser = optparse.OptionParser(description=sys.modules[__name__].__doc__)
- parser.add_option(
- '-I', '--isolate-server',
- metavar='URL', default='',
- help='Isolate server to use')
- parser.add_option('-v', '--verbose', action='count', default=0)
- options, args = parser.parse_args()
- if args:
- parser.error('Unsupported argument %s' % args)
- if not options.isolate_server:
- parser.error('--isolate-server is required.')
- os.environ['ISOLATE_DEBUG'] = str(options.verbose)
-
- try:
- # 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
- # - cache/
- tempdir = tempfile.mkdtemp(prefix='hello_world')
- cachedir = os.path.join(tempdir, 'cache')
- isolateddir = os.path.join(tempdir, 'isolated')
- isolated = os.path.join(isolateddir, 'hello_world.isolated')
-
- os.mkdir(isolateddir)
-
- print('Archiving')
- run(
- [
- 'isolate.py',
- 'archive',
- '--isolate', os.path.join(ROOT_DIR, 'hello_world.isolate'),
- '--isolated', isolated,
- '--outdir', options.isolate_server,
- ])
-
- print('\nRunning')
- hashval = hashlib.sha1(open(isolated, 'rb').read()).hexdigest()
- run(
- [
- 'run_isolated.py',
- '--cache', cachedir,
- '--isolate-server', options.isolate_server,
- '--hash', hashval,
- '--no-log',
- ])
- return 0
- except subprocess.CalledProcessError as e:
- return e.returncode
- finally:
- shutil.rmtree(tempdir)
-
-
-if __name__ == '__main__':
- sys.exit(main())
« no previous file with comments | « swarm_client/example/hello_world.py ('k') | swarm_client/example/run_example_local.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698