Adding a search by nodename option.
Allow the server to early out certain failures (gsutil cat for indexing).
BUG=None
TEST=None
TBR=nsylvain
Review URL: http://codereview.chromium.org/3013052
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/command_wrapper/bin@54521 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/command_wrapper.py b/command_wrapper.py
index c4738be..8d50576 100755
--- a/command_wrapper.py
+++ b/command_wrapper.py
@@ -35,6 +35,9 @@
stdout: text of stdout
stderr: text of stderr
runtime: command runtime in seconds
+ Returns:
+ True/False indicating if the current result should be accepted without
+ further retry.
"""
uname = platform.uname()
params = urllib.urlencode({
@@ -55,8 +58,9 @@
'uname_processor': uname[5],
})
f = urllib.urlopen(options.logurl, params)
- f.read()
+ ret = f.read()
f.close()
+ return int(ret) != 0
def main(argv):
@@ -80,8 +84,10 @@
sys.stdout.write(p_stdout)
sys.stderr.write(p_stderr)
runtime = time.time() - tm
- LogCommand(options, command_id, r, cmd,
- p.returncode, p_stdout, p_stderr, runtime)
+ accept = LogCommand(options, command_id, r, cmd,
+ p.returncode, p_stdout, p_stderr, runtime)
+ if accept:
+ return p.returncode
if p.returncode == 0:
return 0
print 'Command %s failed with retcode %d, try %d.' % (