Package Ganga :: Package GPIDev :: Package Persistency
[hide private]
[frames] | no frames]

Package Persistency

source code

Initialisation file for the Persistency package, containing functions for exporting and loading Ganga objects


Version: 1.0

Date: 21 October 2005

Author: K.Harrison <Harrison@hep.phy.cam.ac.uk>

Functions [hide private]
 
export(item=None, filename='', mode='w')
Function to export Ganga objects to a file
source code
 
fullpath(filename='')
Function to determine the full path corresponding to a given filename, expanding environment variables and tilda as necessary
source code
 
load(filename='', returnList=True)
Function to load previously exported Ganga objects
source code
Variables [hide private]
  logger = Ganga.Utility.logging.getLogger()
  __package__ = 'Ganga.GPIDev.Persistency'
Function Details [hide private]

export(item=None, filename='', mode='w')

source code 
Function to export Ganga objects to a file

Arguments:
   item       - Ganga object(s) [default None] to be exported
                => item may be any of following:
                   a single Ganga object;
                   a list or tuple of Ganga objects;
                   a repository object (jobs or templates)
   filename   - String [default ''] giving relative or absolute path
                to file where object definitions are to be exported
   mode       - String [default 'w'] giving mode in which file
                specified by 'filename' is to be accessed:
                   'w' : write to new file
                   'a' : append to existing file

Ganga objects saved to a file with the 'export' command can
be loaded with the 'load' command

Return value: True if Ganga object(s) successfully written to file,
              or False otherwise

fullpath(filename='')

source code 
Function to determine the full path corresponding to a given filename,
expanding environment variables and tilda as necessary

Argument:
   filename - String [default ''] giving the name of a file

Return value: String giving absolute path to file

load(filename='', returnList=True)

source code 
Function to load previously exported Ganga objects

Arguments:
   filename   - String [default ''] giving path to a file containing
                definitions of Ganga objects, such as produced with 
                the 'export' function
                => The path can be absolute, relative, or relative
                   to a directory in the search path LOAD_SCRIPTS,
                   defined in [Configuration] section of
                   Ganga configuration
   returnList - Switch [default True] defining the return type:
                => True  : List of loaded objects is returned
                => False : None returned - job and template objects
                           stored in job repository

Return value: List of Ganga objects or None, as determined by value
              of argument returnList