slaprunner: Make njobs calculation more explicit and simple
authorKirill Smelkov <kirr@nexedi.com>
Tue, 27 Oct 2015 09:12:41 +0000 (12:12 +0300)
committerKirill Smelkov <kirr@nexedi.com>
Tue, 27 Oct 2015 10:57:23 +0000 (13:57 +0300)
commit318f4a05d0833b55910aded17a8ae8774070b742
tree73534f568e23307452a83d78842ecc9bddefe9f7
parente9a35c48d6c7d85661d3671718cd724820779b95
slaprunner: Make njobs calculation more explicit and simple

Currently we use '%d' and string formatting on max(1, ncpu / cpu-usage-ratio),
because `ncpu / cpu-usage-ratio` is float:

    In [1]: from __future__ import division

    In [2]: 8 / 4
    Out[2]: 2.0

and jinja2 uses future division by default:

    {{ 8 / 4 }}   ->   2.0

We can however make things more explicit, by explicitly using integer
division (// operator) and this way avoid the need for '%d' and string
formatting.

/cc @jerome, @cedric.leninivin
software/slaprunner/common.cfg
software/slaprunner/template/supervisord.conf.in