Esempio n. 1
0
 def __init__(self, config, instance_collection):
     super(Service, self).__init__()
     self.config = config
     self.instances = instance_collection
     self.enabled = False
     args = config.restart_delay, self.repair
     self.repair_callback = eventloop.UniqueCallback(*args)
     self.event_recorder = event.get_recorder(str(self))
Esempio n. 2
0
 def __init__(self, id, node, interval, pid_filename):
     super(ServiceInstanceMonitorTask, self).__init__()
     self.interval = interval or 0
     self.node = node
     self.id = id
     self.pid_filename = pid_filename
     self.action = actioncommand.CompletedActionCommand
     self.callback = eventloop.UniqueCallback(self.interval, self.run)
     self.hang_check_callback = create_hang_check(self.interval, self.fail)
     self.buffer_store = actioncommand.StringBufferStore()
Esempio n. 3
0
 def setup_monitor(self):
     self.func = mock.Mock()
     self.callback = eventloop.UniqueCallback(5, self.func)
     self.callback.delayed_call = mock.Mock()
Esempio n. 4
0
def create_hang_check(delay, func):
    delay = max(delay * HANG_CHECK_DELAY_RATIO, MIN_HANG_CHECK_SECONDS)
    return eventloop.UniqueCallback(delay, func)