mercredi 6 juillet 2016

Django call function and don't wait for it to end

I need an advice on the most efficient way to have a function at Django server give a return, but keep running. Basically, I have a file uploader view, that gets the file, and a parser function called by the view. Since the files (Excel tables) might be quite big, the parser can take a long time to finish. The view will not render any result waiting for the parser to finish, and the page will eventually show 503, but really once the file is uploaded, I can safely close the page and keep working with the site, while the parser sends messages on its progress into the chat. What I need is for the view to render a page saying 'upload complete' once it got the file, then call the parser. Multitasking and async processing solutions that I was able to google look either not exacly fitting for the task, or a bit of an overkill. So, any recommendations (with small examples, if possible)?

Aucun commentaire:

Enregistrer un commentaire