def __initLogger( self, componentName, logSection ): gLogger.initialize( componentName, logSection ) if self.__debugMode == 1: gLogger.setLevel( "VERBOSE" ) elif self.__debugMode == 2: gLogger.setLevel( "VERBOSE" ) gLogger.showHeaders( True ) elif self.__debugMode >= 3: gLogger.setLevel( "DEBUG" ) gLogger.showHeaders( True )
def __initLogger(self, componentName, logSection): gLogger.initialize(componentName, logSection) if self.__debugMode == 1: gLogger.setLevel("VERBOSE") elif self.__debugMode == 2: gLogger.setLevel("VERBOSE") gLogger.showHeaders(True) elif self.__debugMode >= 3: gLogger.setLevel("DEBUG") gLogger.showHeaders(True)
getJobLoggingInfo() getWMSTimeStamps() """ __RCSID__ = "$Id$" import re, os, sys import time from types import StringTypes, IntType, LongType from DIRAC import gLogger,S_OK, S_ERROR, Time from DIRAC.ConfigurationSystem.Client.Config import gConfig from DIRAC.Core.Base.DB import DB # Here for debugging purpose; should be initialized by the containing component gLogger.initialize('WMS','/Databases/JobLoggingDB/Test') MAGIC_EPOC_NUMBER = 1270000000 ############################################################################# class JobLoggingDB(DB): def __init__( self, maxQueueSize=10 ): """ Standard Constructor """ DB.__init__(self,'JobLoggingDB','WorkloadManagement/JobLoggingDB',maxQueueSize) self.gLogger = gLogger #############################################################################
The following methods are provided addLoggingRecord() getJobLoggingInfo() getWMSTimeStamps() """ import time from types import StringTypes, IntType, LongType from DIRAC import gLogger, S_OK, S_ERROR from DIRAC.Core.Utilities import Time from DIRAC.Core.Base.DB import DB # Here for debugging purpose; should be initialized by the containing component gLogger.initialize('WMS', '/Databases/JobLoggingDB/Test') MAGIC_EPOC_NUMBER = 1270000000 ############################################################################# class JobLoggingDB(DB): def __init__(self, maxQueueSize=10): """ Standard Constructor """ DB.__init__(self, 'JobLoggingDB', 'WorkloadManagement/JobLoggingDB', maxQueueSize) self.gLogger = gLogger #############################################################################
######################################################################## __RCSID__ = "$Id$" """ This is a script to launch DIRAC agents """ import sys import DIRAC from DIRAC.ConfigurationSystem.Client.LocalConfiguration import LocalConfiguration from DIRAC import gLogger, gConfig from DIRAC.Core.Base.AgentReactor import AgentReactor localCfg = LocalConfiguration() positionalArgs = localCfg.getPositionalArguments() if len(positionalArgs) == 0: gLogger.initialize("NOT SPECIFIED", "/") gLogger.fatal("You must specify which agent to run!") sys.exit(1) agentName = positionalArgs[0] localCfg.setConfigurationForAgent(agentName) localCfg.addMandatoryEntry("/DIRAC/Setup") localCfg.addDefaultEntry("/DIRAC/Security/UseServerCertificate", "yes") localCfg.addDefaultEntry("LogLevel", "INFO") resultDict = localCfg.loadUserData() if not resultDict['OK']: gLogger.error("There were errors when loading configuration", resultDict['Message']) sys.exit(1) if len(positionalArgs) == 1:
__RCSID__ = "$Id$" """ This is a script to launch DIRAC agents """ import sys import DIRAC from DIRAC.ConfigurationSystem.Client.LocalConfiguration import LocalConfiguration from DIRAC import gLogger, gConfig from DIRAC.Core.Base.AgentReactor import AgentReactor localCfg = LocalConfiguration() positionalArgs = localCfg.getPositionalArguments() if len( positionalArgs ) == 0: gLogger.initialize( "NOT SPECIFIED", "/" ) gLogger.fatal( "You must specify which agent to run!" ) sys.exit( 1 ) agentName = positionalArgs[0] localCfg.setConfigurationForAgent( agentName ) localCfg.addMandatoryEntry( "/DIRAC/Setup" ) localCfg.addDefaultEntry( "/DIRAC/Security/UseServerCertificate", "yes" ) localCfg.addDefaultEntry( "LogLevel", "INFO" ) resultDict = localCfg.loadUserData() if not resultDict[ 'OK' ]: gLogger.error( "There were errors when loading configuration", resultDict[ 'Message' ] ) sys.exit( 1 ) if len( positionalArgs ) == 1: mainName = positionalArgs[0]
from DIRAC.ConfigurationSystem.Client.LocalConfiguration import LocalConfiguration if __name__ == "__main__": localCfg = LocalConfiguration() localCfg.setConfigurationForWeb( "REST" ) localCfg.addMandatoryEntry( "/DIRAC/Setup" ) localCfg.addDefaultEntry( "/DIRAC/Security/UseServerCertificate", "yes" ) localCfg.addDefaultEntry( "LogLevel", "INFO" ) localCfg.addDefaultEntry( "LogColor", True ) resultDict = localCfg.loadUserData() if not resultDict[ 'OK' ]: gLogger.initialize( serverName, "/" ) gLogger.error( "There were errors when loading configuration", resultDict[ 'Message' ] ) sys.exit( 1 ) from RESTDIRAC.ConfigurationSystem.Client.Helpers import RESTConf from RESTDIRAC.RESTSystem.private.RESTApp import RESTApp result = RESTConf.isOK() if not result[ 'OK' ]: gLogger.fatal( result[ 'Message' ] ) sys.exit(1) restApp = RESTApp() result = restApp.bootstrap() if not result[ 'OK' ]:
addLoggingRecord() getJobLoggingInfo() getWMSTimeStamps() """ import time from types import StringTypes, IntType, LongType from DIRAC import gLogger, S_OK, S_ERROR from DIRAC.Core.Utilities import Time from DIRAC.Core.Base.DB import DB __RCSID__ = "$Id$" # Here for debugging purpose; should be initialized by the containing component gLogger.initialize("WMS", "/Databases/JobLoggingDB/Test") MAGIC_EPOC_NUMBER = 1270000000 ############################################################################# class JobLoggingDB(DB): def __init__(self): """ Standard Constructor """ DB.__init__(self, "JobLoggingDB", "WorkloadManagement/JobLoggingDB") self.gLogger = gLogger ############################################################################# def addLoggingRecord(self, jobID, status="idem", minor="idem", application="idem", date="", source="Unknown"):
""" RAWIntegrityDB is the front end for the database containing the files which are awating migration. It offers a simple interface to add files, get files and modify their status. """ __RCSID__ = "$Id$" import types from DIRAC import gLogger, S_OK, S_ERROR from DIRAC.Core.Base.DB import DB from DIRAC.Core.Utilities.List import stringListToString gLogger.initialize('DMS', '/Databases/RAWIntegrityDB/Test') class RAWIntegrityDB(DB): _tablesDict = {} # Files table _tablesDict['Files'] = { 'Fields': { 'ID': 'BIGINT NOT NULL AUTO_INCREMENT', 'LFN': 'VARCHAR(255) NOT NULL', 'PFN': 'VARCHAR(255) NOT NULL', 'Size': 'BIGINT NOT NULL', 'StorageElement': 'VARCHAR(32) NOT NULL', 'GUID': 'VARCHAR(255) NOT NULL', 'FileChecksum': 'VARCHAR(255) NOT NULL', 'SubmitTime': 'DATETIME NOT NULL', 'CompleteTime': 'DATETIME', 'Status': 'VARCHAR(255) DEFAULT "Active"' },