• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pulsar.get_actor函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pulsar.get_actor函数的典型用法代码示例。如果您正苦于以下问题:Python get_actor函数的具体用法?Python get_actor怎么用?Python get_actor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_actor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_registered

 def test_registered(self):
     '''Test the arbiter in its process domain'''
     arbiter = pulsar.get_actor()
     self.assertTrue(arbiter.is_arbiter())
     self.assertTrue(arbiter.registered)
     self.assertTrue('arbiter' in arbiter.registered)
     self.assertTrue('test' in arbiter.registered)
开发者ID:axisofentropy,项目名称:pulsar,代码行数:7,代码来源:arbiter.py


示例2: test_actor_coverage

 def test_actor_coverage(self):
     '''test case for coverage'''
     actor = pulsar.get_actor()
     try:
         yield send(send, 'sjdcbhjscbhjdbjsj', 'bla')
     except CommandNotFound:
         pass
开发者ID:LoganTK,项目名称:pulsar,代码行数:7,代码来源:actor.py


示例3: testWorkerMonitor

 def testWorkerMonitor(self):
     worker = pulsar.get_actor()
     monitor = worker.monitor
     arbiter = worker.arbiter
     mailbox = monitor.mailbox
     self.assertEqual(mailbox, arbiter.mailbox)
     self.assertTrue(mailbox.async)
开发者ID:cyberj,项目名称:pulsar,代码行数:7,代码来源:me.py


示例4: test_ping_monitor

 def test_ping_monitor(self):
     worker = get_actor()
     future = yield send('monitor', 'ping')
     self.assertEqual(future, 'pong')
     yield self.async.assertEqual(send(worker.monitor, 'ping'), 'pong')
     response = yield send('monitor', 'notify', worker.info())
     self.assertTrue(response <= time.time())
开发者ID:BazookaShao,项目名称:pulsar,代码行数:7,代码来源:__init__.py


示例5: testTestSuiteMonitor

 def testTestSuiteMonitor(self):
     arbiter = pulsar.get_actor()
     self.assertTrue(len(arbiter.monitors) >= 1)
     monitor = arbiter.monitors['test']
     app = monitor.app
     self.assertTrue(isinstance(app, TestSuite))
     self.assertFalse(monitor.cpubound)
开发者ID:cyberj,项目名称:pulsar,代码行数:7,代码来源:me.py


示例6: test_suite_event_loop

 def test_suite_event_loop(self):
     '''Test event loop in test worker'''
     worker = pulsar.get_actor()
     loop = get_event_loop()
     self.assertTrue(loop.is_running())
     self.assertTrue(worker._loop.is_running())
     self.assertNotEqual(worker._loop, loop)
开发者ID:axisofentropy,项目名称:pulsar,代码行数:7,代码来源:me.py


示例7: run

 def run(self, callable):
     actor = get_actor()
     if actor.is_monitor():
         return callable(actor)
     else:
         # send the callable to the actor monitor
         return actor.send(actor.monitor, 'run', callable)
开发者ID:BazookaShao,项目名称:pulsar,代码行数:7,代码来源:utils.py


示例8: get_clients

def get_clients():
    actor = pulsar.get_actor()
    clients = actor.params.clients
    if clients is None:
        clients = set()
        actor.params.clients = clients
    return clients
开发者ID:cyberj,项目名称:pulsar,代码行数:7,代码来源:manage.py


示例9: test_sorted_tags

 def test_sorted_tags(self):
     app = get_actor().app
     loader = TestLoader(app.root_dir, app.cfg.modules, app.runner)
     modules = list(loader.testmodules())
     self.assertTrue(modules)
     tags = [m[0] for m in modules]
     self.assertEqual(tags, sorted(tags))
开发者ID:LoganTK,项目名称:pulsar,代码行数:7,代码来源:loader.py


示例10: test_tasks

 def test_tasks(self):
     worker = pulsar.get_actor()
     backend = worker.app.backend
     self.assertTrue(worker.app.backend)
     self.assertEqual(backend.name, worker.app.name)
     self.assertEqual(len(backend.registry), 1)
     self.assertTrue('test' in backend.registry)
开发者ID:BazookaShao,项目名称:pulsar,代码行数:7,代码来源:me.py


示例11: testPing

 def testPing(self):
     c = self.client()
     self.assertEqual(c.ping(), 'pong')
     self.assertEqual(c.received, 1)
     self.assertEqual(c.ping(), 'pong')
     self.assertEqual(c.received, 2)
     actor = pulsar.get_actor()
开发者ID:cyberj,项目名称:pulsar,代码行数:7,代码来源:client.py


示例12: load_config

    def load_config(self):
        """Load the application configuration from a file and/or
        from the command line.

        Called during application initialisation. The parameters
        overriding order is the following:

        * default parameters.
        * the key-valued params passed in the initialisation.
        * the parameters in the optional configuration file
        * the parameters passed in the command line.
        """
        # get the actor if available and override default cfg values with those
        # from the actor
        actor = get_actor()
        if actor and actor.is_running():
            # actor available and running.
            # Unless argv is set, skip parsing
            if self.argv is None:
                self.console_parsed = False
            # copy global settings
            self.cfg.copy_globals(actor.cfg)
        #
        for name in list(self.cfg.params):
            if name in self.cfg.settings:
                value = self.cfg.params.pop(name)
                if value is not None:
                    self.cfg.set(name, value)
        # parse console args
        if self.console_parsed:
            self.cfg.parse_command_line(self.argv)
        else:
            self.cfg.params.update(self.cfg.import_from_module())
