display the right error when a worker can't be used.

This commit is contained in:
benoitc 2010-10-28 06:05:01 +02:00
parent f92a5409f5
commit 47e87df132
4 changed files with 18 additions and 6 deletions

View File

@ -117,7 +117,12 @@ class Application(object):
raise
self.configure_logging()
Arbiter(self).run()
try:
Arbiter(self).run()
except RuntimeError, e:
sys.stderr.write("\nError: %s\n\n" % e)
sys.stderr.flush()
sys.exit(1)
def configure_logging(self):
"""\

View File

@ -7,8 +7,10 @@ from __future__ import with_statement
import os
import eventlet
try:
import eventlet
except ImportError:
raise RuntimeError("You need eventlet installed to use this worker.")
from eventlet import hubs
from eventlet.greenio import GreenSocket

View File

@ -12,8 +12,10 @@ import sys
if sys.platform == "darwin":
os.environ['EVENT_NOKQUEUE'] = "1"
import gevent
try:
import gevent
except ImportError:
raise RuntimeError("You need gevent installed to use this worker.")
from gevent.pool import Pool
from gevent.server import StreamServer
from gevent import pywsgi, wsgi

View File

@ -6,7 +6,10 @@
import os
import sys
import tornado.web
try:
import tornado.web
except ImportError:
raise RuntimeError("You need tornado installed to use this worker.")
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop, PeriodicCallback
from tornado.wsgi import WSGIContainer