def test_properties(self): self.assertTrue(ActorExitRequest().isRecursive) self.assertTrue(ActorExitRequest(True).isRecursive) self.assertFalse(ActorExitRequest(False).isRecursive) m1 = ActorExitRequest() self.assertTrue(m1.isRecursive) m1.notRecursive() self.assertFalse(m1.isRecursive)
def test_properties(self): assert ActorExitRequest().isRecursive assert ActorExitRequest(True).isRecursive assert not ActorExitRequest(False).isRecursive m1 = ActorExitRequest() assert m1.isRecursive m1.notRecursive() assert not m1.isRecursive
def actor(self, system): actor = system.createActor(DummyFormulaActor) yield actor system.tell(actor, ActorExitRequest())
def shutdown(self): self.hgs_system.tell(self.node_supervisor, ActorExitRequest())
def _terminate(self): self.send(self.parent, EndMessage(self.name)) for _, dispatcher in self.report_filter.filters: self.send(dispatcher, EndMessage(self.name)) self.send(self.myAddress, ActorExitRequest())
def receiveMsg_EndMessage(self, message: EndMessage, _: ActorAddress): """ when receiving a EndMessage kill itself """ self.log_debug('received message ' + str(message)) self.send(self.myAddress, ActorExitRequest())
def test_inheritance(self): self.assertTrue(isinstance(ActorExitRequest(False), ActorExitRequest)) self.assertTrue(isinstance(ActorExitRequest(), ActorExitRequest)) self.assertTrue(isinstance(ActorExitRequest(False), ActorSystemMessage)) self.assertTrue(isinstance(ActorExitRequest(), ActorSystemMessage))
def test_inequality(self): m1 = ActorExitRequest() self.assertNotEqual(m1, True) self.assertNotEqual(m1, None) self.assertNotEqual(m1, 0)
def dismiss_extras(self, managerActor): exitReq = ActorExitRequest() for each in self._extra_troupers: managerActor.send(each, exitReq) self._extra_troupers = [] self._pending_dismissal = False
def receiveMessage(self, msg, sender): if isinstance(msg, SearchRequest): res = self.__search_client.search_for(msg) self.send(sender, res) self.send(self.myAddress, ActorExitRequest())
def receiveMessage(self, msg, sender): if not isinstance(msg, dict): return logger.debug("ignoring food messages") self.send(self.myAddress, ActorExitRequest())
def actor(self, system): actor = system.createActor(DispatcherActor) yield actor system.tell(actor, ActorExitRequest())
def __init__(self): super().__init__() def receiveMessage(self, msg, sender): #print(msg) if isinstance(msg, dict): if 'hdl' in msg: self.handleDeadLetters(msg['hdl']) return if 'new' in msg: self.hello = self.createActor(Hello) self.send(sender, self.hello) return if isinstance(msg, ChildActorExited): print(msg.childAddress) return print("Got Dead Letter from {}: {}".format(sender, msg)) if __name__ == "__main__": hello = ActorSystem().createActor(Hello) dlh = ActorSystem().createActor(DLH) hello2 = ActorSystem().ask(dlh, {'new': True}) print(ActorSystem().ask(hello2, {'gzzz': True})) print(ActorSystem().tell(hello2, {'szzz': '123'})) print(ActorSystem().ask(hello2, {'gzzz': True})) ActorSystem().tell(hello2, {'die': True}) print(ActorSystem().ask(hello2, {'gzzz': True})) ActorSystem().tell(hello2, ActorExitRequest())
def stop_workers(self): for worker in self.workers_list(): self.send(worker, ActorExitRequest())
def shutdown(self): msg = ActorExitRequest(recursive=True) self.actor_system.tell(self.system_actor, msg)
import socket import errno from datetime import timedelta from functools import partial from common import * import Actors import time import signal import uuid #capabilities = {'Convention Address.IPv4': ('10.128.108.62', 2212), 'Admin Port': 2213, 'uuid': None} capabilities = {'Admin Port': 2213, 'uuid': None} if __name__ == "__main__": capabilities['uuid'] = uuid.uuid4().hex asys = ActorSystem('multiprocTCPBase', capabilities) print("Joining Convention") asys.updateCapability('Convention Address.IPv4', ('10.128.108.62', 2212)) time.sleep(2) rn = asys.createActor('Actors.RegistrarActor', {'uuid': capabilities['uuid']}, globalName='rnode') asys.tell(rn, 'Hello String') time.sleep(1) # la = asys.createActor(Actors.LogActor) # asys.tell(la,"init") # time.sleep(2) print("Shutting Down") asys.tell(rn, ActorExitRequest()) time.sleep(3) asys.shutdown()
def end_game(self): for a in self.actors: self.actor_system.tell(a, ActorExitRequest())
def actor(self, system): puller = system.createActor(PullerActor) yield puller system.tell(puller, ActorExitRequest())
def test_inequality(self): m1 = ActorExitRequest() assert m1 != True assert m1 != None assert m1 != 0
def test_inheritance(self): assert isinstance(ActorExitRequest(False), ActorExitRequest) assert isinstance(ActorExitRequest(), ActorExitRequest) assert isinstance(ActorExitRequest(False), ActorSystemMessage) assert isinstance(ActorExitRequest(), ActorSystemMessage)
def test_equality(self): m1 = ActorExitRequest() assert m1 == ActorExitRequest() assert m1 == ActorExitRequest(True) assert m1 == ActorExitRequest(False)
def test_equality(self): m1 = ActorExitRequest() self.assertEqual(m1, ActorExitRequest()) self.assertEqual(m1, ActorExitRequest(True)) self.assertEqual(m1, ActorExitRequest(False))
def tearDown(self): self.sys1.tell(self.registrar, ActorExitRequest()) self.sys1.shutdown()