AnsweredAssumed Answered

Geoprocessing Service not seeing newly added data unless restarted or republished?

Question asked by dom426 on Nov 5, 2014
Latest reply on Nov 6, 2014 by Dalshearer

I have a Geoprocessing Service that is complicated, but the issue I'm having revolves around a few very simple steps. I'm trying to take in a path to a feature class that sits within SDE, create a temporary feature layer out of it (arcpy.MakeFeatureLayer_management), and then use a search cursor (arcpy.da.SearchCursor) to count the records in the feature class. I am not using ArcMap or anything outside of arcpy for this, the layer is stored in-memory and dumped after being used. The script itself works fine up until the point that new data is added and then the results become inconsistent with the actual data.

 

Here is an example of the issue:

  1. Feature Class has 0 records.
  2. The Model behind the Geoprocessing Service is run through ArcCatalog/ArcMap and returns a count of "0 records found." (OK)
  3. The Geoprocessing Service itself also returns "0 records found." (OK)
  4. 1 record is added to the Feature Class through some means in an edit session (programatically, through ArcMap, etc.)
  5. The model behind the Geoprocessing Service is run through ArcCatalog/ArcMap and still returns a count of "0 records found." (INCORRECT)
  6. The Geoprocessing Service itself also returns "0 records found." (INCORRECT)

 

The only way I've discovered that the model will display the correct record count when run from Desktop is to close/open all ArcGIS Desktop applications and re-run it. Likewise, for the Geoprocessing Service to display the correct record count, I must restart or republish the Geoprocessing Service.

 

I'm hoping this issue has a simple resolution, but I'm scratching my head over it as of right now. If someone needs sample code, I can provide it, but the first paragraph is the script in a nutshell.

Outcomes