Problem
I have written a Python C extension (ftaCalculate) in order to improve the performance of a given function that was previously written in pure Python. I have been able to increase the execution speed by a factor of x10, so no problem on this site.
import ftaCalculate
cs_min = ftaCalculate.mcs(N, tree)
However, I am executing this function in a Django framework. The problem is that, until the function ftaCalculate.mcs does not finish, I cannot do anything on my website. When the function was in Python, I could press other buttons and access other URLs.
This is specially a problem when several users are working at the same time in the website, because the other users cannot do anything while this function is being executed.
Actually, you can see in the following image that one core is at 100% when running the function:
Question
Do you know any way I could call my Python C extension without "freezing" the Django framework?
Possible workaround
In the worst case, I could try calling this part of the code with Celery. However, I would prefer another solution, since I do not need Celery when running in pure Python.
