예제 #1
0
    def __init__(self, name, display_prefix):
        """
        Constructor for a Registry Slice object
        Args:
            name (str): Slightly descriptive name of the slice
            display_prefix (str): Prefix for slice to help modify display and other string reps of the object
        """
        super(RegistrySlice, self).__init__()
        self.objects = oDict()
        self.name = name
        self._display_prefix = display_prefix
        self._display_columns = config[self._display_prefix + '_columns']
        self._display_columns_show_empty = config[self._display_prefix + "_columns_show_empty"]
        self._display_columns_width = config[self._display_prefix + "_columns_width"]
        self._display_columns_functions = {}
        try:
            col_funcs = config[self._display_prefix + '_columns_functions']
            for this_col_func in col_funcs:
                self._display_columns_functions[this_col_func] = eval(col_funcs[this_col_func])
        except Exception as x:
            logger.error("Error on evaluating display column functions from config file: %s: %s" % (getName(x), x))

        from Ganga.Utility.ColourText import Effects
        self._colour_normal = Effects().normal
        self._proxyClass = None
예제 #2
0
    def __init__(self, name, display_prefix):
        """
        Constructor for a Registry Slice object
        Args:
            name (str): Slightly descriptive name of the slice
            display_prefix (str): Prefix for slice to help modify display and other string reps of the object
        """
        super(RegistrySlice, self).__init__()
        self.objects = oDict()
        self.name = name
        self._display_prefix = display_prefix
        self._display_columns = config[self._display_prefix + '_columns']
        self._display_columns_show_empty = config[self._display_prefix +
                                                  "_columns_show_empty"]
        self._display_columns_width = config[self._display_prefix +
                                             "_columns_width"]
        self._display_columns_functions = {}
        try:
            col_funcs = config[self._display_prefix + '_columns_functions']
            for this_col_func in col_funcs:
                self._display_columns_functions[this_col_func] = eval(
                    col_funcs[this_col_func])
        except Exception as x:
            logger.error(
                "Error on evaluating display column functions from config file: %s: %s"
                % (getName(x), x))

        from Ganga.Utility.ColourText import Effects
        self._colour_normal = Effects().normal
        self._proxyClass = None
예제 #3
0
    def __init__(self, name, display_prefix):
        self.objects = oDict()
        self.name = name
        self._display_prefix = display_prefix
        self._display_columns = config[self._display_prefix + '_columns']
        self._display_columns_show_empty = config[self._display_prefix + "_columns_show_empty"]
        self._display_columns_width = config[self._display_prefix + "_columns_width"]
        self._display_columns_functions = {}
        try:
            col_funcs = config[self._display_prefix + '_columns_functions']
            for this_col_func in col_funcs:
                self._display_columns_functions[this_col_func] = eval(col_funcs[this_col_func])
        except Exception as x:
            logger.error("Error on evaluating display column functions from config file: %s: %s" % (x.__class__.__name__, x))

        from Ganga.Utility.ColourText import Effects
        self._colour_normal = Effects().normal
        self._proxyClass = None
예제 #4
0
    def __init__(self, name, display_prefix):
        super(RegistrySlice, self).__init__()
        self.objects = oDict()
        self.name = name
        self._display_prefix = display_prefix
        self._display_columns = config[self._display_prefix + '_columns']
        self._display_columns_show_empty = config[self._display_prefix +
                                                  "_columns_show_empty"]
        self._display_columns_width = config[self._display_prefix +
                                             "_columns_width"]
        self._display_columns_functions = {}
        try:
            col_funcs = config[self._display_prefix + '_columns_functions']
            for this_col_func in col_funcs:
                self._display_columns_functions[this_col_func] = eval(
                    col_funcs[this_col_func])
        except Exception as x:
            logger.error(
                "Error on evaluating display column functions from config file: %s: %s"
                % (getName(x), x))

        from Ganga.Utility.ColourText import Effects
        self._colour_normal = Effects().normal
        self._proxyClass = None
