So after reading through multiple docs and answers. This is my understanding:
QgsProcessingAlgorithm.postProcessAlgorithm()
You can do anything here related to canvas or not, literally almost anything. This runs first after the processAlgorithm
in QgsProcessingAlgorithm
. This is the part of QgsProcessingAlgorithm
class.
QgsProcessingLayerPostProcessorInterface.postProcessLayer()
On the other hand this is not part of the QgsProcessingAlgorithm
class and is run after QgsProcessingAlgorithm
is completely finished. It does not do anything apart from attaching its postProcessLayer
function to the layer on which it was added. (the function is not executed here)
When QGIS natively outputs layers after the algorithm is finished, it will apply the postProcessLayer
function as the last step.