Ejemplo n.º 1
0
def mocked_ppHandler():
    """
    return a mocked PoisonPillMessageHandler
    """

    state = Mock()
    state.actor = Mock()
    state.actor.socket_interface = Mock()
    state.actor.socket_interface.receive = Mock(return_value=None)

    handler = PoisonPillMessageHandler(state)
    handler.teardown = Mock()
    return handler
Ejemplo n.º 2
0
 def setup(self):
     """
     Initialize Handler
     """
     FormulaActor.setup(self)
     self.add_handler(PoisonPillMessage, PoisonPillMessageHandler(self.state))
     self.add_handler(Report, ReportHandler(self.state))
Ejemplo n.º 3
0
 def setup(self):
     """
     Define StartMessage handler and PoisonPillMessage handler
     """
     self.add_handler(PoisonPillMessage, PoisonPillMessageHandler())
     self.add_handler(StartMessage, PullerStartHandler())
     self.set_timeout_handler(TimeoutHandler())
Ejemplo n.º 4
0
    def setup(self):
        self.push_socket = SafeContext.get_context().socket(zmq.PUSH)
        self.push_socket.connect(self.addr)

        self.add_handler(PoisonPillMessage, PoisonPillMessageHandler())
        self.add_handler(StartMessage, StartHandler())
        self.add_handler(Report, HWPCReportHandler(self.push_socket))
Ejemplo n.º 5
0
 def setup(self):
     """
     Setup the messages handlers.
     """
     FormulaActor.setup(self)
     self.add_handler(PoisonPillMessage,
                      PoisonPillMessageHandler(self.state))
     self.add_handler(HWPCReport, ReportHandler(self.state))
Ejemplo n.º 6
0
 def setup(self):
     """
     Setup the RAPL formula.
     """
     FormulaActor.setup(self)
     self.add_handler(PoisonPillMessage, PoisonPillMessageHandler())
     handler = RAPLFormulaHWPCReportHandler(self.actor_pusher)
     self.add_handler(HWPCReport, handler)
Ejemplo n.º 7
0
 def setup(self):
     """
     Initialize Handler
     """
     FormulaActor.setup(self)
     self.add_handler(PoisonPillMessage, PoisonPillMessageHandler())
     handler = DummyHWPCReportHandler(self.actor_pusher)
     self.add_handler(Report, handler)
Ejemplo n.º 8
0
    def setup(self):
        self.add_handler(PoisonPillMessage, PoisonPillMessageHandler())
        self.push_socket = SafeContext.get_context().socket(zmq.PUSH)
        self.push_socket.connect(self.addr)

        self.add_handler(Report, HWPCReportHandler(self.push_socket))

        self.push_socket.send(pickle.dumps('created'))
Ejemplo n.º 9
0
    def setup(self):
        """
        Check if there is a primary group by rule. Set define
        StartMessage, PoisonPillMessage and Report handlers
        """
        Actor.setup(self)
        if self.state.route_table.primary_dispatch_rule is None:
            raise NoPrimaryDispatchRuleRuleException()

        self.add_handler(Report, FormulaDispatcherReportHandler())
        self.add_handler(PoisonPillMessage, PoisonPillMessageHandler())
        self.add_handler(StartMessage, StartHandler())
Ejemplo n.º 10
0
 def setup(self):
     self.add_handler(PoisonPillMessage, PoisonPillMessageHandler(self.state))