Examples of managers¶
The managers are defined as a Python class which inherits from MarcoManager.
An example of a Manager¶
class DemoManager(MarcoManager):
__disable__ = True # Set to true if the service is not to be included
@run_on_executor
def onSetup(self):
"""
Actions to include on setup
"""
nodes = marco.request_for("service")
for node in nodes:
do_something_with_node(node)
def delay(self):
"""
Returns delay in seconds after startup.
"""
return 5
def onStop(self):
"""
Actions to be executed befor stopping
"""
print("Killing")
def onReload(self):
"""
Actions when the reload event is fired
"""
nodes = marco.request_for("service")
for node in nodes:
do_something_with_node(node)
def doReload(self):
"""
Periodical reload interval
"""
return 0
Here are several examples:
-
class
managers.CompilerDiscover[source]¶ Bases:
marcomanager.marcomanager.MarcoManagerUses MarcoPolo through the
Marco python bindingto discover the available distcc compilers on the network. If successful, it modifies the /etc/distcc/hosts with the results.This manager is executed with a delay of 10 seconds after startup and reloads every hour.
-
onReload()[source]¶ On reload, requests again for the compiler service, and dumps the results to the hosts file.
-
onSetup(*args, **kwargs)[source]¶ Sends a
Request_formessage asking for nodes with the compiler service. If successful, it dumps the results to the ‘/etc/distcc/hosts file’
-
-
class
managers.HostnameManager[source]¶ Bases:
marcomanager.marcomanager.MarcoManagerIncludes hostname information in marcopolo