def main(): options = common.parse_args(use_isolate_server=True, use_swarming=True) try: tempdir = tempfile.mkdtemp(prefix=u'hello_world') try: _, hashval = common.isolate(tempdir, options.isolate_server, options.swarming_os, options.verbose) json_file = os.path.join(tempdir, 'task.json') common.note('Running on %s' % options.swarming) cmd = [ 'swarming.py', 'trigger', '--swarming', options.swarming, '--isolate-server', options.isolate_server, '--dimension', 'os', options.swarming_os, '--task-name', options.task_name, '--dump-json', json_file, '--isolated', hashval, '--shards', '2', ] if options.idempotent: cmd.append('--idempotent') if options.priority is not None: cmd.extend(('--priority', str(options.priority))) cmd.extend(('--', '${ISOLATED_OUTDIR}')) common.run(cmd, options.verbose) common.note('Getting results from %s' % options.swarming) common.run([ 'swarming.py', 'collect', '--swarming', options.swarming, '--json', json_file, '--task-output-dir', 'example_result', ], options.verbose) for root, _, files in os.walk('example_result'): for name in files: p = os.path.join(root, name) with open(p, 'rb') as f: print('%s content:' % p) print(f.read()) return 0 finally: shutil.rmtree(tempdir) except subprocess.CalledProcessError as e: return e.returncode
def main(): options = common.parse_args(use_isolate_server=True, use_swarming=True) try: tempdir = tempfile.mkdtemp(prefix=u'hello_world') try: _, hashval = common.isolate( tempdir, options.isolate_server, options.swarming_os, options.verbose) json_file = os.path.join(tempdir, 'task.json') common.note('Running on %s' % options.swarming) cmd = [ 'swarming.py', 'trigger', '--swarming', options.swarming, '--isolate-server', options.isolate_server, '--dimension', 'os', options.swarming_os, '--dimension', 'pool', 'default', '--task-name', options.task_name, '--dump-json', json_file, '--isolated', hashval, '--shards', '2', ] if options.idempotent: cmd.append('--idempotent') if options.priority is not None: cmd.extend(('--priority', str(options.priority))) cmd.extend(('--', '${ISOLATED_OUTDIR}')) common.run(cmd, options.verbose) common.note('Getting results from %s' % options.swarming) common.run( [ 'swarming.py', 'collect', '--swarming', options.swarming, '--json', json_file, '--task-output-dir', 'example_result', ], options.verbose) for root, _, files in os.walk('example_result'): for name in files: p = os.path.join(root, name) with open(p, 'rb') as f: print('%s content:' % p) print(f.read()) return 0 finally: shutil.rmtree(tempdir) except subprocess.CalledProcessError as e: return e.returncode
def main(): options = common.parse_args(use_isolate_server=True, use_swarming=True) tempdir = tempfile.mkdtemp(prefix=u'hello_world') try: isolated_hash = common.isolate(tempdir, options.isolate_server, options.swarming_os, options.verbose) common.note('Running the job remotely. This:\n' ' - archives to %s\n' ' - runs and collect results via %s' % (options.isolate_server, options.swarming)) cmd = [ 'swarming.py', 'run', '--swarming', options.swarming, '--isolate-server', options.isolate_server, '--dimension', 'os', options.swarming_os, '--dimension', 'pool', 'default', '--task-name', options.task_name, '--task-summary-json', 'example_result.json', '--decorate', '--isolated', isolated_hash, ] if options.idempotent: cmd.append('--idempotent') if options.priority is not None: cmd.extend(('--priority', str(options.priority))) if options.service_account: cmd.extend(('--service-account', options.service_account)) common.run(cmd, options.verbose) with open('example_result.json', 'rb') as f: print('example_result.json content:') print(f.read()) return 0 except subprocess.CalledProcessError as e: return e.returncode finally: shutil.rmtree(tempdir)
def main(): options = common.parse_args(use_isolate_server=True, use_swarming=True) tempdir = tempfile.mkdtemp(prefix=u"hello_world") try: isolated, _ = common.isolate(tempdir, options.isolate_server, options.swarming_os, options.verbose) common.note( "Running the job remotely. This:\n" " - archives to %s\n" " - runs and collect results via %s" % (options.isolate_server, options.swarming) ) cmd = [ "swarming.py", "run", "--swarming", options.swarming, "--isolate-server", options.isolate_server, "--dimension", "os", options.swarming_os, "--task-name", options.task_name, "--task-summary-json", "example_result.json", "--decorate", isolated, ] if options.idempotent: cmd.append("--idempotent") if options.priority is not None: cmd.extend(("--priority", str(options.priority))) common.run(cmd, options.verbose) with open("example_result.json", "rb") as f: print("example_result.json content:") print(f.read()) return 0 except subprocess.CalledProcessError as e: return e.returncode finally: shutil.rmtree(tempdir)
def main(): options = common.parse_args(use_isolate_server=True, use_swarming=True) tempdir = tempfile.mkdtemp(prefix=u'hello_world') try: isolated, _ = common.isolate( tempdir, options.isolate_server, options.swarming_os, options.verbose) common.note( 'Running the job remotely. This:\n' ' - archives to %s\n' ' - runs and collect results via %s' % (options.isolate_server, options.swarming)) cmd = [ 'swarming.py', 'run', '--swarming', options.swarming, '--isolate-server', options.isolate_server, '--dimension', 'os', options.swarming_os, '--dimension', 'pool', 'default', '--task-name', options.task_name, '--task-summary-json', 'example_result.json', '--decorate', isolated, ] if options.idempotent: cmd.append('--idempotent') if options.priority is not None: cmd.extend(('--priority', str(options.priority))) common.run(cmd, options.verbose) with open('example_result.json', 'rb') as f: print('example_result.json content:') print(f.read()) return 0 except subprocess.CalledProcessError as e: return e.returncode finally: shutil.rmtree(tempdir)