This agency.agency module provides the single manager instance used to store the Agent instances. This module also provides the AGENT_CATEGORIES. These categories are used to group agents of common functionality together. There is no rigid enforcement of which agent belongs where. They are only used as a convention. These categories are the strings that are used in the class field in the configuration.
Bases: object
This class manages the node and alias id string generation, based on the agent category currently found in agency.AGENT_CATEGORIES.
Called to generate a node_id and alias_id for the given class recovered from the config file.
This is the user specific id recovered from the config file. The agency manager must make sure these are unique.
If this is not given then an alias will be auto-generated.
(node_id, alias_id)
The node_id provides a specific id for addressing a particular agent. The alias_id is used when any instance of the agent maybe used.
Platforms: Unix, MacOSX, Windows
This module implements the base agent interface that agents must inherit from and implement. The agent manager looks for this and if found uses it to create and run the agent.
Bases: object
Base class agent entry.
Called to set up the agent and subscribe for any events it may be interested in.
Called to start any processing the agent may need to do.
This function maybe used to start any threads polling a agent for example.
This module provides the Agent parsing, loading and configuration handling.
This represents a configuration sections as recoverd from the agent configuration.
A config section can have the following options:
[name]
# The python path to agent to import e.g.
agent = 'agency.testing.fake'
# A ategoary from agency.AGENT_CATEGORIES
cat = 'general'
# OPTIONAL: a unique number which can be used instead of name
# to refer to this agent.
alias = 1
# OPTIONAL: disable the setup/tearDown/start/stop of the
# agent. It will still be loaded and created.
disabled = 'yes' | 'no'
Called to test and then load the agent configuration.
Bases: exceptions.Exception
This is raised for problems with loading and using the configuration.
Bases: object
This represents a configuration sections as recoverd from the agent configuration.
A config section can have the following options:
[name]
# The python path to agent to import e.g.
agent = 'agency.testing.fake'
# A ategoary from agency.AGENT_CATEGORIES
cat = 'general'
# OPTIONAL: a unique number which can be used instead of name
# to refer to this agent.
alias = 1
# OPTIONAL: disable the setup/tearDown/start/stop of the
# agent. It will still be loaded and created.
disabled = 'yes' | 'no'
Called to check that all the reserved fields have been provided.
If one or more aren’t provided then ConfigError will be raised to indicate so.
Called to test and then load the agent configuration.
Platforms: Unix, MacOSX, Windows
This is the manager. It is reposible for managing the physical agents the application is using. The agent manager takes care of the loading and intialisation of each agent, using the configuration provided by the user.
The agent manager takes care of the load of agents and provides a central point to setUp, tearDown, start & stop all agent nodes under our care.
Called to recover a specific agent node.
If the alias is not found the ManagerError will be raised.
Load the agent modules into the system wide configuration.
The system wide configuration needs to have been set up via the director.config functions.
The shutdown method must be called before recalling load. If this has not been done then ManagerError will be raised.
Called to initialise all agents in our care.
The load method must be called before this one. Otherwise ManagerError will be raised.
Used to tearDown and reset the internal state of the agent manager ready for a new load command.
Start all agents under our management
The load method must be called before this one. Otherwise ManagerError will be raised.
Bases: object
The agent manager takes care of the load of agents and provides a central point to setUp, tearDown, start & stop all agent nodes under our care.
Called to recover a specific agent node.
If the alias is not found the ManagerError will be raised.
Return a string representing the last traceback.
Load the agent modules into the system wide configuration.
The system wide configuration needs to have been set up via the director.config functions.
The shutdown method must be called before recalling load. If this has not been done then ManagerError will be raised.
Called to initialise all agents in our care.
The load method must be called before this one. Otherwise ManagerError will be raised.
Used to tearDown and reset the internal state of the agent manager ready for a new load command.
Start all agents under our management
The load method must be called before this one. Otherwise ManagerError will be raised.
Start all agents under our management
The load method must be called before this one. Otherwise ManagerError will be raised.
Called to tearDown all agents in our care.
Before calling a agents tearDown() its stop() method is called first.
The load method must be called before this one. Otherwise ManagerError will be raised.