2

Background:

Using ArcGIS Desktop 10.5.1, I've automated a task that requires three separate models to run in a particular sequence: model_1, then model_2, then model_3 (models 2 and 3 each start with an iterator, so they have to run separately).

I placed the three models (I'll call them sub-models) into a master model, and it runs correctly. I'm happy!

Question:

When the sub-models are placed in the master model, ModelBuilder does not allow me to control their processing order by connecting them as preconditions, yet they always run in the correct order. So how does ModelBuilder know which is the correct order?

I thought that the processing order might be controlled by the sub-model alpha-numeric names. However, after renaming the sub-models, the master model still runs in the correct order.

Shuffling the sub-model icons around on the screen has no influence.

However, the chronological order in which the sub-models are added to the master model does seem to control their processing order. Have I stumbled on the way to control sub-model ordering? More importantly, are there other ways to control their processing order?

A quick internet search did not turn up an answer, nor did a review of the book Getting to Know ArcGIS Modelbuilder by David W. Allen (ESRI Press, 2011).

Although the master model runs correctly, and I appear to have discovered (at least one) way to control processing order, I'm asking this question to help me better understand ModelBuilder.

enter image description here

1
  • 2
    I can't provide doc on the behavior, but my experience was execution order follows the order each item is added to the model. In the past if I wanted to "fix" and out of order execution in a scenario like this, I'd make a new model and drag pieces in, in order to achieve what I want. Additionally, I dont know that you'll get a 100% confirmed answer, just personal experiences.
    – KHibma
    Commented Dec 19, 2018 at 17:46

1 Answer 1

2

As I'm mostly sure this answer is not documented anywhere, I'll add an answer based on my experience (working on the Esri GP team for a number of years, but not directly responsible for ModelBuilder) --

It seems that the model keeps track of the order in which tools are added. If the tools are not connected, much like your example of model in a model where they aren't connected through input and output parameters, they'll be executed in the order you added them to the model. There is no way to re-order this internal index of tools. In my experience it has always been easiest to simply create a new model and drag the tools onto the canvas in the order they need to be executed.

In your example, the only way to ensure that one tool functions after another would be to expose parameters (input/outputs) and actually connect the models to each other. It's hard to say how you should do this without understanding what each model does and how they could be related to each other. I'd go as far as saying that finding a way to connect each model would be best practice vs. 3 "unconnected" models in a model. (Yes, I realize the 1 model saves clicks, but as you've discovered, you're at the mercy of the unknown execution order. 3 models in a toolbox, not inside a single model, where you instruct the user to run them in a given order would conceivably offer you more control)

1
  • Classic expert problem: The ESRI guys know tools execute in the order they are added to model, (and that add models to a sub-model is effectively adding a bunch of tools), so they never bothered to document it. Totally reasonable if you are building models one tool at a time, but makes copy-pasting from one model to another useless--unless dozens of precondition links added.
    – Mox
    Commented Aug 23, 2020 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.