Making Rust respect worker count in config

Raphaël Gomès raphael.gomes at octobus.net
Thu Nov 7 11:44:16 EST 2019


I've tried appending the logic to config.read, but it seems that some of 
the parsing utils for config elements, like "I want to get a boolean" 
are in "ui". How would you recommend going about it?

Here's my naive approach:

numcpus= self.get("worker","numcpus")
if numcpusis not None: os.environ.setdefault('RAYON_NUM_THREADS', numcpus)

workers_enabled= self.get("worker","enabled",True)
if not workers_enabled: os.environ.setdefault('RAYON_NUM_THREADS', pycompat.sysstr("1"))

On 11/7/19 5:08 PM, Martin von Zweigbergk via Mercurial-devel wrote:
> Seems fine to do that every time we read configs in Python. It won't 
> always be correct if there are multiple values for it in different 
> config files (e.g. repo-specific vs user's config). Probably good enough.
>
> On Thu, Nov 7, 2019, 07:54 Raphaël Gomès <raphael.gomes at octobus.net 
> <mailto:raphael.gomes at octobus.net>> wrote:
>
>     I'd like to make Rust respect to max worker count in config, since it
>     now runs parallel code. Right now, it uses every CPU available, be it
>     logical or physical.
>
>     I think the simplest way to do so, since Rust does not yet know
>     how to
>     read the config file, is to set the RAYON_NUM_THREADS environment
>     variable in the Python layer as soon as possible.
>
>     I'm unsure where to do it though and what the implications are
>     cross-platform. Maybe as soon as the config is loaded?
>
>     Thanks,
>
>     Raphaël
>
>     _______________________________________________
>     Mercurial-devel mailing list
>     Mercurial-devel at mercurial-scm.org
>     <mailto:Mercurial-devel at mercurial-scm.org>
>     https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20191107/aa44b1ad/attachment.html>


More information about the Mercurial-devel mailing list