| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The LUCI Authors. All rights reserved. | 2 # Copyright 2013 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """Client tool to trigger tasks or retrieve results from a Swarming server.""" | 6 """Client tool to trigger tasks or retrieve results from a Swarming server.""" |
| 7 | 7 |
| 8 __version__ = '0.8.5' | 8 __version__ = '0.8.5' |
| 9 | 9 |
| 10 import collections | 10 import collections |
| (...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1388 bundle = isolateserver.fetch_isolated( | 1388 bundle = isolateserver.fetch_isolated( |
| 1389 properties['inputs_ref']['isolated'], | 1389 properties['inputs_ref']['isolated'], |
| 1390 storage, | 1390 storage, |
| 1391 isolateserver.MemoryCache(file_mode_mask=0700), | 1391 isolateserver.MemoryCache(file_mode_mask=0700), |
| 1392 workdir) | 1392 workdir) |
| 1393 command = bundle.command | 1393 command = bundle.command |
| 1394 if bundle.relative_cwd: | 1394 if bundle.relative_cwd: |
| 1395 workdir = os.path.join(workdir, bundle.relative_cwd) | 1395 workdir = os.path.join(workdir, bundle.relative_cwd) |
| 1396 command.extend(properties.get('extra_args') or []) | 1396 command.extend(properties.get('extra_args') or []) |
| 1397 # https://github.com/luci/luci-py/blob/master/appengine/swarming/doc/Magic-V
alues.md | 1397 # https://github.com/luci/luci-py/blob/master/appengine/swarming/doc/Magic-V
alues.md |
| 1398 new_command = run_isolated.process_command(command, options.output_dir) | 1398 new_command = run_isolated.process_command( |
| 1399 command, options.output_dir, None) |
| 1399 if not options.output_dir and new_command != command: | 1400 if not options.output_dir and new_command != command: |
| 1400 parser.error('The task has outputs, you must use --output-dir') | 1401 parser.error('The task has outputs, you must use --output-dir') |
| 1401 command = new_command | 1402 command = new_command |
| 1402 else: | 1403 else: |
| 1403 command = properties['command'] | 1404 command = properties['command'] |
| 1404 try: | 1405 try: |
| 1405 return subprocess.call(command + extra_args, env=env, cwd=workdir) | 1406 return subprocess.call(command + extra_args, env=env, cwd=workdir) |
| 1406 except OSError as e: | 1407 except OSError as e: |
| 1407 print >> sys.stderr, 'Failed to run: %s' % ' '.join(command) | 1408 print >> sys.stderr, 'Failed to run: %s' % ' '.join(command) |
| 1408 print >> sys.stderr, str(e) | 1409 print >> sys.stderr, str(e) |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 dispatcher = subcommand.CommandDispatcher(__name__) | 1528 dispatcher = subcommand.CommandDispatcher(__name__) |
| 1528 return dispatcher.execute(OptionParserSwarming(version=__version__), args) | 1529 return dispatcher.execute(OptionParserSwarming(version=__version__), args) |
| 1529 | 1530 |
| 1530 | 1531 |
| 1531 if __name__ == '__main__': | 1532 if __name__ == '__main__': |
| 1532 subprocess42.inhibit_os_error_reporting() | 1533 subprocess42.inhibit_os_error_reporting() |
| 1533 fix_encoding.fix_encoding() | 1534 fix_encoding.fix_encoding() |
| 1534 tools.disable_buffering() | 1535 tools.disable_buffering() |
| 1535 colorama.init() | 1536 colorama.init() |
| 1536 sys.exit(main(sys.argv[1:])) | 1537 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |