Ejemplo n.º 1
0
def getNickname(gridProxy=None, allowMissingNickname=True):
    import re
    from Ganga.Utility.logging import getLogger
    from Ganga.GPIDev.Credentials import GridProxy

    logger = getLogger()
    if not gridProxy:
        gridProxy = GridProxy()
    nickName = ''
    output = gridProxy.info(opt='-all')
    for line in output.split('\n'):
        if line.startswith('attribute'):
            match = re.search('nickname =\s*([^\s]+)\s*\(atlas\)', line)
            if match != None:
                nickName = match.group(1)
                break
    # check
    if nickName == '':
        from Ganga.Core.exceptions import ApplicationConfigurationError
        wMessage = 'Could not get nickname from voms proxy. '
        wMessage += 'Please register nickname to ATLAS VO via\n\n'
        wMessage += '   https://lcg-voms.cern.ch:8443/vo/atlas/vomrs\n'
        wMessage += '      [Member Info] -> [Edit Personal Info]\n\n'
        wMessage += 'Then you can use the new naming convention "user.nickname" '
        wMessage += 'which should be shorter than "userXY.FirstnameLastname".'
        if allowMissingNickname:
            logger.warning(wMessage)
        else:
            raise ApplicationConfigurationError(None, wMessage)
    return nickName
Ejemplo n.º 2
0
def getNickname(gridProxy=None,allowMissingNickname=True):
    import re
    from Ganga.Utility.logging import getLogger
    from Ganga.GPIDev.Credentials import GridProxy

    logger = getLogger()
    if not gridProxy:
        gridProxy=GridProxy()
    nickName = ''
    output = gridProxy.info(opt = '-all')
    for line in output.split('\n'):
        if line.startswith('attribute'):
            match = re.search('nickname =\s*([^\s]+)\s*\(atlas\)',line)
            if match != None:
                nickName = match.group(1)
                break
    # check        
    if nickName == '':
        from Ganga.Core.exceptions import ApplicationConfigurationError
        wMessage =  'Could not get nickname from voms proxy. '
        wMessage += 'Please register nickname to ATLAS VO via\n\n'
        wMessage += '   https://lcg-voms.cern.ch:8443/vo/atlas/vomrs\n'
        wMessage += '      [Member Info] -> [Edit Personal Info]\n\n'
        wMessage += 'Then you can use the new naming convention "user.nickname" '
        wMessage += 'which should be shorter than "userXY.FirstnameLastname".'
        if allowMissingNickname:
            logger.warning(wMessage)
        else:
            raise ApplicationConfigurationError(None,wMessage)
    return nickName
Ejemplo n.º 3
0
    def handleGridProxy(self):
        """Check the Grid Proxy validity"""
        proxy = GridProxy()
        mintime = float(7600)
        try:
            timeleft = float(proxy.timeleft("hours"))*3600
        except ValueError:
            timeleft = 0.0

        if timeleft < mintime:
            logger.warning("Failed to submit job. Grid proxy validity %s s, while %s s required" % (str(timeleft),str(mintime)))
            raise BackendError("SimpleCrab", "Failed to submit job. Grid proxy validity %s s, while %s s required" % (str(timeleft),str(mintime)))
Ejemplo n.º 4
0
        param += '-o "%s" ' % (
            outfiles
        )  # must be double quotes, because python prints strings in 'single quotes'

        for file in jspec.Files:
            if file.type in ['output', 'log'] and configPanda['chirpconfig']:
                file.dispatchDBlockToken = configPanda['chirpconfig']
                logger.debug('chirp file %s', file)

        jspec.jobParameters = param

        return jspec

from Ganga.GPIDev.Credentials import GridProxy

gridProxy = GridProxy()

from Ganga.GPIDev.Adapters.ApplicationRuntimeHandlers import allHandlers

allHandlers.add('Executable', 'Panda', ExecutablePandaRTHandler)

from Ganga.Utility.Config import getConfig, ConfigError

config = getConfig('Athena')
configDQ2 = getConfig('DQ2')
configPanda = getConfig('Panda')

from Ganga.Utility.logging import getLogger

logger = getLogger()
Ejemplo n.º 5
0
from Ganga.GPIDev.Lib.Tasks.common import *
import random

from Ganga.GPIDev.Lib.Tasks import Transform
from TaskApplication import AthenaMCTask
from GangaAtlas.Lib.AthenaMC.AthenaMCDatasets import AthenaMCOutputDatasets, AthenaMCInputDatasets, _usertag
from Ganga.GPIDev.Schema import *

# Extract username from certificate
from Ganga.GPIDev.Credentials import GridProxy
proxy = GridProxy()
username = proxy.identity()
      
# AthenaMC public settings
#athenamcsettings = ["mode", "run_number", "production_name", "process_name", "atlas_release", "se_name", "transform_archive", "verbosity", "siteroot", "version", "cmtsite", "transform_script", "extraArgs", "extraIncArgs"]
athenamcsettings = ["mode", "run_number", "production_name", "process_name", "atlas_release", "se_name", "transform_archive"]
settings = {}
settings["EvgenTransform"] = athenamcsettings + ["evgen_job_option"]
settings["SimulTransform"] = athenamcsettings + ["triggerConfig", "geometryTag"]
settings["ReconTransform"] = athenamcsettings + ["triggerConfig", "geometryTag"]

class MCTransform(Transform):
   _schema = Schema(Version(1,0), dict(Transform._schema.datadict.items() + {
       'file_type': SimpleItem(defvalue=1, hidden=1, doc='string in the output file, pe. evgen.EVNT..',modelist=["str"]),
       'random_seeds': SimpleItem(defvalue={}, doc='random seeds to be used in the partition',modelist=["dict","int"]),

}.items()))
   _category = 'transforms'
   _name = 'MCTransform'
   _hidden = 1
   _exportmethods = Transform._exportmethods
Ejemplo n.º 6
0
from Ganga.GPIDev.Lib.Tasks.common import *
import random

from Ganga.GPIDev.Lib.Tasks import Transform
from TaskApplication import AthenaMCTask
from GangaAtlas.Lib.AthenaMC.AthenaMCDatasets import AthenaMCOutputDatasets, AthenaMCInputDatasets, _usertag
from Ganga.GPIDev.Schema import *
from Ganga.Utility.ColourText import overview_colours, status_colours, ANSIMarkup
markup = ANSIMarkup()

# Extract username from certificate
from Ganga.GPIDev.Credentials import GridProxy
proxy = GridProxy()
username = proxy.identity()

# AthenaMC public settings
#athenamcsettings = ["mode", "run_number", "production_name", "process_name", "atlas_release", "se_name", "transform_archive", "verbosity", "siteroot", "version", "cmtsite", "transform_script", "extraArgs", "extraIncArgs"]
athenamcsettings = [
    "mode", "run_number", "production_name", "process_name", "atlas_release",
    "se_name", "transform_archive"
]
settings = {}
settings["EvgenTransform"] = athenamcsettings + ["evgen_job_option"]
settings["SimulTransform"] = athenamcsettings + [
    "triggerConfig", "geometryTag"
]
settings["ReconTransform"] = athenamcsettings + [
    "triggerConfig", "geometryTag"
]