Forums

long process (again)

Hello,

I have an application that works well locally. The web interface provides form that "creates" a regular system command (bash or sh) that takes long time to run (sometimes 10min). I was locally using psutil.Popen(...) to run and track them via their PID (to be able to kill them, for example), and this was working fine.

This was not working on PA: the same issue as described in this thread. I thus need to find another solution.

I was thinking to use the Queue module e.g. this PA thread. My web app would thus append my system command line to the queue, while an external worker -- as described [in this PA thread] (https://help.pythonanywhere.com/pages/LongRunningTasks/) -- would burn it in an infinite loop.

Would this be OK? If i have bought several workers on PA, Would this solution allow me to process several tasks in parallel?

Thanks

[edit: Improve links and fixed typos]

Maybe a more robust solution would be that my web app would write the command lines to run in a text file, then an external worker as described in this PA thread, would parse and execute command lines found.

In this case, should the external worker use multiprocess.Queue to run the command lines? Would that work on PA clusters?

Thanks

Hi esonix, that would work yes, on the task servers you can use multiprocessing all you like...