def main(): localCfg = LocalConfiguration() localCfg.setUsageMessage(__doc__) positionalArgs = localCfg.getPositionalArguments() if len(positionalArgs) == 0: 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") localCfg.addDefaultEntry("LogColor", True) resultDict = localCfg.loadUserData() if not resultDict['OK']: gLogger.error("There were errors when loading configuration", resultDict['Message']) sys.exit(1) includeExtensionErrors() agentReactor = AgentReactor(positionalArgs[0]) result = agentReactor.loadAgentModules(positionalArgs) if result['OK']: agentReactor.go() else: gLogger.error("Error while loading agent module", result['Message']) sys.exit(2)
def main(): localCfg = LocalConfiguration() localCfg.setUsageMessage(__doc__) positionalArgs = localCfg.getPositionalArguments() if len(positionalArgs) == 0: gLogger.fatal("You must specify which server to run!") sys.exit(1) serverName = positionalArgs[0] localCfg.setConfigurationForServer(serverName) localCfg.addMandatoryEntry("Port") # localCfg.addMandatoryEntry( "HandlerPath" ) 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) includeExtensionErrors() serverToLaunch = ServiceReactor() result = serverToLaunch.initialize(positionalArgs) if not result['OK']: gLogger.error(result['Message']) sys.exit(1) result = serverToLaunch.serve() if not result['OK']: gLogger.error(result['Message']) sys.exit(1)
def main(): localCfg = LocalConfiguration() localCfg.setUsageMessage(__doc__) positionalArgs = localCfg.getPositionalArguments() if len(positionalArgs) == 0: gLogger.fatal("You must specify which executor to run!") sys.exit(1) if len(positionalArgs) == 1 and positionalArgs[0].find("/") > -1: mainName = positionalArgs[0] else: mainName = "Framework/MultiExecutor" localCfg.setConfigurationForExecutor(mainName) 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.fatal("There were errors when loading configuration", resultDict['Message']) sys.exit(1) includeExtensionErrors() executorReactor = ExecutorReactor() result = executorReactor.loadModules(positionalArgs) if not result['OK']: gLogger.fatal("Error while loading executor", result['Message']) sys.exit(1) result = executorReactor.go() if not result['OK']: gLogger.fatal(result['Message']) sys.exit(1) gLogger.notice("Graceful exit. Bye!") sys.exit(0)
# Author : Adria Casajus ######################################################################## __RCSID__ = "$Id$" """ This is a script to launch DIRAC executors """ import sys import DIRAC from DIRAC.ConfigurationSystem.Client.LocalConfiguration import LocalConfiguration from DIRAC import gLogger, gConfig from DIRAC.Core.Base.ExecutorReactor import ExecutorReactor localCfg = LocalConfiguration() positionalArgs = localCfg.getPositionalArguments() if len( positionalArgs ) == 0: gLogger.fatal( "You must specify which executor to run!" ) sys.exit( 1 ) if len( positionalArgs ) == 1 and positionalArgs[0].find( "/" ) > -1: mainName = positionalArgs[0] else: mainName = "Framework/MultiExecutor" localCfg.setConfigurationForExecutor( mainName ) localCfg.addMandatoryEntry( "/DIRAC/Setup" ) localCfg.addDefaultEntry( "/DIRAC/Security/UseServerCertificate", "yes" ) localCfg.addDefaultEntry( "LogLevel", "INFO" ) resultDict = localCfg.loadUserData() if not resultDict[ 'OK' ]:
# File : dirac-agent # Author : Adria Casajus, Andrei Tsaregorodtsev, Stuart Paterson ######################################################################## __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)