示例#1
0
文件: case.py 项目: sweemer/celery
    def managed(cls, hostname=None, caller=None):
        hostname = hostname or socket.gethostname()
        if caller:
            hostname = ".".join([qualname(caller), hostname])
        else:
            hostname += str(cls.next_worker_id())
        worker = cls(hostname)
        worker.ensure_started()
        stack = traceback.format_stack()

        @atexit.register
        def _ensure_shutdown_once():
            if not worker._shutdown_called:
                say("-- Found worker not stopped at shutdown: %s\n%s" % (worker.hostname, "\n".join(stack)))
                worker.ensure_shutdown()

        return worker
示例#2
0
文件: case.py 项目: itmustbejj/celery
    def managed(cls, hostname=None, caller=None):
        hostname = hostname or socket.gethostname()
        if caller:
            hostname = ".".join([qualname(caller), hostname])
        else:
            hostname += str(cls.next_worker_id())
        worker = cls(hostname)
        worker.ensure_started()
        stack = traceback.format_stack()

        @atexit.register
        def _ensure_shutdown_once():
            if not worker._shutdown_called:
                say("-- Found worker not stopped at shutdown: %s\n%s" %
                    (worker.hostname, "\n".join(stack)))
                worker.ensure_shutdown()

        return worker
示例#3
0
 def test_qualname(self):
     Class = type("Fox", (object, ), {"__module__": "quick.brown"})
     self.assertEqual(utils.qualname(Class), "quick.brown.Fox")
     self.assertEqual(utils.qualname(Class()), "quick.brown.Fox")
示例#4
0
 def test_qualname(self):
     Class = type("Fox", (object, ), {"__module__": "quick.brown"})
     self.assertEqual(utils.qualname(Class), "quick.brown.Fox")
     self.assertEqual(utils.qualname(Class()), "quick.brown.Fox")
示例#5
0
 def test_evalutes_qualnames(self):
     self.assertEqual(prepare(qualname(MyAnnotation))[0]().foo, 65)
     self.assertEqual(prepare([qualname(MyAnnotation)])[0]().foo, 65)
示例#6
0
 def test_evalutes_qualnames(self):
     self.assertEqual(prepare(qualname(MyAnnotation))[0]().foo, 65)
     self.assertEqual(prepare([qualname(MyAnnotation)])[0]().foo, 65)