Vista procedimental¶
Clase MarcoPoloManager¶
class MarcoPoloManager(object):
def __init__(self):
def enable(self):
def onSetup(self):
def onStop(self):
def delay(self):
def onReload(self):
def doReload(self):
Registro de servicios durante el arranque¶
Starts the daemon and service units.
Initializes the runfile and logs and then starts the IOLoop
"""
for manager_instance in [m for m in classes if m.__disable__ == False]:
manager_instances.append(manager_instance())
signal.signal(signal.SIGTERM, sigterm_handler)
signal.signal(signal.SIGUSR1, sigusr1_handler)
signal.signal(signal.SIGINT, sigterm_handler)
#signal.signal(signal.SIGHUP, signal.SIG_IGN)
Servicio al ejecutar su acción¶
@run_on_executor
def onSetup(self):
m = marco.Marco()
while True:
try:
nodes = m.request_for("compiler")
break
except marco.MarcoTimeOutException:
time.sleep(1)
print("Retrying")
try:
f = open('/etc/distcc/hosts', 'w')
for node in nodes:
f.write(node.address)
logging.info("Adding compiler %s", node.address)
f.close()
except Exception as e:
logging.warning("Something happened while executing CompilerDiscover: %s" % e)