Run queue processor workers from run-dev.py

(imported from commit d8977fbb899bf4a1b7e3a644a9259279ac744efd)
This commit is contained in:
Zev Benjamin 2013-10-23 13:12:03 -04:00
parent f241897c5b
commit e5470b2b66
1 changed files with 18 additions and 5 deletions

View File

@ -3,6 +3,7 @@ import optparse
import subprocess import subprocess
import signal import signal
import traceback import traceback
import sys
import os import os
from os import path from os import path
@ -43,7 +44,15 @@ base_port = 9991
manage_args = '' manage_args = ''
if options.test: if options.test:
base_port = 9981 base_port = 9981
manage_args = '--settings=zproject.test_settings' settings_module = "zproject.test_settings"
else:
settings_module = "zproject.settings"
manage_args = '--settings=%s' % (settings_module,)
os.environ['DJANGO_SETTINGS_MODULE'] = settings_module
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from zerver.worker.queue_processors import get_active_worker_queues
proxy_port = base_port proxy_port = base_port
django_port = base_port+1 django_port = base_port+1
@ -61,10 +70,14 @@ os.setpgrp()
# Pass --nostatic because we configure static serving ourselves in # Pass --nostatic because we configure static serving ourselves in
# zulip/urls.py. # zulip/urls.py.
for cmd in ['python manage.py runserver --nostatic %s localhost:%d' cmds = ['python manage.py runserver --nostatic %s localhost:%d'
% (manage_args, django_port), % (manage_args, django_port),
'python manage.py runtornado %s localhost:%d' 'python manage.py runtornado %s localhost:%d'
% (manage_args, tornado_port)]: % (manage_args, tornado_port)]
for queue in get_active_worker_queues():
cmds.append('python manage.py process_queue %s %s' %(manage_args, queue))
for cmd in cmds:
subprocess.Popen(cmd, shell=True) subprocess.Popen(cmd, shell=True)
class Resource(resource.Resource): class Resource(resource.Resource):