Select to view content in your preferred language

Model runs fine in ModelBuilder but hangs in tool mode

2176
11
11-13-2018 01:24 PM
ThomasDilts
Frequent Contributor

I've got a model with iteration that runs fine from within ModelBuilder.  In fact, I'd say that it is downright zippy taking about a minute for every 5 rows in a raster attribute table.  When I run that same model as a tool using the same datasets it grinds to a halt getting hung up on iteration 3 or 4.  Specifically it is the Cell Statistics tool and I'm using feedback to save the results from one iteration and then add the results from the next iteration and so on.   I'm wondering if anyone has any idea what would be different enough between ModelBuilder and "tool mode" to account for such a large difference in performance.  I'd hate to have to share a tool with others with the caveat that it can only be run from ModelBuilder especially when it is working so well otherwise.

Thanks

-Tom Dilts

0 Kudos
11 Replies
curtvprice
MVP Esteemed Contributor

Just a wild guess, does your model have an output parameter that gets written on every iteration? This can really take a lot of time as the output layers are updated in the map on every iteration.

If you turn off adding outputs to display in Geoprocessing > Options that may help with your performance issue.

ThomasDilts
Frequent Contributor

Hi Curtis. Let me try that when I get to the office. That is a great suggestion. I've got a couple of ideas on how that problem might be remedied.

0 Kudos
ThomasDilts
Frequent Contributor

Hi Curtis.  I tried your suggestion.  It was a really good suggestion, but it still didn't work.  What I did was change the model parameters to string variables and then use those to name the output file with the feedback.  Then I just removed that variable from "add to display" in ModelBuilder.  At the same time I also made a few other changes.  I changed the Cell Statistics tool to the Plus tool and set pyramids and raster statistics to not run by default.  I suspect that the problem has to do with the iteration itself, but I still don't understand why it doesn't run in "tool mode" but does fine in "edit mode".  One thing that I will try next is try to run it in ArcCatalog since there is no map display there.  Another thought is that I should just convert the entire thing to a python script.  I'd appreciate any more thoughts, comments, ideas, or feedback that folks might have.

0 Kudos
curtvprice
MVP Esteemed Contributor

So just to be clear you did turn off add geoprocessing results to display in Geoprocessing / Options?

0 Kudos
ThomasDilts
Frequent Contributor

Hi Curtis.  Thanks for making that distinction.  Originally I had not turned off turn off add geoprocessing results to display in Geoprocessing / Options but just had removed the layer as a parameter in the model.  I've since tried running it with your suggestion of turning it off in the geoprocessing options from the geoporcessing menu in ArcMap as well, but to no avail.  My next thought is to try exporting to python and re-doing the coding for the looping (does looping ever just work straight from ModelBuilder export?).

0 Kudos
curtvprice
MVP Esteemed Contributor

OK, just wanted to make sure we're there for the good of the thread. I think Python is totally the way you want to go here because of the inherent issues of all these map or feature layers in memory.  I think  perhaps part of your issue is that you are modifying the dataset you are looping on with every iteration (the ArcCatalog crash leads me there). If you are doing this, you are likely to run into issues in Python too. In Python though it's easier to create temp datasets (or even lists or dictionaries) to store results as you go, and then have a final step to populate results. 

Hope these thoughts help.

0 Kudos
ThomasDilts
Frequent Contributor

Thanks for the tips.  It might take me a day or two because I've got to finalize the last step of the process.  I tend to start out in ModelBuilder to figure out the steps that I need to take before jumping to python (unless I know that it is going to involve a double loop).

0 Kudos
ThomasDilts
Frequent Contributor

ArcCatalog didn't work any better.  It just crashed instead of getting hung up.  The freeze/crash always happens on the first time the feedback variable is used in the second iteration.

0 Kudos
DuncanHornby
MVP Notable Contributor

Not sure if this is your issue but I will share my experience.

A few years ago I worked on a project that made extensive use of the cell statistics tool aggregating thousands of rasters. Whilst cell statistic tool would "accept" for example 3000 rasters as input (can't quite remember the actual number but in that ball park) it would grind to a halt. I over came the problem by simply doing in blocks of say 100 rasters, so for my 3000 example I ended up with 30 rasters which I then fed back into the Cell statistics tool for one final summary. This significantly reduced process time.

0 Kudos