Limit Users
Limiting users is typically not the best choice, as alternative approaches may be used to enforce policies without incurring low resource utilization issues. However, in some cases, limiting users may be the best solution and this section discusses several ways in which an administrator can limit the number of jobs that a user can run.
Control the User:x Resource
vtk_resourcemap_set User:john 5
vtk_resourcemap_set User:mary unlimited
vtk_resourcemap_set User:phil 0
vtk_resourcemap_set User:hoag -max 2 -map "linux64 RAM/200"
vovsh -x ...
:
% nc cmd vovsh -x 'vtk_resourcemap_set User:tarzan 88'
Similarly, you can control the Group:* resource to limit the jobs within a FairShare group or the Priority:* resource to limit all jobs that use certain ranges of priorities. The use of these limits is highly discouraged.
# Fragment of policy.tcl file.
set config(resMapUserDefault) 30
The configuration applies to all new resources that are created after the default has been changed.
Control the Tool:* Resource
While the resources mentioned in the previous section are always used, the resource Tool:x is only used if it is defined for a given tool. The "tool for a job" is defined as the tail of the command line argument that is not a known VOV wrapper. For example, for the command vw /bin/cp aa bb, the tool is the string cp.
vtk_resourcemap_set Tool:cp -max 3
Limits in Jobclasses
If you are using a jobclass, it is easy to define limits for both the jobclass and also for the users of that jobclass. This is best shown with this complete example taken from $VOVDIR/etc/jobclass/examples/hsim.tcl:
set classDescription "A template for an hsim class"
set classEditable 1
lappend VOV_JOB_DESC(resources) License:hsim
lappend VOV_JOB_DESC(resources) Limit:q_hsim_@USER@
lappend VOV_JOB_DESC(resources) Limit:r_hsim_@GROUP@
lappend VOV_JOB_DESC(resources) CPUS/1 percent/1 RAM/20
proc initJobClass {} {
# Executed by vovresourced at startup.
# vtk_resourcemap_set License:hsim 8
# vtk_flexlm_monitor hsim License:hsim
# Revoke requested/not-used resources after 2 minutes.
vtk_jobclass_set_revocation_delay "hsim" 2m
# Warn after 2h, kill after 4h of idleness.
vtk_jobclass_set_idle_delays "hsim" 2h 4h
vtk_jobclass_set_max_reschedule "hsim" 2
TIMEVAR hsim {
Fri,Sat,Sun {
vtk_resourcemap_set_limit Limit:q_hsim_@USER@ 3
vtk_resourcemap_set_limit Limit:r_hsim_@GROUP@ 5
}
20:30-24:00,0:00-5:30 {
vtk_resourcemap_set_limit Limit:q_hsim_@USER@ 1
vtk_resourcemap_set_limit Limit:r_hsim_@GROUP@ 2
}
default {
vtk_resourcemap_set_limit Limit:q_hsim_@USER@ 1
vtk_resourcemap_set_limit Limit:r_hsim_@GROUP@ 2
}
}
}
Self Limiting
% nc run -limit 3 -f listOfJobs