AgentReactor

DIRAC class to execute Agents

Agents are the active part any any DIRAC system, they execute in a cyclic manner looking at the state of the system and reacting to it by taken appropriated actions

All DIRAC Agents must inherit from the basic class AgentModule

In the most common case, DIRAC Agents are executed using the dirac-agent command. dirac-agent accepts a list positional arguments. These arguments have the form: [DIRAC System Name]/[DIRAC Agent Name] dirac-agent then: - produces a instance of AgentReactor - loads the required modules using the AgentReactor.loadAgentModules method - starts the execution loop using the AgentReactor.go method

Agent modules must be placed under the Agent directory of a DIRAC System. DIRAC Systems are called XXXSystem where XXX is the [DIRAC System Name], and must inherit from the base class AgentModule

class DIRAC.Core.Base.AgentReactor.AgentReactor(baseAgentName)

Bases: object

Main interface to DIRAC Agents. It allows to : - define a Agents modules to be executed - define the number of cycles to execute - steer the execution

Agents are declared via: - loadAgentModule(): for a single Agent - loadAgentModules(): for a list of Agents

The number of cycles to execute for a defined Agent can be set via: - setAgentModuleCyclesToExecute()

The execution of the Agents is done with: - runNumCycles(): to execute an additional number of cycles - go():

During the execution of the cycles, each of the Agents can be signaled to stop by creating a file named “stop_agent” in its Control Directory.

__init__(baseAgentName)

x.__init__(…) initializes x; see help(type(x)) for signature

go()

Main method to control the execution of all configured Agents

loadAgentModules(modulesList, hideExceptions=False)

Load all modules required in moduleList

runNumCycles(agentName=None, numCycles=1)

Run all defined agents a given number of cycles

setAgentModuleCyclesToExecute(agentName, maxCycles=1)

Set number of cycles to execute for a given agent (previously defined)