| 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 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 properties['inputs_ref']['isolated'], | 1403 properties['inputs_ref']['isolated'], |
| 1404 storage, | 1404 storage, |
| 1405 isolateserver.MemoryCache(file_mode_mask=0700), | 1405 isolateserver.MemoryCache(file_mode_mask=0700), |
| 1406 workdir) | 1406 workdir) |
| 1407 command = bundle.command | 1407 command = bundle.command |
| 1408 if bundle.relative_cwd: | 1408 if bundle.relative_cwd: |
| 1409 workdir = os.path.join(workdir, bundle.relative_cwd) | 1409 workdir = os.path.join(workdir, bundle.relative_cwd) |
| 1410 command.extend(properties.get('extra_args') or []) | 1410 command.extend(properties.get('extra_args') or []) |
| 1411 # https://github.com/luci/luci-py/blob/master/appengine/swarming/doc/Magic-V
alues.md | 1411 # https://github.com/luci/luci-py/blob/master/appengine/swarming/doc/Magic-V
alues.md |
| 1412 new_command = run_isolated.process_command( | 1412 new_command = run_isolated.process_command( |
| 1413 command, options.output_dir, None, None) | 1413 command, options.output_dir, None) |
| 1414 if not options.output_dir and new_command != command: | 1414 if not options.output_dir and new_command != command: |
| 1415 parser.error('The task has outputs, you must use --output-dir') | 1415 parser.error('The task has outputs, you must use --output-dir') |
| 1416 command = new_command | 1416 command = new_command |
| 1417 else: | 1417 else: |
| 1418 command = properties['command'] | 1418 command = properties['command'] |
| 1419 try: | 1419 try: |
| 1420 return subprocess.call(command + extra_args, env=env, cwd=workdir) | 1420 return subprocess.call(command + extra_args, env=env, cwd=workdir) |
| 1421 except OSError as e: | 1421 except OSError as e: |
| 1422 print >> sys.stderr, 'Failed to run: %s' % ' '.join(command) | 1422 print >> sys.stderr, 'Failed to run: %s' % ' '.join(command) |
| 1423 print >> sys.stderr, str(e) | 1423 print >> sys.stderr, str(e) |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 dispatcher = subcommand.CommandDispatcher(__name__) | 1542 dispatcher = subcommand.CommandDispatcher(__name__) |
| 1543 return dispatcher.execute(OptionParserSwarming(version=__version__), args) | 1543 return dispatcher.execute(OptionParserSwarming(version=__version__), args) |
| 1544 | 1544 |
| 1545 | 1545 |
| 1546 if __name__ == '__main__': | 1546 if __name__ == '__main__': |
| 1547 subprocess42.inhibit_os_error_reporting() | 1547 subprocess42.inhibit_os_error_reporting() |
| 1548 fix_encoding.fix_encoding() | 1548 fix_encoding.fix_encoding() |
| 1549 tools.disable_buffering() | 1549 tools.disable_buffering() |
| 1550 colorama.init() | 1550 colorama.init() |
| 1551 sys.exit(main(sys.argv[1:])) | 1551 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |