Skip to content

Commit

Permalink
lib.ptree: add acquire_cpu worker option
Browse files Browse the repository at this point in the history
defaults to true
  • Loading branch information
eugeneia committed Sep 2, 2022
1 parent 680a28b commit b26d015
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/ptree/ptree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ local manager_config_spec = {
}

local worker_opt_spec = {
acquire_cpu = {default=true}, -- Needs dedicated CPU core?
restart_intensity = {default=0}, -- How many restarts are permitted...
restart_period = {default=0} -- ...within period seconds.
}
Expand Down Expand Up @@ -303,6 +304,7 @@ function Manager:compute_workers_aux (worker_app_graphs, worker_opts)
for id in pairs(worker_app_graphs) do
local worker_opt = lib.parse(worker_opts[id] or {}, worker_opt_spec)
local worker_aux = {
acquire_cpu = worker_opt.acquire_cpu,
restart = {
period = worker_opt.restart_period,
intensity = worker_opt.restart_intensity,
Expand Down Expand Up @@ -373,7 +375,9 @@ end
function Manager:compute_scheduling_for_worker(id, app_graph)
local ret = {}
for k, v in pairs(self.worker_default_scheduling) do ret[k] = v end
ret.cpu = self:acquire_cpu_for_worker(id, app_graph)
if self.workers_aux[id].acquire_cpu then
ret.cpu = self:acquire_cpu_for_worker(id, app_graph)
end
return ret
end

Expand Down

0 comments on commit b26d015

Please sign in to comment.