Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (gunicorn) ~/mess/gunicorn $ cat tornado_app.py
- from tornado.web import RequestHandler, asynchronous, Application
- from tornado.ioloop import IOLoop
- import time
- from datetime import timedelta
- import os
- class MainHandler(RequestHandler):
- #@asynchronous
- def get(self):
- print "GET start"
- print "pid: "+str(os.getpid())
- #def complete_req():
- # self.write("Hello, world.<br>pid: "+str(os.getpid()))
- # self.finish()
- # print "GET actual finish"
- #IOLoop.instance().add_timeout(timedelta(0, 5), complete_req)
- time.sleep(3)
- self.write("Hello, world.<br>pid: "+str(os.getpid()))
- print "GET finish"
- app = Application([
- (r"/", MainHandler)
- ])
- (gunicorn) ~/mess/gunicorn $ gunicorn -k tornado tornado_app:app -w 4
- 2014-04-12 20:57:52 [30465] [INFO] Starting gunicorn 18.0
- 2014-04-12 20:57:52 [30465] [INFO] Listening at: http://127.0.0.1:8000 (30465)
- 2014-04-12 20:57:52 [30465] [INFO] Using worker: tornado
- 2014-04-12 20:57:52 [30474] [INFO] Booting worker with pid: 30474
- 2014-04-12 20:57:52 [30475] [INFO] Booting worker with pid: 30475
- 2014-04-12 20:57:52 [30476] [INFO] Booting worker with pid: 30476
- 2014-04-12 20:57:52 [30477] [INFO] Booting worker with pid: 30477
- GET start
- pid: 30474
- GET finish
- GET start
- pid: 30474
- GET finish
- GET start
- pid: 30474
- GET finish
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement