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

Module condor_common

source code


Common function which provide information about the Condor batch system.

This module interacts with condor through the following commands:
   * condor_q
   * condor_status

It takes advantage of the XML format of the ClassAds in order to make parsing
easier.

Classes [hide private]
  ClassAdParser
Streaming SAX handler for the output of condor_* -xml calls; it's around 60 times faster and has a similar reduction in required memory.
Functions [hide private]
 
parseCondorXml(fp, handler)
Parse XML from Condor.
source code
 
condorCommand(command, cp, info=None)
Execute a command in the shell.
source code
string
getLrmsInfo(cp)
Get information from the LRMS (batch system).
source code
 
getGroupInfo(vo_map, cp)
Get the group info from condor
source code
 
getQueueList(cp)
Returns a list of all the queue names that are supported.
source code
 
guessVO(cp, group)
From the group name, guess my VO name
source code
 
_getJobsInfoInternal(cp)
The "alternate" way of building the jobs info; this allows for sites to filter jobs based upon an arbitrary condor_q constraint.
source code
 
getJobsInfo(vo_map, cp)
Retrieve information about the jobs in the Condor system.
source code
 
parseNodes(cp)
Parse the condor nodes.
source code
Variables [hide private]
  condor_version = 'condor_version'
  condor_group = 'condor_config_val GROUP_NAMES'
  condor_quota = 'condor_config_val GROUP_QUOTA_%(group)s'
  condor_prio = 'condor_config_val GROUP_PRIO_FACTOR_%(group)s'
  condor_status = 'condor_status -xml -constraint \'%(constraint...
  condor_status_submitter = 'condor_status -submitter -xml'
  condor_job_status = 'condor_q -xml -constraint \'%(constraint)...
  log = getLogger("GIP.Condor")
  _results_cache = {}
  _nodes_cache = []
Function Details [hide private]

parseCondorXml(fp, handler)

source code 

Parse XML from Condor.

Create a SAX parser with the content handler handler, then parse the contents of fp with it.

Parameters:
  • fp - A file-like object of the Condor XML data
  • handler (xml.sax.handler.ContentHandler) - An object which will be our content handler.
Returns:
None

condorCommand(command, cp, info=None)

source code 

Execute a command in the shell. Returns a file-like object containing the stdout of the command

Use this function instead of executing directly (os.popen); this will allow you to hook your providers into the testing framework.

Parameters:
  • command - The command to execute
  • cp - The GIP configuration object
  • info - A dictionary-like object for Python string substitution
Returns:
a file-like object.

getLrmsInfo(cp)

source code 

Get information from the LRMS (batch system).

Returns the version of the condor client on your system.

Returns: string
The condor version

getGroupInfo(vo_map, cp)

source code 

Get the group info from condor

The return value is a dictionary; the key is the vo name, the values are another dictionary of the form {'quota': integer, 'prio': integer}

Parameters:
  • vo_map - VoMapper object
  • cp - A ConfigParse object with the GIP config information
Returns:
A dictionary whose keys are VO groups and values are the quota and priority of the group.

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.

_getJobsInfoInternal(cp)

source code 

The "alternate" way of building the jobs info; this allows for sites to filter jobs based upon an arbitrary condor_q constraint.

This is not the default as large sites can have particularly bad performance for condor_q.

getJobsInfo(vo_map, cp)

source code 

Retrieve information about the jobs in the Condor system.

Query condor about the submitter status. The returned job information is a dictionary whose keys are the VO name of the submitting user and values the aggregate information about that VO's activities. The information is another dictionary showing the running, idle, held, and max_running jobs for that VO.

Parameters:
  • vo_map - A vo_map object mapping users to VOs
  • cp - A ConfigParser object with the GIP config information.
Returns:
A dictionary containing job information.

parseNodes(cp)

source code 

Parse the condor nodes.

Parameters:
  • cp - ConfigParser object for the GIP
Returns:
A tuple consisting of the total, claimed, and unclaimed nodes.

Variables Details [hide private]

condor_status

Value:
'condor_status -xml -constraint \'%(constraint)s\''

condor_job_status

Value:
'condor_q -xml -constraint \'%(constraint)s\''