Model performance issue

2135
14
04-06-2017 07:53 AM
TimWitt2
MVP Alum

Hey everybody,

I am working on a Model in which you can use your current street centerline file and transform it into a NENA standard street centerline file. This includes having a lot of drop down boxes and check boxes. It seems the more drop down boxes and checkboxes I use, the more my model takes to respond.

I was wondering if anyone has any suggestions to enhance the performance? 

Thanks,

Tim

Tags (2)
0 Kudos
14 Replies
TimWitt2
MVP Alum

Again great information! Your code was really helpful!!!

I think this is what you meant.

Once they are done filling it out it will run through the "Add field" and "Calculate field" code.

DuncanHornby
MVP Notable Contributor

Yeah that was what I was envisaging. Don't know and not tried it but if your inputs always have the same  NENA field names you could try populating the first column and then it is up to the user to match the field name in "your field"?

Your code would then read from the value table the rows with values and process accordingly or you take the approach of starting with an empty table and they add just the fields that need processing? What ever works best for your logic.

Either way the interface will be much more responsive.

TimWitt2
MVP Alum

As you mentioned in your first paragraph, the Nena fields will be set fields. I will populate the first column with the Nena field names and the user will match their street field, with the corresponding Nena field name.

Now my next challenge will be how I access the values that the user chose and match them up with my calculate field code.

0 Kudos
curtvprice
MVP Esteemed Contributor

The slowness we see with big models with lots of tools and parameters is caused by the need for ModelBuilder to validate all the parameters for all the tools. This validation is very helpful when putting together a workflow but when many tools and parameters (including those in nested models) are there, it requires a LOT of validation, and, well, that takes time. 

I disagree that it is all or nothing. A middle way I have found when I am running into parameter validation problems or very slow validation is to take some of the workflow and convert it to a Python function inside the Calculate Value tool. This hides that workflow from ModelBuilder's  slow (and sometimes buggy) parameter validation.

If the tool has a extensive, complex input like the ones Tim is working with, I'll use model builder to test to get the parameters I want, then export model to script to get the python code written for me. Then I can use that code, either in Calculate Value or in a script tool.

However, from where this thread went it is obvious Tim does need a .pyt for this job so he can do the value table thing. But he figured out a lot of his workflow using ModelBuilder!

TimWitt2
MVP Alum

Great post Curtis! You are right, without model builder I wouldn't have known how to structure my python code. Not to mention, I didn't have to write many lines of code by exporting the model to python. Now I can just copy paste it into my python toolbox.

0 Kudos