コード例 #1
0
    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)
コード例 #2
0
    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
コード例 #3
0
 def actor(self, system):
     actor = system.createActor(DummyFormulaActor)
     yield actor
     system.tell(actor, ActorExitRequest())
コード例 #4
0
ファイル: DistributedHGS.py プロジェクト: dimdimadi/evogil
 def shutdown(self):
     self.hgs_system.tell(self.node_supervisor, ActorExitRequest())
コード例 #5
0
ファイル: puller.py プロジェクト: powerapi-ng/powerapi
 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())
コード例 #6
0
ファイル: formula_actor.py プロジェクト: powerapi-ng/powerapi
 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())
コード例 #7
0
 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))
コード例 #8
0
 def test_inequality(self):
     m1 = ActorExitRequest()
     self.assertNotEqual(m1, True)
     self.assertNotEqual(m1, None)
     self.assertNotEqual(m1, 0)
コード例 #9
0
ファイル: troupe.py プロジェクト: seyi/Thespian
 def dismiss_extras(self, managerActor):
     exitReq = ActorExitRequest()
     for each in self._extra_troupers:
         managerActor.send(each, exitReq)
     self._extra_troupers = []
     self._pending_dismissal = False
コード例 #10
0
    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())
コード例 #11
0
    def receiveMessage(self, msg, sender):
        if not isinstance(msg, dict):
            return

        logger.debug("ignoring food messages")
        self.send(self.myAddress, ActorExitRequest())
コード例 #12
0
 def actor(self, system):
     actor = system.createActor(DispatcherActor)
     yield actor
     system.tell(actor, ActorExitRequest())
コード例 #13
0
    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())
コード例 #14
0
 def stop_workers(self):
     for worker in self.workers_list():
         self.send(worker, ActorExitRequest())
コード例 #15
0
ファイル: thespian.py プロジェクト: voidflow/eventsourcing
 def shutdown(self):
     msg = ActorExitRequest(recursive=True)
     self.actor_system.tell(self.system_actor, msg)
コード例 #16
0
ファイル: ctest2.py プロジェクト: spott/pykeycollect
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()
コード例 #17
0
ファイル: game.py プロジェクト: CJTozer/cliciv
 def end_game(self):
     for a in self.actors:
         self.actor_system.tell(a, ActorExitRequest())
コード例 #18
0
 def actor(self, system):
     puller = system.createActor(PullerActor)
     yield puller
     system.tell(puller, ActorExitRequest())
コード例 #19
0
 def test_inequality(self):
     m1 = ActorExitRequest()
     assert m1 != True
     assert m1 != None
     assert m1 != 0
コード例 #20
0
 def test_inheritance(self):
     assert isinstance(ActorExitRequest(False), ActorExitRequest)
     assert isinstance(ActorExitRequest(), ActorExitRequest)
     assert isinstance(ActorExitRequest(False), ActorSystemMessage)
     assert isinstance(ActorExitRequest(), ActorSystemMessage)
コード例 #21
0
 def test_equality(self):
     m1 = ActorExitRequest()
     assert m1 == ActorExitRequest()
     assert m1 == ActorExitRequest(True)
     assert m1 == ActorExitRequest(False)
コード例 #22
0
 def test_equality(self):
     m1 = ActorExitRequest()
     self.assertEqual(m1, ActorExitRequest())
     self.assertEqual(m1, ActorExitRequest(True))
     self.assertEqual(m1, ActorExitRequest(False))
コード例 #23
0
 def tearDown(self):
     self.sys1.tell(self.registrar, ActorExitRequest())
     self.sys1.shutdown()