TransWikia.com

Using flags in new-style QGIS Processing Algorithms

Geographic Information Systems Asked on August 10, 2021

In QGIS 3.6+, there are two different ways to construct a Processing Algorithm.

  1. Defining a class inherited from QgsProcessingAlgorithm. In this case, I can define flags for an algorithm as follows:

    class ExampleProcessingAlgorithm(QgsProcessingAlgorithm):    
        ....    
    
        def flags(self):
            return super().flags() | QgsProcessingAlgorithm.FlagNoThreading
        ....
    
  2. Using @alg decorator.

    @alg(name='algorithm_name', ...
    @alg.input(type=alg.SOURCE, ...
    @alg.output(type=alg.NUMBER, ...
    
    def algorithm_name(instance, parameters, context, feedback, inputs):
        """
        Description of the algorithm.
        """
    
        ...
    

In @alg case, how can I set flags? There is no explanation about this in QGIS Documentation.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP