Sunday, October 8, 2017

Re: django project avoid reload page where work algorithm

For example with celery you create celery task that does the actual math. Creation of task is fast operation. Once task is created request returns.

In the background celery worker picks your task and executes it. It doesn't matter how long that takes. Once task is completed worker waits for next task.

Every task gets id which you can return to frontend and then for example using ajax call you could query if task is ready and inform user about progress or completition.


8.10.2017 6.59 ip. "Xristos Xristoou" <saxri89@gmail.com> kirjoitti:
how first to can avoid long reload ?

Τη Κυριακή, 8 Οκτωβρίου 2017 - 4:09:37 μ.μ. UTC+3, ο χρήστης Jani Tiainen έγραψε:
Hi.

For long running operatios celery tasks are pretty good choice. Celery can use rabbitmq as messaging queue so those two aren't mutually exclusive.

Once you have task running it is possible to use for example ajax polling to query status of the task and once complete inform end user that task is complete.

Or you can send email at the end of the task.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ef60530e-92c5-48a9-8f0f-266a5942a6f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHn91odNhQegmnKy1TKCQ8hwaH03P5SWV54cO_nLerw6kK9Qaw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment