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(): # Must be defined BEFORE any dirac import os.environ['DIRAC_USE_TORNADO_IOLOOP'] = "True" from DIRAC.ConfigurationSystem.Client.PathFinder import getServiceSection from DIRAC.ConfigurationSystem.Client.ConfigurationData import gConfigurationData from DIRAC.ConfigurationSystem.Client.LocalConfiguration import LocalConfiguration from DIRAC.ConfigurationSystem.private.Refresher import gRefresher from DIRAC.Core.Utilities.DErrno import includeExtensionErrors from DIRAC.Core.Tornado.Server.TornadoServer import TornadoServer from DIRAC.FrameworkSystem.Client.Logger import gLogger if gConfigurationData.isMaster(): gRefresher.disable() localCfg = LocalConfiguration() 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("Tornado-CS", "/") gLogger.error("There were errors when loading configuration", resultDict['Message']) sys.exit(1) includeExtensionErrors() gLogger.initialize('Tornado-CS', "/") # get the specific master CS port try: csPort = int( gConfigurationData.extractOptionFromCFG( '%s/Port' % getServiceSection('Configuration/Server'))) except TypeError: csPort = None serverToLaunch = TornadoServer(services='Configuration/Server', port=csPort) serverToLaunch.startTornado()
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)
def main(): # Must be defined BEFORE any dirac import os.environ['DIRAC_USE_TORNADO_IOLOOP'] = "True" from DIRAC import gConfig from DIRAC.ConfigurationSystem.Client import PathFinder from DIRAC.ConfigurationSystem.Client.ConfigurationData import gConfigurationData from DIRAC.ConfigurationSystem.Client.LocalConfiguration import LocalConfiguration from DIRAC.Core.Tornado.Server.TornadoServer import TornadoServer from DIRAC.Core.Utilities.DErrno import includeExtensionErrors from DIRAC.FrameworkSystem.Client.Logger import gLogger # We check if there is no configuration server started as master # If you want to start a master CS you should use Configuration_Server.cfg and # use tornado-start-CS.py key = '/Systems/Configuration/%s/Services/Server/Protocol' % PathFinder.getSystemInstance('Configuration') if gConfigurationData.isMaster() and gConfig.getValue(key, 'dips').lower() == 'https': gLogger.fatal("You can't run the CS and services in the same server!") sys.exit(0) localCfg = LocalConfiguration() localCfg.setConfigurationForServer('Tornado/Tornado') 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("Tornado", "/") gLogger.error("There were errors when loading configuration", resultDict['Message']) sys.exit(1) includeExtensionErrors() gLogger.initialize('Tornado', "/") serverToLaunch = TornadoServer() serverToLaunch.startTornado()
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' ]: gLogger.fatal( "There were errors when loading configuration", resultDict[ 'Message' ] ) sys.exit( 1 ) 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 )
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] else: mainName = "Framework/MultiAgent" agentReactor = AgentReactor(mainName) result = agentReactor.loadAgentModules(positionalArgs) if result['OK']: agentReactor.go() else: