Jump to content
  • Announcements

    • admin

      PBS Forum Has Closed   06/12/17

      The PBS Works Support Forum is no longer active.  For PBS community-oriented questions and support, please join the discussion at http://community.pbspro.org.  Any new security advisories related to commercially-licensed products will be posted in the PBS User Area (https://secure.altair.com/UserArea/). 
Sign in to follow this  
Scott Suchyta

Enforce a cputime limit for interactive login sessions only

Recommended Posts

The reason is that I would like to restrict the usage of login cpuset by interactive non-pbs user jobs.

Given that I change in /etc/security/limits.conf the cputime limit to a value different to unlimited, say 600s, what cputime limit applies for job spawned by pbs_mom?

My understanding is that /etc/security/limits.conf applies to login sessions only due to PAM (See /etc/pam.d/common-session!). So, job spawned by pbs_mom are not seeing those limits in /etc/security/limits.conf.

I confirmed the same behavior

scott@sles11-00:~> ulimit -a | grep "cpu time"

cpu time (seconds, -t) 300

scott@sles11-00:~> qsub -I

qsub: waiting for job 107.sles11-00 to start

qsub: job 107.sles11-00 ready

scott@sles11-00:~> ulimit -a | grep "cpu time"

cpu time (seconds, -t) unlimited

However, if you submit the job with -lcput= you will see it updated in the limits

scott@sles11-00:~> qsub -I -lcput=5:00

qsub: waiting for job 108.sles11-00 to start

qsub: job 108.sles11-00 ready

scott@sles11-00:~> ulimit -a | grep "cpu time"

cpu time (seconds, -t) 300

Referring to PBS Pro Admin Guide (v11.0) Table 5-12 and 5-13, you will see that -lcput | pcput will set the RLIMIT_CPU via setrlimit().

As a suggestion for Interactive jobs only, you might want to explore a qsub hook, which will check for interactive attribute and request the cput attribute for the user. Here is a quick and dirty, where if job is interactive, then set 300s for cput.

import pbs

try:

je = pbs.event()

j = je.job

if j.interactive:

j.Resource_List["cput"] = 300

except SystemExit:

pass

Scott

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×