Page MenuHomePhabricator

workers: add config to enable/diable workers
ClosedPublic

Authored by wlis on Nov 20 2017, 1:37 PM.

Details

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 <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

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

wlis created this revision.Nov 20 2017, 1:37 PM
wlis retitled this revision from workers: add config to enable/diable workers to workers: add config to enable/disable workers.Nov 20 2017, 1:44 PM
lothiraldan requested changes to this revision.Nov 22 2017, 3:28 AM
lothiraldan added a subscriber: lothiraldan.

Looks good.

We are in the process of registering all the config options in the file named configitems.py (https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/configitems.py#l1132), could you update the file with the new option worker.enabled. By registering the option, we will be able to centralize default values (so you can even remove the default value in the configbol call) and do nice things like validating the user configuration or easily register aliases.

This revision now requires changes to proceed.Nov 22 2017, 3:28 AM
wlis retitled this revision from workers: add config to enable/disable workers to workers: add config to enable/diable workers.Nov 30 2017, 7:02 PM
wlis updated this revision to Diff 4023.
ikostia accepted this revision.Dec 1 2017, 11:12 AM
durin42 accepted this revision.Dec 5 2017, 5:27 PM
This revision was automatically updated to reflect the committed changes.
indygreg added inline comments.
mercurial/worker.py
85

I updated this line to drop the default value argument, which is not needed when the config item defines a default.

The test harness passed with the original code. The developer warning is emitted at run time. So this tells me that we have 0 test coverage of this workers code :/