Model Builder crashes, and if I restartit it REiterates the tables

120
5
05-11-2020 08:57 PM
TatianaVlad
New Contributor

Hello, I am iterating output tables from a previous model builder. These models are running for a week or more, so the outputs are numerous.

I need to iterate the output  tables for grid name and totals. Sometimes the  parsing model crashes (IT updates).If I restart the model builder it reiterates the tables that were already updated with the grid name and totals.

Does anyone know how I can skip the updated tables ( I get the message that  the "Grid name already exists"), so it tales a lot of time to run everything from scratch. My  Python level is enthusiastic beginner, but I can run basic geoprocesss in Python.  Thank you.

Tags (1)
0 Kudos
5 Replies
DavidPike
MVP Frequent Contributor

I really don't think any complex or intensive tasks should be done in model builder, it's flaky and often more convoluted than a python script.

It seems like some simple logic (if there's a file there already --> skip it! kind of stuff) would ease your burdens.

If you don't want to go whole hog you could insert little scripts into your model and go from there.

Happy to help you if you need.

0 Kudos
TatianaVlad
New Contributor

Thanks for your answer. I do rely heavily on Model Builder to run complex geoprocesses for many years.  I would love to be more proficient in Python, but I don't know where to start.

0 Kudos
DavidPike
MVP Frequent Contributor

Maybe a small script could be added to prevent re-iteration of the outputs, a simple logic test at the start. I'd need to see what the model looks like, or a fair description if you cannot share it.

0 Kudos
TatianaVlad
New Contributor

I saved the model as a Python script and the model looks like this:

# -*- coding: utf-8 -*-"""Generated by ArcGIS ModelBuilder on : 2020-05-11 22:07:16"""import arcpyfrom sys import argvdef # NOT IMPLEMENTED# Function Body not implementeddef Model4(DIMPRISK_Area="C:\\Users\\u33979\\Documents\\ArcGIS\\Projects\\MyProject8\\MyProject8.gdb"😞 # Parse_Table # To allow overwriting outputs change overwriteOutput option to True. arcpy.env.overwriteOutput = False for DIMP_RiskAreas, Name in # NOT IMPLEMENTED(DIMPRISK_Area, "", "", "NOT_RECURSIVE"): # Process: Add Field (2) (Add Field) DIMP_RiskAreas_4_ = arcpy.AddField_management(in_table=DIMP_RiskAreas, field_name="Totals", field_type="DOUBLE", field_precision=None, field_scale=None, field_length=None, field_alias="", field_is_nullable="NULLABLE", field_is_required="NON_REQUIRED", field_domain="")[0] # Process: Add Field (Add Field) DIMP_RiskAreas_3_ = arcpy.AddField_management(in_table=DIMP_RiskAreas_4_, field_name="GridName", field_type="TEXT", field_precision=None, field_scale=None, field_length=50, field_alias="Grid Name", field_is_nullable="NULLABLE", field_is_required="NON_REQUIRED", field_domain="")[0] # Process: Parse_Path (Parse Path) # Parse Path Utility is not implemented # Process: Calculate Field (Calculate Field) if Value: A1100161232_LegacyPlasticServicesSectiions = arcpy.CalculateField_management(in_table=DIMP_RiskAreas_3_, field="GridName", expression=f"\"{Value}\"", expression_type="PYTHON3", code_block="", field_type="TEXT")[0] return A1100161232_LegacyPlasticServicesSectiionsif __name__ == '__main__': # Global Environment settings with arcpy.EnvManager(scratchWorkspace=r"C:\Users\u33979\Documents\ArcGIS\Projects\MyProject8\MyProject8.gdb", workspace=r"C:\Users\u33979\Documents\ArcGIS\Projects\MyProject8\MyProject8.gdb"😞 Model4(*argv[1:])

0 Kudos
DavidPike
MVP Frequent Contributor

Either my eyes are not what they used to be or the picture is illegible. If you explain the process then people are better equiped to help you.

0 Kudos