Пример #1
0
    def initiate(self, state):
        self._paused = False

        shard.register_for_notifications(self)

        solver = problem.SolveProblemInterest(DeadAgent())
        service = contractor.Service("monitoring")
        state.medium.register_interest(solver)
        state.medium.register_interest(service)

        config = state.medium.get_configuration()
        control_period = config.control_period
        enable_quarantine = config.enable_quarantine
        host_quarantine = config.host_quarantine_length
        self_quarantine = config.self_quarantine_length

        state.updating_neighbours = False
        state.need_neighbour_update = False

        state.clerk = self.dependency(IClerkFactory, self, self,
                                      location=state.medium.get_hostname(),
                                      enable_quarantine=enable_quarantine,
                                      host_quarantine_length=host_quarantine,
                                      self_quarantine_length=self_quarantine)
        state.intensive_care = self.dependency(IIntensiveCareFactory,
                                               self, state.clerk,
                                               control_period=control_period)

        # agent_id -> HandleDeath instance
        state.handler_tasks = dict()
Пример #2
0
 def initiate(self, state):
     self.clear()
     shard.register_for_notifications(self)