开发者ID:juanignaciocatalano,项目名称:pulsar,代码行数:33,代码来源:__init__.py


示例13: get_handler

    def get_handler(self):
        if self.handler is None:
            self._worker = pulsar.get_actor()
            if not self.cms:
                self.cms = CMS(self)

            async_middleware, wsgi = self._build_handler()
            self.handler = wsgi
            self.fire('on_loaded')
            #
            # Using a green pool
            if self.green_pool:
                from pulsar.apps.greenio.wsgi import GreenWSGI
                wsgi = GreenWSGI(wsgi, self.green_pool)
                async_middleware.append(wsgi)
            else:
                if self.config['THREAD_POOL']:
                    wsgi = middleware_in_executor(wsgi)
                else:
                    wsgi = as_async_wsgi(wsgi)
                async_middleware.append(wait_for_body_middleware)
                async_middleware.append(wsgi)

            self.handler = WsgiHandler(async_middleware, async=True)
        return self.handler
开发者ID:pvanderlinden,项目名称:lux,代码行数:25,代码来源:app.py


示例14: __call__

    def __call__(self, actor=None):
        '''Register this application with the (optional) calling ``actor``.

        If an ``actor`` is available (either via the function argument or via
        the :func:`~pulsar.async.actor.get_actor` function) it must be
        :class:`.Arbiter`, otherwise this call is no-op.

        If no actor is available, it means this application starts
        pulsar engine by creating the :class:`.Arbiter` with its
        :ref:`global settings <setting-section-global-server-settings>`
        copied to the arbiter :class:`.Config` container.

        :return: the ``start`` one time event fired once this application
            has fired it.
        '''
        if actor is None:
            actor = get_actor()
        monitor = None
        if actor and actor.is_arbiter():
            monitor = actor.get_actor(self.name)
        if monitor is None and (not actor or actor.is_arbiter()):
            self.cfg.on_start()
            self.logger = self.cfg.configured_logger()
            if not actor:
                actor = pulsar.arbiter(cfg=self.cfg.clone())
            else:
                self.update_arbiter_params(actor)
            self.cfg.set('exc_id', actor.cfg.exc_id)
            if self.on_config(actor) is not False:
                start = Future(loop=actor._loop)
                actor.bind_event('start', partial(self._add_monitor, start))
                return start
            else:
                return
        raise ImproperlyConfigured('Already started or not in arbiter domain')
开发者ID:huobao36,项目名称:pulsar,代码行数:35,代码来源:__init__.py


示例15: test_NOT_DONE

 def test_NOT_DONE(self):
     worker = pulsar.get_actor()
     loop = pulsar.get_request_loop()
     count = loop.num_loops
     yield pulsar.NOT_DONE
     self.assertEqual(loop.num_loops, count+1)
     yield pulsar.NOT_DONE
     self.assertEqual(loop.num_loops, count+2)
开发者ID:BazookaShao,项目名称:pulsar,代码行数:8,代码来源:me.py


示例16: testFakeSignal

 def testFakeSignal(self):
     arbiter = pulsar.get_actor()
     self.assertTrue(arbiter.is_arbiter())
     # Now put the signal in the queue
     arbiter.signal_queue.put('foooooo')
     self.assertTrue(arbiter.signal_queue.qsize() >= 1)
     # we need to yield so that the arbiter has a chance to process the signal
     yield pulsar.NOT_DONE
开发者ID:cyberj,项目名称:pulsar,代码行数:8,代码来源:arbiter.py


示例17: test_arbiter_mailbox

 def test_arbiter_mailbox(self):
     arbiter = pulsar.get_actor()
     mailbox = arbiter.mailbox
     self.assertFalse(hasattr(mailbox, 'request'))
     # Same for all monitors mailboxes
     for monitor in arbiter.monitors.values():
         mailbox = monitor.mailbox
         self.assertFalse(hasattr(mailbox, 'request'))
开发者ID:axisofentropy,项目名称:pulsar,代码行数:8,代码来源:arbiter.py


示例18: testMeta

 def testMeta(self):
     app = yield get_application(self.name())
     self.assertEqual(app.name, self.name())
     monitor = get_actor().get_actor(app.name)
     self.assertTrue(monitor.is_running())
     self.assertEqual(app, monitor.app)
     self.assertEqual(str(app), app.name)
     self.assertEqual(app.cfg.bind, '127.0.0.1:0')
开发者ID:JinsongBian,项目名称:pulsar,代码行数:8,代码来源:tests.py


示例19: testNOT_DONE

 def testNOT_DONE(self):
     worker = pulsar.get_actor()
     count = worker.requestloop.num_loops
     yield pulsar.NOT_DONE
     self.assertFalse(worker.requestloop._callbacks)
     self.assertEqual(worker.requestloop.num_loops, count+1)
     yield pulsar.NOT_DONE
     self.assertEqual(worker.requestloop.num_loops, count+2)
开发者ID:cyberj,项目名称:pulsar,代码行数:8,代码来源:me.py


示例20: test_testsuite

 def test_testsuite(self):
     app = pulsar.get_actor().app
     self.assertTrue(app.script)
     #self.assertEqual(app.script, sys.argv[0])
     self.assertEqual(os.path.dirname(app.script), app.root_dir)
     self.assertEqual(app.cfg.modules, ('tests',
                                       ('examples', 'tests'),
                                       ('examples', 'test_*')))
开发者ID:BazookaShao,项目名称:pulsar,代码行数:8,代码来源:loader.py



注:本文中的pulsar.get_actor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pulsar.get_application函数代码示例发布时间:2022-05-25
下一篇:
Python pulsar.coroutine_return函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap