getting result in short running celery task (Django)

Artem Bernatskyi

What is the best way to implement getting result in short running celery task (3-7 seconds) ?

For now i use this method below.

  • User clicks button which send request to api - api triggers celery task and returns task_id
  • Then we are checking result of task_id via Ajax

UPDATE: question should be closed at it has no difference between getting result from long running task .

cwallenpoole

As a general rule (with all background tasks, not just Celery/Django) that's actually your best bet. The same pattern emerges

  • User makes HTTP request
  • Server kicks off background service (either through Celergy, some other async. service, or even through a command line execution (<- don't do that if you can avoid it)) and returns some form of identifier
  • User agent makes new HTTP request to get information about state of new service/process.

You should check out long polling

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related