Exemplo n.º 1
0
 def testKeywordWorker(self):
     import tests
     self.dreque.enqueue("test", tests.test_func, tempfile=self.tempfile,
                         text="worker_test")
     worker = DrequeWorker(["test"], db=self.db)
     worker.work(0)
     self.failUnlessEqual(self._get_output(), "worker_test")
Exemplo n.º 2
0
 def testPositionalWorker(self):
     self.dreque.enqueue("test", tests.test_func, self.tempfile,
                         "worker_test")
     worker = DrequeWorker(["test"], db=self.db)
     worker.work(0)
     self.assertEqual(self._get_output(), b"worker_test")
     self.assertEqual(self.dreque.stats.get("processed"), 1)
Exemplo n.º 3
0
 def testPositionalWorker(self):
     import tests
     self.dreque.enqueue("test", tests.test_func, self.tempfile, "worker_test")
     worker = DrequeWorker(["test"], "127.0.0.1", db=self.db)
     worker.work(0)
     self.failUnlessEqual(self._get_output(), "worker_test")
     self.failUnlessEqual(self.dreque.stats.get("processed"), 1)
Exemplo n.º 4
0
def main():
    if os.path.isdir('/var/run'):
        pidfile = open('/var/run/build_consumer.pid', 'w')
        pidfile.write(str(os.getpid()))
        pidfile.close()
    brickconfig = BrickConfig()
    worker = DrequeWorker(['build'], brickconfig.get('redis', 'redis-server'))
    worker.work()
Exemplo n.º 5
0
 def testKeywordWorker(self):
     import tests
     self.dreque.enqueue("test",
                         tests.test_func,
                         tempfile=self.tempfile,
                         text="worker_test")
     worker = DrequeWorker(["test"], db=self.db)
     worker.work(0)
     self.assertEqual(self._get_output(), b"worker_test")
Exemplo n.º 6
0
def consume_taskqueue():
    worker = DrequeWorker(["queue"], (ip,6379),db=6)
    worker.work(0.0001)#TODO:why use 0 will escape,only execute once?
Exemplo n.º 7
0
 def worker():
     logging.getLogger("dreque.worker").setLevel(logging.CRITICAL)
     w = DrequeWorker(["test"], db=self.db)
     w.work(0.1)
Exemplo n.º 8
0
 def worker():
     import logging
     logging.getLogger("dreque.worker").setLevel(logging.CRITICAL)
     w = DrequeWorker(["test"], "127.0.0.1", db=self.db)
     w.work(0)
Exemplo n.º 9
0
 def testKeywordWorker(self):
     import tests
     self.dreque.enqueue("test", tests.set_something, val="worker_test")
     worker = DrequeWorker(["test"], "127.0.0.1", nofork=True)
     worker.work(0)
     self.failUnlessEqual(tests.something, "worker_test")
Exemplo n.º 10
0
 def worker():
     w = DrequeWorker(["test"], db=self.db)
     w.work(0)
Exemplo n.º 11
0
def worker():
    #import logging
    #logging.getLogger("dreque.worker").setLevel(logging.CRITICAL)
    w = DrequeWorker(["queue"], (ip,6379),db=6)
    w.work(0.01)#队列轮询间隔的时间,默认是5s
Exemplo n.º 12
0
 def worker():
     w = DrequeWorker(["test"], db=self.db)
     w.work(0)
Exemplo n.º 13
0
 def worker():
     logging.getLogger("dreque.worker").setLevel(logging.CRITICAL)
     w = DrequeWorker(["test"], db=self.db)
     w.work(0.1)
Exemplo n.º 14
0
 def worker():
     w = DrequeWorker(["test"], "127.0.0.1", db=self.db)
     w.work(0)
Exemplo n.º 15
0
def main():
    brickconfig = BrickConfig()
    worker = DrequeWorker(['build'], brickconfig.get('redis', 'redis-server'))
    worker.work()
Exemplo n.º 16
0
from dreque import DrequeWorker
from redis import StrictRedis


def long_crypt_job(rand, uid):
    print 'request uid: %d' % uid
    result = 1
    for i in range(1, rand):
        result *= i
    print 'job done: %d! = %s\n' % (rand, result)
    StrictRedis().set(uid, result)

worker = DrequeWorker(['queue'], 'localhost')
worker.work()
Exemplo n.º 17
0
def main():
    brickconfig = BrickConfig()
    worker = DrequeWorker(['build'], brickconfig.get('redis', 'redis-server'))
    worker.work()