From patchwork Mon Nov 20 18:37:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D1460: workers: add config to enable/diable workers From: phabricator X-Patchwork-Id: 25671 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Mon, 20 Nov 2017 18:37:17 +0000 wlis created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This adds config to disable/enable workers with default being enabled. TEST PLAN enabled profile without updaing .hg/hgrc (the default should be to use workers) and ran hg sprase --enable-profile .sparse Watched in the proces explorer that hg started 12 new threads for materializing files (this is my worker.numcpus) value Added [worker] enabled = False to the .hg/hgrc and re ran the command. This time hg didn't spawn any new threads for matreializing of files REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1460 AFFECTED FILES mercurial/help/config.txt mercurial/worker.py CHANGE DETAILS To: wlis, #hg-reviewers Cc: mercurial-devel diff --git a/mercurial/worker.py b/mercurial/worker.py --- a/mercurial/worker.py +++ b/mercurial/worker.py @@ -82,7 +82,8 @@ args - arguments to split into chunks, to pass to individual workers ''' - if worthwhile(ui, costperarg, len(args)): + enabled = ui.configbool('worker', 'enabled', True) + if enabled and worthwhile(ui, costperarg, len(args)): return _platformworker(ui, func, staticargs, args) return func(*staticargs + (args,)) diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -2547,6 +2547,10 @@ directory updates in parallel on Unix-like systems, which greatly helps performance. +``enabled`` + Whether to enable workers code to be used. + (default: true) + ``numcpus`` Number of CPUs to use for parallel operations. A zero or negative value is treated as ``use the default``.