| Trees | Indices | Help |
|---|
|
|
Common functions for GIP providers and plugins.
A set of general-purpose functions to help GIP plugin/provider authors write probes which are consistent and correct.
This module should generally follow PEP 8 coding guidelines.
Author: Brian Bockelman
|
|||
|
VoMapper This class maps a username to VO. |
|||
|
FakeLogger Super simple logger for python installs which don't have the logging package. |
|||
|
_Constants A convenience class for important constants. |
|||
|
Attributes Given a filename containing attributes, parse it into a dictionary. |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
py23 = TrueTrue if the current version of Python is 2.3 or higher; enables a few extra capabilities which Python 2.2 does not have. |
|||
loglevel =
|
|||
info_map =
|
|||
log = getLogger("GIP.common")
|
|||
rvf_parse = re.compile(r'
|
|||
|
|||
This function checks to make sure that GIP_LOCATION is set and exists. If GIP_LOCATION is not set and $VDT_LOCATION/gip exists, then it adds: GIP_LOCATION=$VDT_LOCATION/gip to the process's environment It raises ValueErrors if neither situation holds. This function is automatically run by the *config* function, so it is generally not necessary for provider authors to use this directly. |
Check to see if the GIP_TESTING environment variable has been set. If so, set the gip_testing.replace_command variable to be true. This causes the GIP to read output from static files instead of running the command. This is useful if you want to test, say, PBS on a laptop with no PBS installed. |
Parse the passed command line options. Does not expect the first element of argv; if you pass this directly, use parseOpts(sys.argv[1:]). There are three objects returned:
|
Load up the config file. It's taken from the command line, option -c or --config; default is $GIP_LOCATION/etc/gip.conf If python 2.3 is not available, the command line option is not checked. If any arguments are supplied to this function, they will be interpreted as filenames for additional config files to read. If the filename considers environmental variables, they will be expanded. |
Currently, all of the configuration information is kept in: $VDT_LOCATION/monitoring/osg-attributes.conf This function will take in the ConfigParser object `cp` and update it with the configurations found from the OSG monitoring. If gip.override=True, then the config object overrides the OSG settings. If not, then the OSG settings override. If VDT_LOCATION is not defined, this function does nothing. |
Load up configuration options from osg-attributes.conf into the passed config object; translate between the two formats.
|
Load up configuration options from gip-attributes.conf into the passed config object; translate between the two formats.
|
Add a log file to the default root logger. Uses a rotating logfile of 10MB, with 5 backups. |
Returns a logger object corresponding to `name`.
|
Return a template from a file.
|
Print out the LDIF contained in template using the values from the dictionary `info`. The different entries of the template are matched up to keys in the `info` dictionary; the entries' values are the dictionary values. To see what keys `info` needs for your template, read the template as found in: $GIP_LOCATION/templates
|
Return the list of valid VOs for this install. This data is taken from the vo mapper and the blacklist / whitelist in the "vo" section of the config parser `cp` is applied.
|
Return the contents of the file on a given path
|
Append some contents to a given path
|
Overwrite a file with a contents. If file doesn't exist, create and write as usual.
|
Helper function for ConfigParser objects which allows setting the default. ConfigParser objects throw an exception if one tries to access an option which does not exist; this catches the exception and returns the default value instead.
|
Helper function for ConfigParser objects which allows setting the default. If the cp object has a section/option of the proper name, and if that value has a 'y' or 't', we assume it's supposed to be true. Otherwise, if it contains a 'n' or 'f', we assume it's supposed to be true. If neither applies - or the option doesn't exist, return the default
|
Helper function for ConfigParser objects which allows setting the default. Returns an integer, or the default if it can't make one.
|
Convience function to format a path.
|
Return fqan in the form of /<VO>[/<VO group>/]Role=<VO Role> If VO group is not specified, return /<VO>/Role=<VO Role> If the VO Role is not specified, return /VO/Role=* |
Return True if fqan1 matches with fqan2, False otherwise fqan1 may actually be more specific than fqan2. So, if fqan1 is /cms/blah and fqan2 is /cms, then there is a match. If the Role=* for fqan2, the value of the Role for fqan1 is ignored. FQANs may be of the form:
|
Parse the Globus RVF for a specific file. Retrieves the file from $GLOBUS_LOCATION/share/globus_gram_job_manager/name See an example RVF file for the patterns this matches. Returns a dictionary of dictionaries; the keys are attributes, and the values are a dictionary of key: value pairs for all the associated information for an attribute. In the case of an exception, this just returns {}
|
Return the data from a URL.
|
Returns a function which can be used to compare two dictionaries.
|
Computes the estimated and worst-case response times based on a simple formula. We take the ERT = average_job_time/(running+1)*waiting WRT = max_job_time/(running+1)*waiting If |running| + |waiting| < 10, then ERT=1hr, WRT=24hr unless |running|=0. If |running|=0 or |waiting|=0, then ERT=1 min. ERT and WRT must be positive; ERT maxes out at 1 day, WRT maxes out at 30 days. WRT must be a minimum of 2*ERT. @param cp: Site configuration @param running: Number of jobs running @param waiting: Number of waiting jobs @keyword average_job_time: Average runtime (in seconds) for a job @keyword max_job_time: Maximum runtime (in seconds for a job @return: ERT, WRT (both are measured in seconds) |
|
|||
info_map
|
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Wed Jan 7 13:01:11 2009 | http://epydoc.sourceforge.net |