问题
I use Django to create a browser-based GUI for a multicore scientific computing library. The workflow is roughly as follows:
- Press "run analysis" in browser.
- Call django view.
- In the django view, call the library. For simplicity let's say like that:
execfile('/path/to/library.py')
Result: library.py runs only on a single core. However, when library.py is called from the python console (i.e. not from the browser) it uses multiple cores. Note that library.py
contains all the multicore logic itself (using the multiprocessing module, as far as i can see).
Is it possible to have library.py
use multiple cores, when started from django?
来源:https://stackoverflow.com/questions/31733676/start-multicore-background-process-from-django-view