I have a really basic geoprocessing script that's published to ArcGIS Server 10.2.2.
It basically just reads in a json object that's passed in as a parameter. The json just has attribute names and values, as well as a geometry in wkid 4326.
All it does is open an InsertCursor
to create features in one specific feature class.
Nevermind asking me "All you want to do is create a bunch of features, why don't you do this in the rest endpoint?" Long story short, I tried several times using the jsapi, and even building my own geometries. In both cases, I got "d is not applied."
Anyway. This Geoprocessing script does work. But sometimes I check the logs and see "SEVERE: 'Cannot open SCHEMA.FEATURECLASS'. Failed to execute (Name of GP service). Failed to execute (name of GP Service).
What would cause this?? I noticed that on times where it works, it was very early in the day (5 AM). And then someone tried to use it around 10 AM and the script fails. From my DBMS knowledge, the only reasons I can think of why someone can't open a feature class for inserting:
- Someone has a schema lock (I find this less likely since you usually can't get a schema lock on anything if the ArcGIS Server is running)
- A database transaction is in progress (I don't see any evidence of this since the only other system that loads data into this database shows no records of any loading happening around the time of the error log
- does arcpy.da.insertcursor fail to open if there's another insertcursor open simultaneously? (I hope not...)
Other info:
- This is not a versioned feature class
- The arcpy.env.workspace is set to an sde file that connects as the geodatabase admin. This connection is set to use the default version
Here are the properties on the service
#CODE SNIPPET - This is 90% of the business logic here loadCursor = arcpy.da.InsertCursor(Feature_Name, fields) oids = [] for feature in FeaturesToAdd: geom = feature["geometry"] point = (geom["x"], geom["y"]) attributes = feature["attributes"].values() attributes.append(point) row = tuple(attributes) print len(row) oid = loadCursor.insertRow(row) oids.append(oid) del loadCursor print oids
What else would cause arcpy not to be able to open a feature class for inserting?
Here's the basic code snippet for doing that:
loadCursor = arcpy.da.InsertCursor('SCHEMA.FEATURECLASS', ['field1','field2', 'field3', 'shape@XY']
there's nothing else that opens up any cursors, lists fields, queries the db. etc. This is the only line (not including loadCursor.insertRow()
)