Updating the client completing the celery task

I have the following requirement. I am creating a web application (without an interface) that will receive mail and receive requests. Its functionality will be next. The client will post to the URL that launches a large and costly task. The client will also be able to make a Get request and get taks results.

I thought of using celery to start the assignment. The task is a very large arithmetic calculation. My problem is how to notify the client of the completion of a given task, and he can get the result.

So, I thought like this:

client ->posts to web app -> web app starts task to celery -> request closed

web app notifies -> client triggered task  # what is the proper way

client -> get request to web app -> web app returns result

I know that there is no suitable way, so I will be more specific. Currently, the task will be launched using another application for flasks automatically. Is there a way in which the flask application will be automatically notified of the completion of the task and receiving the results and saving them in its own database? And the second question is what will be the most common solution that will work, even if the client is a flash application, Android application and IOS application, etc.

The reason I also ask is because I had a discussion about whether an api message should return results to a client or client in order to respond and receive results.

+4
source share
1 answer

, . :

  • - . , . , . , . , .
  • WebSockets. WebSocket , , . .
  • URL- . , -. . Celery POST URL , .

, , WebSockets - Android iOS HTTP WebSockets . , Flask.

+5

Source: https://habr.com/ru/post/1617589/


All Articles