From 7c871163c8803e812998e5b2296e3bbb30b1367f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 16 Feb 2021 01:45:39 -0500 Subject: status: improve parallel execution stability The status command runs a bunch of jobs in parallel, and each one is responsible for writing to stdout directly. When running many noisy jobs in parallel, output can get intermingled. Pass down a StringIO buffer for writing to so we can return the entire output as a string so the main job can handle displaying it. This fixes interleaved output as well as making the output stable: we always display results in the same project order now. By switching from map to imap, this ends up not really adding any overhead. Bug: https://crbug.com/gerrit/12231 Change-Id: Ic18b07c8074c046ff36e306eb8d392fb34fb6eca Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/297242 Tested-by: Mike Frysinger Reviewed-by: Chris Mcdonald --- subcmds/branches.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'subcmds/branches.py') diff --git a/subcmds/branches.py b/subcmds/branches.py index 9665e85f..d5ea580c 100644 --- a/subcmds/branches.py +++ b/subcmds/branches.py @@ -16,15 +16,7 @@ import itertools import multiprocessing import sys from color import Coloring -from command import Command, DEFAULT_LOCAL_JOBS - -# Number of projects to submit to a single worker process at a time. -# This number represents a tradeoff between the overhead of IPC and finer -# grained opportunity for parallelism. This particular value was chosen by -# iterating through powers of two until the overall performance no longer -# improved. The performance of this batch size is not a function of the -# number of cores on the system. -WORKER_BATCH_SIZE = 32 +from command import Command, DEFAULT_LOCAL_JOBS, WORKER_BATCH_SIZE class BranchColoring(Coloring): -- cgit v1.2.3-54-g00ecf