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

Unified Diff: infra/services/master_manager_launcher/__main__.py

Issue 1130063003: Convert master_manager_launcher to use multiprocessing. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master-kickoff
Patch Set: Rebase onto latest master. Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « infra/libs/process_invocation/test/multiprocess_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/services/master_manager_launcher/__main__.py
diff --git a/infra/services/master_manager_launcher/__main__.py b/infra/services/master_manager_launcher/__main__.py
index 245c3fab67b456276c782a2036d4bafe3cfc3c64..4b4ed4be13901e14d03fa6a7f7571b9fe6d6639e 100644
--- a/infra/services/master_manager_launcher/__main__.py
+++ b/infra/services/master_manager_launcher/__main__.py
@@ -16,6 +16,7 @@ import subprocess
import sys
from infra.libs import logs
+from infra.libs.process_invocation import multiprocess
from infra.libs.service_utils import daemon
from infra.services.master_lifecycle import buildbot_state
from infra.services.master_manager_launcher import desired_state_parser
@@ -44,6 +45,10 @@ def parse_args():
help='verify the desired master state JSON is valid, then exit')
parser.add_argument('--prod', action='store_true',
help='actually perform actions instead of doing a dry run')
+ parser.add_argument('--processes',
+ default=16, type=int,
+ help='maximum number of master_manager processes to run simultaneously '
+ '(default %(default)d)')
logs.add_argparse_options(parser)
args = parser.parse_args()
@@ -113,9 +118,7 @@ def main():
if args.command_timeout:
commands = [daemon.add_timeout(c, args.command_timeout) for c in commands]
- for command in commands:
- logging.info('running %s' % command)
- subprocess.call(command)
+ multiprocess.safe_map(subprocess.call, commands, args.processes)
if __name__ == '__main__':
« no previous file with comments | « infra/libs/process_invocation/test/multiprocess_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698