Skip to content

Commit

Permalink
flux-wreck: Add support for updating sched parameters at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
tpatki committed Jul 16, 2018
1 parent ce56834 commit b2db6e6
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/cmd/flux-wreck
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,53 @@ prog:SubCommand {
end
}

prog:SubCommand {
name = "sched-params",
description = "Set/Get scheduler parameters at runtime.",
usage = "get or set ITEM=VAL",

handler = function (self, arg)
local action = arg[1]
if action == "set" then
local params = arg[2]
if not params then
self:die ("No arguments specified for setting scheduler parameters.")
end

local resp, err = f:rpc ("sched.params.set", { param = tostring(params) })
if not resp then
if err == "Function not implemented" then
prog:die ("Scheduler parameters cannot be updated when scheduler is not loaded")
else
prog:die ("Unable to set scheduler parameters. %s\n", err)
end
end
else -- Else corresponding to the 'get' action, return all current values
local params = arg[2]
local resp, err = f:rpc ("sched.params.get", { })
if not resp then
if err == "Function not implemented" then
prog:die ("Scheduler parameters cannot be queried when scheduler is not loaded")
else
prog:die ("Unable to obtain scheduler parameters. %s\n", err)
end
end

for k,v in pairs(resp) do
if not params then
print(k.."="..v)
elseif string.find(params,k,1,true) then -- We have strings with '-', so search for plain strings
print(k.."="..v)
end
end
end
end
}

-- Check for valid connection to flux:
if not f then prog:die ("Connecting to flux failed: %s\n", err) end

-- Process cmdline, run any subcommand, or exit with failure:
prog:run (arg)
-- vi: ts=4 sw=4 expandtab

0 comments on commit b2db6e6

Please sign in to comment.