Commit 74770e41 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

slaprunner: add configurable cpu-ratio parameter

parent f94234c1
...@@ -43,7 +43,7 @@ mode = 0644 ...@@ -43,7 +43,7 @@ mode = 0644
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-runner.cfg url = ${:_profile_base_location_}/instance-runner.cfg
output = ${buildout:directory}/template-runner.cfg.in output = ${buildout:directory}/template-runner.cfg.in
md5sum = 403074d7563ff122fa9a5b29ec4ba8a8 md5sum = c2c25d668816ab3c32a79c33d05769fd
mode = 0644 mode = 0644
[template-runner-import-script] [template-runner-import-script]
...@@ -145,7 +145,7 @@ mode = 0644 ...@@ -145,7 +145,7 @@ mode = 0644
[template-supervisord] [template-supervisord]
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/${:filename} url = ${:_profile_base_location_}/template/${:filename}
md5sum = af2d78440a358ec268d7ece4fce99ec9 md5sum = 239fe88e1522afe7686572dd34568720
location = ${buildout:parts-directory}/${:_buildout_section_name_} location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = supervisord.conf.in filename = supervisord.conf.in
download-only = true download-only = true
......
...@@ -672,7 +672,10 @@ recipe = slapos.recipe.template:jinja2 ...@@ -672,7 +672,10 @@ recipe = slapos.recipe.template:jinja2
template = ${template-supervisord:location}/${template-supervisord:filename} template = ${template-supervisord:location}/${template-supervisord:filename}
rendered = $${directory:etc}/supervisord.conf rendered = $${directory:etc}/supervisord.conf
context = context =
import multiprocessing multiprocessing
import builtin __builtin__
section supervisord supervisord section supervisord supervisord
key slapparameter_dict slap-configuration:configuration
key listener_slapgrid listener-slapgrid-bin:rendered key listener_slapgrid listener-slapgrid-bin:rendered
[listener-slapgrid-bin] [listener-slapgrid-bin]
......
...@@ -91,6 +91,11 @@ ...@@ -91,6 +91,11 @@
"minimum": 9683, "minimum": 9683,
"exclusiveMinimum": true, "exclusiveMinimum": true,
}, },
"cpu-usage-ratio": {
"description": "Ratio of the CPU use for compilation, if value is set to n, compilation will use number-of-cpu/n of cpus (need instance restart)",
"type": "integer",
"default" : 4
},
"resilient-clone-number": { "resilient-clone-number": {
"title": "Number of Resilient Clones", "title": "Number of Resilient Clones",
"description": "Number of clones to be deployed when a resilient runner, if missing a single clone is provided. Its value can be 1 or 2", "description": "Number of clones to be deployed when a resilient runner, if missing a single clone is provided. Its value can be 1 or 2",
......
...@@ -26,7 +26,7 @@ autorestart = {{ supervisord['autorestart'] }} ...@@ -26,7 +26,7 @@ autorestart = {{ supervisord['autorestart'] }}
stdout_logfile = {{ supervisord['no_logfile'] }} stdout_logfile = {{ supervisord['no_logfile'] }}
stderr_logfile = {{ supervisord['no_logfile'] }} stderr_logfile = {{ supervisord['no_logfile'] }}
directory = {{ supervisord['directory'] }} directory = {{ supervisord['directory'] }}
environment = PATH="{{- supervisord['path'] -}}" environment = PATH="{{- supervisord['path'] -}}",MAKEFLAGS="-j{{- '%d' % builtin.max(1, (multiprocessing.cpu_count() / builtin.int(slapparameter_dict.get('cpu-usage-ration', 4)))) -}}"
[program:{{- supervisord['slapgrid-cp'] -}}] [program:{{- supervisord['slapgrid-cp'] -}}]
command = {{ supervisord['slapgrid-cp-command'] }} command = {{ supervisord['slapgrid-cp-command'] }}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment