Пример #1
0
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)
Пример #2
0
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]
else:
    mainName = "Framework/MultiAgent"

agentReactor = AgentReactor(mainName)
Пример #3
0
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]
else:
  mainName = "Framework/MultiAgent"

agentReactor = AgentReactor( mainName )
result = agentReactor.loadAgentModules( positionalArgs )