[QGIS-Developer] only read name and group name of processing algorithms during startup

Nyall Dawson nyall.dawson at gmail.com
Tue Mar 13 20:38:39 PDT 2018


On 13 March 2018 at 20:56, Rashad Kanavath <rashad.kanavath at c-s.fr> wrote:
> if a provier is enabled then qgis reads all algorithm's during
> startup. This involves reading descriptor files and doing all parsing
> required to make gui when user actually open algorithm (click on
> treeitem).
> So If I have like three provider enabled it takes more time to start qgis than
> usual. Even though, I might open one or two later at some point.
>
> It is not necessary here to parse "all" data during startup.  name and
> group name is only needed to fill provider-algorithm tree. This is
> true for any provider which uses descriptor files (OTB, GRASS, SAGA etc..).

Actually it's a bit trickier here -- models make things more complex
as they self-validate on creation, and need full knowledge of the
dependent algorithm's parameters and outputs.

> Issue is more about calling defineDescriptorFile() in Algorithm's
> __init__ method. And ofcourse, one cannot avoid init when adding
> algorithm and tree need to add an instance of algorithm. what can be
> done?

What I've been thinking/planning is to take advantage of task manager
here. So basically:

- on processing startup, there's no providers added
- when the qgis interface is fully loaded then we fire up a background
task which loads the providers, allowing them to fully build their
available algorithms and parameters without blocking the startup
- after the task completes, the tree is populated

I'd like to see more plugins take this approach, so that qgis can load
nice and quick and the slow stuff happens without annoying users...

Nyall


More information about the QGIS-Developer mailing list