Start multicore background process from Django view

与世无争的帅哥 提交于 2020-01-05 03:35:20

问题


I use Django to create a browser-based GUI for a multicore scientific computing library. The workflow is roughly as follows:

  1. Press "run analysis" in browser.
  2. Call django view.
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!