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

Module gip_storage

source code

Module for interacting with a dCache storage element.

Classes [hide private]
  StorageElement
This class represents a logical StorageElement.
Functions [hide private]
 
execute(p, command, bind_vars=None)
Given a Postgres connection, execute a SQL statement.
source code
psycopg2.Connection or pgdb.Connection
connect(cp)
Connect to the SRM database based upon the parameters in the passed config file.
source code
 
getDefaultSE(cp) source code
 
voListStorage(cp, section=None)
List of VOs which are allowed to access this storage element.
source code
 
getPath(cp, vo='', section='vo', classicSE=False)
Get the storage path for some VO.
source code
 
getSESpace(cp, admin=None, gb=False, total=False, section='se')
Return the amount of space available at the SE.
source code
 
getClassicSESpace(cp, gb=False, total=False)
Get the total amount of the locally available space.
source code
 
getdCacheSESpace(cp, admin=None, gb=False, total=False)
Get the total amount of space available in a dCache instance.
source code
 
seHasTape(cp)
Determine if the SE has tape information
source code
 
getSETape(cp, vo='total')
Get the amount of tape available; numbers are in kilobytes.
source code
 
getSEVersion(cp, admin=None)
Get the version info from the dCache system.
source code
 
getAccessProtocols(cp)
Stub function for providing access protocol information.
source code
Variables [hide private]
  log = getLogger("GIP.Storage")
  _defaultSE = None
  split_re = re.compile(r'\s*,?\s*')
  dCacheSpace_cache = None
Function Details [hide private]

execute(p, command, bind_vars=None)

source code 

Given a Postgres connection, execute a SQL statement.

Parameters:
  • p (psycopg2.Connection) - Postgres connection, as returned by connect
  • command - SQL statement
  • bind_vars - Bind vars for command, if any.
Returns:
All resulting rows.

connect(cp)

source code 

Connect to the SRM database based upon the parameters in the passed config file.

Parameters:
  • cp (ConfigParser) - Site configuration
Returns: psycopg2.Connection or pgdb.Connection
Connection to the SRM database.

voListStorage(cp, section=None)

source code 

List of VOs which are allowed to access this storage element.

Parameters:
  • cp (ConfigParser) - Configuration for this site

getPath(cp, vo='', section='vo', classicSE=False)

source code 

Get the storage path for some VO.

Parameters:
  • cp (ConfigParser) - Configuration for this site
  • vo - VO name (if vo='', then the default path will be given)

getSESpace(cp, admin=None, gb=False, total=False, section='se')

source code 

Return the amount of space available at the SE.

If se.dynamic_dcache=True, use dCache-based methods. Otherwise, use classic SE methods (do a df on the SE mounts).

Parameters:
  • cp - Site configuration object
  • admin - If a dCache provider, the dCache admin objects
  • gb - Set to true to retun values in GB.
  • total - Also return totals
Returns:
used, free, total if total is True; otherwise, used, free. In GB if GB=True; otherwise, in KB.

getClassicSESpace(cp, gb=False, total=False)

source code 

Get the total amount of the locally available space. By default, return the information in kilobytes.

Parameters:
  • cp (ConfigParser) - Site configuration
  • gb - If True, then return the results in GB, not KB.
  • total - If True, also return the total amount of space in the SE.
Returns:
Returns the used space, free space. If total=true, also return the total space. If gb=True, return the numbers in GB; otherwise the numbers are in kilobytes.

getdCacheSESpace(cp, admin=None, gb=False, total=False)

source code 

Get the total amount of space available in a dCache instance. By default, return the information in Kilobytes.

Parameters:
  • cp (ConfigParser) - Site configuration
  • admin - If set, reuse this admin interface instead of making a new connection.
  • gb - If True, then return the results in GB, not KB.
  • total - If True, also return the total amount of space in the SE.
Returns:
Returns the used space, free space. If total=true, also return the total space. If gb=True, return the numbers in GB; otherwise the numbers are in kilobytes.

seHasTape(cp)

source code 

Determine if the SE has tape information

Parameters:
  • cp (ConfigParser) - Site configuration
Returns:
True if there is tape info; False otherwise.

getSETape(cp, vo='total')

source code 

Get the amount of tape available; numbers are in kilobytes.

If there is no tape information available, everything is 0.

Parameters:
  • cp (ConfigParser) - Site configuration
  • vo - The VO information to consider; to get the aggregate info, use vo="total"
Returns:
The used space, free space, and total space on tape in kilobytes.

getSEVersion(cp, admin=None)

source code 

Get the version info from the dCache system.

Parameters:
  • cp (ConfigParser) - A config parser object which holds the dCache login information
  • admin - An instance of the dCacheAdmin interface. If it is None, then `cp` will be used to log in to the admin interface.
Returns:
The dCache version number; UNKNOWN if it can't be determined.

getAccessProtocols(cp)

source code 

Stub function for providing access protocol information.

Eventually, this will return a list of dictionaries. Each dictionary will have the following keys with reference to an access endpoint:

  • protocol
  • hostname
  • port

Optionally, the following keys may be included (default in parenthesis):

  • capability (file transfer)
  • maxStreams (1)
  • securityinfo (none)
  • version (UNKNOWN)
  • endpoint (<protocol>://<hostname>:<port>)

Currently, this just returns []