Created
May 31, 2012 18:51
-
-
Save jayd3e/2845380 to your computer and use it in GitHub Desktop.
retools queue and worker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# queue.py run from the commandline | |
import time | |
from retools.queue import QueueManager | |
def insanely_slow_function(num=0): | |
previous = 1 | |
for i in range(1, num): | |
previous = previous + i | |
return previous | |
qm = QueueManager() | |
while(True): | |
qm.enqueue('dummyapp.queue:insanely_slow_function', num=100000000) | |
print("I just ran!") | |
time.sleep(40) | |
#insanely_slow_function(num=100000000) | |
# | |
# Then I just call retools-worker in another terminal | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
queue.py run from the commandline
import time
from retools.queue import QueueManager
def insanely_slow_function(num=0):
previous = 1
print "running job"
for i in xrange(1, num):
previous = previous + i
print "done with job"
return previous
qm = QueueManager()
if name == 'main':
while(True):
qm.enqueue('code:insanely_slow_function', num=100000000)
print("I just ran!")
time.sleep(40)
insanely_slow_function(num=100000000)
Then I just call retools-worker in another terminal