Select to view content in your preferred language

Geoprocessing Service not able to add to feature class in SDE

666
1
03-24-2020 11:22 AM
BrentSlone3
Occasional Contributor

I have a python script that I have published as a geoprocessing service.

The python script takes a CSV file and updates a Point Feature Class in Microsoft SQL SDE.

import arcpy, csv, random, time
arcpy.env.workspace = r"E:\SDECon\CPR.sde"
# Read csv file with names
csvFile = arcpy.GetParameterAsText(0)
#csvFile = r'E:\SampleDataV1.csv'
reader = csv.reader(open(csvFile, "rb"), delimiter = ",", skipinitialspace=True)

row_values = []
for i, line in enumerate(reader):
print 'line[{}] = {}'.format(i, line)
print((line[0],line[1]),line[2],line[3])
row_values.append([(float(line[0]),float(line[1])),line[2],int(line[3])])
print(row_values)

# # Open an InsertCursor
cursor = arcpy.da.InsertCursor(r'E:\SDECon\CPR.sde\CPR.DBO.GurDevOfflinePointV1',
['SHAPE@XY',"UserIdentify","DateTimeLocation"])
for row in row_values:
cursor.insertRow([row[0],row[1],time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(row[2]))])
print([row[0],row[1],time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(row[2]))])

After publishing this a geoprocessing service I ran it using Web appbuilder geoprocessing widget.

The service fails I checked the error logs on the service and I get the following info:

Error executing tool. OfflineEditingScript Job ID: j43e4134db18346febdcaf33f8d80fc03 : Traceback (most recent call last): File "C:\arcgisserver\directories\arcgissystem\arcgisinput\Gurminder\OfflineEditingScriptV7.GPServer\extracted\v101\offlineediting\pathTracker.py", line 26, in ['SHAPE@XY',"UserIdentify","DateTimeLocation"]) RuntimeError: cannot open 'C:\arcgisserver\directories\arcgissystem\arcgisinput\Gurminder\OfflineEditingScriptV7.GPServer\extracted\v101\CPR.sde\CPR.DBO.GurDevOfflinePointV1' Failed to execute (OfflineEditingScript). Failed to execute (OfflineEditingScript).

It looks like it create a copy of SDE connection file on ArcGIS Server directories. I have made sure that SDE is registered with ArcGIS Server. However even after registereing the feature class it still creates a copy on ArcGIS server.

Any suggestions would be appreciated.

Thank you for your time.

0 Kudos
1 Reply
Strahanjen
Frequent Contributor

Hi Brent, 

I'm having the same issue. I wonder if you have a solution that you can share?

Thanks,

Jennifer

0 Kudos