Best way to do background calculations?

Chris Angelico rosuav at gmail.com
Sun Oct 25 22:48:23 EDT 2015


On Sat, Oct 24, 2015 at 3:35 AM, Israel Brewster <israel at ravnalaska.net> wrote:
>
> Ideally, this recalculation process would happen in the background. There is
> no need for the user to wait around while the system crunches numbers - they
> should be able to move on with entering another log or whatever else they
> need to do. To that end, I implemented the call to the recalc function using
> the multiprocessing module, so it could start in the background and the main
> process move on.

One way to get around this would be to separate the processes
completely, and simply alert the other process (maybe via a socket) to
ask it to do the recalculation. That way, the background process would
never have any of the main process's sockets, and can't affect them in
any way.

ChrisA



More information about the Python-list mailing list