Skip to content

Commit

Permalink
[processing] Pass algorithm configuration on run
Browse files Browse the repository at this point in the history
Because if it's not passed here, it's basically like writing it to /dev/null right from the beginning.
  • Loading branch information
m-kuhn committed Apr 9, 2018
1 parent 5b7b7be commit 9e8c995
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion python/core/processing/qgsprocessingalgorithm.sip.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ Returns true if this algorithm generates HTML outputs.
%End %End


QVariantMap run( const QVariantMap &parameters, QVariantMap run( const QVariantMap &parameters,
QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool *ok /Out/ = 0 ) const; QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool *ok /Out/ = 0, const QVariantMap &configuration = QVariantMap() ) const;
%Docstring %Docstring
Executes the algorithm using the specified ``parameters``. This method internally Executes the algorithm using the specified ``parameters``. This method internally
creates a copy of the algorithm before running it, so it is safe to call creates a copy of the algorithm before running it, so it is safe to call
Expand Down
2 changes: 1 addition & 1 deletion src/core/processing/models/qgsprocessingmodelalgorithm.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ QVariantMap QgsProcessingModelAlgorithm::processAlgorithm( const QVariantMap &pa


bool ok = false; bool ok = false;
std::unique_ptr< QgsProcessingAlgorithm > childAlg( child.algorithm()->create( child.configuration() ) ); std::unique_ptr< QgsProcessingAlgorithm > childAlg( child.algorithm()->create( child.configuration() ) );
QVariantMap results = childAlg->run( childParams, context, &modelFeedback, &ok ); QVariantMap results = childAlg->run( childParams, context, &modelFeedback, &ok, child.configuration() );
childAlg.reset( nullptr ); childAlg.reset( nullptr );
if ( !ok ) if ( !ok )
{ {
Expand Down
4 changes: 2 additions & 2 deletions src/core/processing/qgsprocessingalgorithm.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -371,9 +371,9 @@ bool QgsProcessingAlgorithm::hasHtmlOutputs() const
return false; return false;
} }


QVariantMap QgsProcessingAlgorithm::run( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool *ok ) const QVariantMap QgsProcessingAlgorithm::run( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool *ok, const QVariantMap &configuration ) const
{ {
std::unique_ptr< QgsProcessingAlgorithm > alg( create() ); std::unique_ptr< QgsProcessingAlgorithm > alg( create( configuration ) );
if ( ok ) if ( ok )
*ok = false; *ok = false;


Expand Down
2 changes: 1 addition & 1 deletion src/core/processing/qgsprocessingalgorithm.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class CORE_EXPORT QgsProcessingAlgorithm
* if you need to run algorithms from a background thread, or use the QgsProcessingAlgRunnerTask class. * if you need to run algorithms from a background thread, or use the QgsProcessingAlgRunnerTask class.
*/ */
QVariantMap run( const QVariantMap &parameters, QVariantMap run( const QVariantMap &parameters,
QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool *ok SIP_OUT = nullptr ) const; QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool *ok SIP_OUT = nullptr, const QVariantMap &configuration = QVariantMap() ) const;


/** /**
* Prepares the algorithm for execution. This must be run in the main thread, and allows the algorithm * Prepares the algorithm for execution. This must be run in the main thread, and allows the algorithm
Expand Down

0 comments on commit 9e8c995

Please sign in to comment.