Note that there are some explanatory texts on larger screens.

plurals
  1. POTornado celery integration hacks
    primarykey
    data
    text
    <p>Since nobody provided a solution to <a href="https://stackoverflow.com/questions/7934675/invoke-celery-task-from-tornado">this post</a> plus the fact that I desperately need a workaround, here is my situation and some abstract solutions/ideas for debate.</p> <p><strong>My stack:</strong></p> <ol> <li>Tornado</li> <li>Celery</li> <li>MongoDB</li> <li>Redis</li> <li>RabbitMQ</li> </ol> <p>My problem: Find a way for Tornado to dispatch a celery task ( solved ) and then asynchronously gather the result ( any ideas? ).</p> <p><strong>Scenario 1: (request/response hack plus webhook)</strong></p> <ul> <li>Tornado receives a (user)request, then saves in local memory (or in Redis) a { jobID : (user)request} to remember where to propagate the response, and fires a celery task with jobID</li> <li>When celery completes the task, it performs a webhook at some url and tells tornado that this jobID has finished ( plus the results )</li> <li>Tornado retrieves the (user)request and forwards a response to the (user)</li> </ul> <p>Can this happen? Does it have any logic?</p> <p><strong>Scenario 2: (tornado plus long-polling)</strong></p> <ul> <li>Tornado dispatches the celery task and returns some primary json data to the client (jQuery)</li> <li>jQuery does some long-polling upon receipt of the primary json, say, every x microseconds, and tornado replies according to some database flag. When the celery task completes, this database flag is set to True, then jQuery "loop" is finished.</li> </ul> <p>Is this efficient? </p> <p>Any other ideas/schemas?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload