Esempio 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")
Esempio 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)
Esempio 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)
Esempio 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()
Esempio 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")
Esempio 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?
Esempio n. 7
0
 def worker():
     logging.getLogger("dreque.worker").setLevel(logging.CRITICAL)
     w = DrequeWorker(["test"], db=self.db)
     w.work(0.1)
Esempio 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)
Esempio 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")
Esempio n. 10
0
 def worker():
     w = DrequeWorker(["test"], db=self.db)
     w.work(0)
Esempio 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
Esempio n. 12
0
 def worker():
     w = DrequeWorker(["test"], db=self.db)
     w.work(0)
Esempio n. 13
0
 def worker():
     logging.getLogger("dreque.worker").setLevel(logging.CRITICAL)
     w = DrequeWorker(["test"], db=self.db)
     w.work(0.1)
Esempio n. 14
0
 def worker():
     w = DrequeWorker(["test"], "127.0.0.1", db=self.db)
     w.work(0)
Esempio n. 15
0
def main():
    brickconfig = BrickConfig()
    worker = DrequeWorker(['build'], brickconfig.get('redis', 'redis-server'))
    worker.work()
Esempio 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()
Esempio n. 17
0
def main():
    brickconfig = BrickConfig()
    worker = DrequeWorker(['build'], brickconfig.get('redis', 'redis-server'))
    worker.work()