Module pbs_common
[hide private]
[frames] | no frames]

Module pbs_common

source code

Module for interacting with PBS.

Functions [hide private]
 
pbsOutputFilter(fp)
PBS can be a pain to work with because it automatically cuts lines off at 80 chars and continues the line on the next line.
source code
 
pbsCommand(command, cp)
Run a command against the PBS batch system.
source code
 
getLrmsInfo(cp)
Return the version string from the PBS batch system.
source code
 
getJobsInfo(vo_map, cp)
Return information about the jobs currently running in PBS
source code
 
getQueueInfo(cp)
Looks up the queue information from PBS.
source code
 
parseNodes(cp, version)
Parse the node information from PBS.
source code
 
getQueueList(cp)
Returns a list of all the queue names that are supported.
source code
 
getVoQueues(cp)
Determine the (vo, queue) tuples for this site.
source code
 
parseAclInfo(queue, qinfo, vo_mapper)
Take a queue information dictionary and determine which VOs are in the ACL list.
source code
Variables [hide private]
  log = getLogger("GIP.PBS")
  batch_system_info_cmd = 'qstat -B -f %(pbsHost)s'
  queue_info_cmd = 'qstat -Q -f %(pbsHost)s'
  jobs_cmd = 'qstat'
  pbsnodes_cmd = 'pbsnodes -a'
Function Details [hide private]

pbsOutputFilter(fp)

source code 

PBS can be a pain to work with because it automatically cuts lines off at 80 chars and continues the line on the next line. For example:

   Server: red
   server_state = Active
   server_host = red.unl.edu
   scheduling = True
   total_jobs = 2996
   state_count = Transit:0 Queued:2568 Held:0 Waiting:0 Running:428 Exiting 
    :0 Begun:0 
   acl_roots = t3
   managers = mfurukaw@red.unl.edu,root@t3

This function puts the line ":0 Begun:0" with the above line. It's meant to filter the output, so you should "scrub" PBS output like this:

   fp = runCommand(<pbs command>)
   for line in pbsOutputFilter(fp):
      ... parse line ...

This function uses iterators

pbsCommand(command, cp)

source code 

Run a command against the PBS batch system.

Use this when talking to PBS; not only does it allow for integration into the GIP test framework, but it also filters and expands PBS-style line continuations.

getJobsInfo(vo_map, cp)

source code 

Return information about the jobs currently running in PBS

The return value is a dictionary of dictionaries; the keys for the top-level dictionary are queue names; the values are queuedata dictionaries

The queuedata dicts have key:val pairs of voname: voinfo, where voinfo is a dictionary with the following keys:

  • running: Number of VO running jobs in this queue.
  • wait: Number of VO waiting jobs in this queue.
  • total: Number of VO total jobs in this queue.
Parameters:
  • vo_map - A VoMapper object which is used to map user names to VOs.
  • cp - Site configuration object
Returns:
A dictionary containing queue job information.

getQueueInfo(cp)

source code 

Looks up the queue information from PBS.

The returned dictionary contains the following keys:

  • status: Production, Queueing, Draining, Closed
  • priority: The priority of the queue.
  • max_wall: Maximum wall time.
  • max_running: Maximum number of running jobs.
  • running: Number of running jobs in this queue.
  • wait: Waiting jobs in this queue.
  • total: Total number of jobs in this queue.
Parameters:
  • cp - Configuration of site.
Returns:
A dictionary of queue data. The keys are the queue names, and the value is the queue data dictionary.

parseNodes(cp, version)

source code 

Parse the node information from PBS. Using the output from pbsnodes, determine:

  • The number of total CPUs in the system.
  • The number of free CPUs in the system.
  • A dictionary mapping PBS queue names to a tuple containing the (totalCPUs, freeCPUs).

getQueueList(cp)

source code 

Returns a list of all the queue names that are supported.

Parameters:
  • cp - Site configuration
Returns:
List of strings containing the queue names.

getVoQueues(cp)

source code 

Determine the (vo, queue) tuples for this site. This allows for central configuration of which VOs are advertised.

Sites will be able to blacklist queues they don't want to advertise, whitelist certain VOs for a particular queue, and blacklist VOs from queues.

Parameters:
  • cp - Site configuration
Returns:
A list of (vo, queue) tuples representing the queues each VO is allowed to run in.

parseAclInfo(queue, qinfo, vo_mapper)

source code 

Take a queue information dictionary and determine which VOs are in the ACL list. The used keys are:

  • users: A set of all user names allowed to access this queue.
  • groups: A set of all group names allowed to access this queue.
Parameters:
  • queue - Queue name (for logging purposes).
  • qinfo - Queue info dictionary
  • vo_mapper - VO mapper object
Returns:
A set of allowed VOs