Bug report #19857

Processing models containing other processing models (aka nested models) cannot be run

Added by Olivier Dalang over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Processing/Modeller
Affected QGIS version:3.3(master) Regression?:No
Operating System:Windows 10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:27681

Description

Hi !

When adding a processing model as an algorithm inside another processing model, the parent algorithm cannot be run. This is a shame, as nesting algorithm is a really neat way to break down complex models to more manageable units.

The following message appears when trying to execute the algorithm :

This algorithm cannot be run :-( 
The model you are trying to run contains an algorithm that is not available: model:A

Steps to reproduce

1. Create a processing model (with a vector layer input and layer output)
2. Save it.
3. Create a second processing model (with a vector layer input, the first algorithm, a layer output)
4. Save it.
5. Double click on the second processing model from the toolbox.

You get the error message.

Cheers,

Olivier

Associated revisions

Revision 17326541
Added by Nyall Dawson over 5 years ago

[processing] Add method to attempt to reattach model children to linked algorithms

Refs #19857

Revision cdd72e51
Added by Nyall Dawson over 5 years ago

[processing] Fix use of models as child algorithms in other models

Fixes #19857

History

#1 Updated by Giovanni Manghi over 5 years ago

  • Regression? changed from No to Yes
  • Priority changed from Normal to High

This works on 2.18, so regression.

#2 Updated by Olivier Dalang over 5 years ago

  • Status changed from Open to Closed

Hmm testing again, I can't reproduce with the steps described above...

It seemed triggered by saving two models with the same name (which is obviously a bad idea but is doable). I'll try to come up with exact steps to reproduce tomorrow.

#3 Updated by Olivier Dalang over 5 years ago

  • Status changed from Closed to Reopened

Ok here are the steps to reproduce :

1. Create a processing model
2. Save it with name "test" group "group-1".
3. Create a second processing model (add "test" to the model)
4. Save it.
5. Create a third processing model.
6. Save it with name "test" group "group-2"
5. Double click on the second processing model from the toolbox.

You get the error message.

So it looks like the cause is name clashes in processing models.

Those name clashes are very easy to make, as the group isn't taken into account to set the algorithm id. Adding the group in the id wouldn't be enough, as it's still possible to have two models with same group/name in different files.

Suggested fixes :

1/ use group:name as algorithm id instead of just name
2/ check before saving if the model id doesn't exist already in an other file
3/ when loading algs, display an error message if there is a name clash (showing which file was ignored)

#4 Updated by Nyall Dawson over 5 years ago

  • Status changed from Reopened to In Progress
  • Regression? changed from Yes to No
  • Priority changed from High to Normal

#5 Updated by Nyall Dawson over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

Also available in: Atom PDF