Skip to content

Instantly share code, notes, and snippets.

Avatar

najeira

View GitHub Profile
@methane
methane / gist:2185380
Created Mar 24, 2012
Tornado Example: Delegating an blocking task to a worker thread pool from an asynchronous request handler
View gist:2185380
from time import sleep
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.web import Application, asynchronous, RequestHandler
from multiprocessing.pool import ThreadPool
_workers = ThreadPool(10)
def run_background(func, callback, args=(), kwds={}):
def _callback(result):
You can’t perform that action at this time.