예제 #5
0
파일: utilities.py 프로젝트: kreczko/ganga
# $Id: utilities.py,v 1.1 2008-07-17 16:40:56 moscicki Exp $
##########################################################################

from Ganga.Utility.Plugin import PluginManagerError, allPlugins
from Ganga.GPIDev.Base.Objects import GangaObject
from Ganga.GPIDev.Schema import Schema, Version
from Ganga.GPIDev.Lib.GangaList.GangaList import stripGangaList
from Ganga.GPIDev.Lib.GangaList.GangaList import makeGangaList

import Ganga.Utility.logging

#from Ganga.Utility.external.ordereddict import oDict
from Ganga.Utility.external.OrderedDict import OrderedDict as oDict

logger = Ganga.Utility.logging.getLogger()
allConverters = oDict()

##########################################################################
# helper to create a dictionary of simpleattributes
# according to the schema from a ganga object from


def serialize(obj):
    """returns a (nested) dictionary of simple job attributes"""
    schema = obj._schema
    attrDict = {}
    attrDict['name'] = schema.name
    attrDict['category'] = schema.category
    attrDict['version'] = (schema.version.major, schema.version.minor)
    attrDict['simple'] = 0
    attrDict['data'] = {}
예제 #6
0
def jobSlice(joblist):
    """create a 'JobSlice' from a list of jobs
    example: jobSlice([j for j in jobs if j.name.startswith("T1:")])"""
    this_slice = JobRegistrySlice("manual slice")
    this_slice.objects = oDict([(j.fqid, _unwrap(j)) for j in joblist])
    return _wrap(this_slice)
예제 #7
0
파일: Runtime.py 프로젝트: mesmith75/ganga
# 30 Aug 2006 - KH : Modified function getSearchPath, to expand ~ and
#                    environment variables, and to allow paths to be
#                    specified relative to Ganga top directory

# 19 Oct 2006 - KH : Modified function getScriptPath, to expand ~ and
#                    environment variables

# 19 Oct 2006 - KH : Generalised function getSearchPath, allowing
#                    configuration parameter defining search path
#                    to be passed as arument

from Ganga.Utility.util import importName

#from Ganga.Utility.external.ordereddict import oDict
from Ganga.Utility.external.OrderedDict import OrderedDict as oDict
allRuntimes = oDict()

import Ganga.Utility.logging
logger = Ganga.Utility.logging.getLogger(modulename=1)


def getScriptPath(name="", searchPath=""):
    """Determine path to a script

       Arguments:
          name       - Name of a script
          searchPath - String of colon-separated directory names,
                       defining locations to be searched for script

       If 'name' already gives the path to the script, then
       'searchPath' is ignored.
예제 #8
0
def jobSlice(joblist):
    """create a 'JobSlice' from a list of jobs
    example: jobSlice([j for j in jobs if j.name.startswith("T1:")])"""
    this_slice = JobRegistrySlice("manual slice")
    this_slice.objects = oDict([(j.fqid, _unwrap(j)) for j in joblist])
    return _wrap(this_slice)
예제 #9
0
파일: Runtime.py 프로젝트: pseyfert/ganga
#                    specified relative to Ganga top directory

# 19 Oct 2006 - KH : Modified function getScriptPath, to expand ~ and
#                    environment variables

# 19 Oct 2006 - KH : Generalised function getSearchPath, allowing
#                    configuration parameter defining search path
#                    to be passed as arument

from Ganga.Core.exceptions import PluginError

from Ganga.Utility.util import importName

#from Ganga.Utility.external.ordereddict import oDict
from Ganga.Utility.external.OrderedDict import OrderedDict as oDict
allRuntimes = oDict()

import Ganga.Utility.logging
logger = Ganga.Utility.logging.getLogger(modulename=1)


def getScriptPath(name="", searchPath=""):
    """Determine path to a script

       Arguments:
          name       - Name of a script
          searchPath - String of colon-separated directory names,
                       defining locations to be searched for script

       If 'name' already gives the path to the script, then
       'searchPath' is ignored.