[SoC] Report 1 - Multithread support on QGIS Processing toolbox

Marcus Santos mvcs at me.com
Fri May 29 12:53:44 PDT 2015

What do I have completed this week?

New implementation of the AlgorithmExecutor subclassing QObject. 
Mechanism to deal with crashing Algorithms: when there is an exception during the algorithm execution, a signal is emitted in order to allow the main thread to make the other thread quit.
Use signal to connect the algorithm progress signal to the setPercentage slot in the ProgressBar
In the runAlgorithm method of the Processing class I changed the code associated with the runalg in order to support multithreading. Each time that an algorithm is running through the QGIS python console, a new thread and a new instance of the algorithm executor are created. The signals of the AlgorithmExecutor are connected to the thread signal in order to quit the thread and run the algorithm when the thread starts. While the algorithm is running, the main thread waits for the algorithm to finish and then proceed to show the output (first approach).

What am I going to achieve for the next week?

Create a non-blocking version of the processing in order to make the interface not wait for the algorithm to finish.
Solve the crash when starting the new thread.

Is there any blocking issue?

QGIS seems to crash randomly when starting the new thread and, when it doesn’t crash, the output of the algorithm is None, which may indicate that the algorithm is crashing in the new thread.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/soc/attachments/20150529/2c2c1233/attachment.html>

More information about the SoC mailing list