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

Side by Side Diff: bin/command_wrapper.py

Issue 10358004: Write retry text to stderr so stdout is clean for real output from gsutil. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/command_wrapper/
Patch Set: Created 8 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Wrapper that does auto-retry and stats logging for command invocation. 7 """Wrapper that does auto-retry and stats logging for command invocation.
8 8
9 Various command line tools in use: gsutil, curl have spurious failure. 9 Various command line tools in use: gsutil, curl have spurious failure.
10 This wrapper will track stats to an AppEngine based service to 10 This wrapper will track stats to an AppEngine based service to
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 143
144 runtime = time.time() - tm 144 runtime = time.time() - tm
145 accept = RunWithTimeout(LOG_TIMEOUT, LogCommand, 145 accept = RunWithTimeout(LOG_TIMEOUT, LogCommand,
146 options, command_id, r, cmd, 146 options, command_id, r, cmd,
147 p.returncode, p_stdout, p_stderr, runtime) 147 p.returncode, p_stdout, p_stderr, runtime)
148 if accept: 148 if accept:
149 return p.returncode 149 return p.returncode
150 if p.returncode == 0: 150 if p.returncode == 0:
151 return 0 151 return 0
152 print 'Command %s failed with retcode %d, try %d.' % ( 152 print >> sys.stderr, 'Command %s failed with retcode %d, try %d.' % (
153 ' '.join(args), p.returncode, r + 1) 153 ' '.join(args), p.returncode, r + 1)
154 print 'Command %s failed %d retries, giving up.' % ( 154 print >> sys.stderr, 'Command %s failed %d retries, giving up.' % (
155 ' '.join(args), options.retries) 155 ' '.join(args), options.retries)
156 156
157 return p.returncode 157 return p.returncode
158 158
159 159
160 if __name__ == '__main__': 160 if __name__ == '__main__':
161 sys.exit(main(sys.argv)) 161 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698