Ejemplo n.º 1
0
def testspeed(total=1):
    p = Pubsub(listen=False)
    j = p.job("jobtest")
    start = time.time()
    for x in range(1,total+1):
        j.publish(x)
    tt = time.time() - start
    print tt, total / tt
Ejemplo n.º 2
0
def testspeed(total=1):
    p = Pubsub(listen=False)
    j = p.job("jobtest")
    start = time.time()
    for x in range(1, total + 1):
        j.publish(x)
    tt = time.time() - start
    print(tt, total / tt)
Ejemplo n.º 3
0
def runjobs(listen=False):
    p = Pubsub()
    job_channel = p.job("jobtest")
    x = 0
    starttime = time.time()
    while True:
        id, query = job_channel.get()
        #if x%2:
        job_channel.finish(id, query)
        x += 1
        if time.time() > starttime + 1.0:
            print("%d/sec" % x)
            x = 0
            starttime = time.time()
Ejemplo n.º 4
0
def runjobs(listen=False):
    p = Pubsub()
    job_channel = p.job("jobtest")
    x = 0
    starttime = time.time()
    while True:
        id, query = job_channel.get()
        # if x%2:
        job_channel.finish(id, query)
        x += 1
        if time.time() > starttime + 1.0:
            print "%d/sec" % x
            x = 0
            starttime = time.time()
Ejemplo n.º 5
0
from flask import Flask, render_template, redirect, request
from thoonk import Pubsub

app = Flask(__name__)
# can specify redis host here , meanwhile piggyback on localhost
app._pubsub = Pubsub(listen=False)

from WorkFlowManagerAPI.app.controllers import notification_controller
Ejemplo n.º 6
0
from thoonk import Pubsub

p = Pubsub()
n = p.feed("test")
id = n.publish("hayyyyyy", id='crap')
print(id, n.get_item(id))
q = p.queue("queue_test")
q.publish("whatever")
q.publish("shit ")
q.publish("whatever")
q.publish("whatever")
q.publish("whatever")
while True:
    try:
        print(q.get(timeout=1))
    except q.Empty:
        break
print("done")

Ejemplo n.º 7
0
 def connect(self):
     return Pubsub(host=self.host,
                   port=self.port,
                   db=self.db,
                   listen=self.listen)
Ejemplo n.º 8
0
from thoonk import Pubsub

p = Pubsub()
n = p.feed("test")
id = n.publish("hayyyyyy", id='crap')
print id, n.get_item(id)
q = p.queue("queue_test")
q.publish("whatever")
q.publish("shit ")
q.publish("whatever")
q.publish("whatever")
q.publish("whatever")
while True:
    try:
        print q.get(timeout=1)
    except q.Empty:
        break
print "done"