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

Unified Diff: Tools/Scripts/webkitpy/common/system/executive.py

Issue 546613003: Add a new 'format-webkitpy' command that will reformat code to the style guide. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ready for review Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: Tools/Scripts/webkitpy/common/system/executive.py
diff --git a/Tools/Scripts/webkitpy/common/system/executive.py b/Tools/Scripts/webkitpy/common/system/executive.py
index 4f2223efa9e2da4d00d5167c77a3fc7c0a328163..f52db0a1a4b25b76dc512d4861f0adb0c6722af9 100644
--- a/Tools/Scripts/webkitpy/common/system/executive.py
+++ b/Tools/Scripts/webkitpy/common/system/executive.py
@@ -471,14 +471,17 @@ class Executive(object):
def run_in_parallel(self, command_lines_and_cwds, processes=None):
"""Runs a list of (cmd_line list, cwd string) tuples in parallel and returns a list of (retcode, stdout, stderr) tuples."""
assert len(command_lines_and_cwds)
+ return self.map(_run_command_thunk, command_lines_and_cwds, processes)
- if sys.platform in ('cygwin', 'win32'):
- return map(_run_command_thunk, command_lines_and_cwds)
- pool = multiprocessing.Pool(processes=processes)
- results = pool.map(_run_command_thunk, command_lines_and_cwds)
- pool.close()
- pool.join()
- return results
+ def map(self, thunk, arglist, processes=None):
+ if sys.platform in ('cygwin', 'win32') or len(arglist) == 1:
+ return map(thunk, arglist)
+ pool = multiprocessing.Pool(processes=(processes or multiprocessing.cpu_count()))
+ try:
+ return pool.map(thunk, arglist)
eseidel 2014/09/09 23:10:55 This may be incompatible with keyboard interrupts:
Dirk Pranke 2014/09/09 23:32:22 Could be. I can switch this to a fancier pool if n
+ finally:
+ pool.close()
+ pool.join()
def _run_command_thunk(cmd_line_and_cwd):

Powered by Google App Engine
This is Rietveld 408576698