gis_tech

Geodatabase not getting updated - No errors returned

Discussion created by gis_tech on Jun 2, 2014
I've got a geoprocessing service based on a python script. The script works great from ArcGIS Desktop but when run as a geoprocessing service, it does not update the geodatabase. It also does not provide any errors and I'm not seeing anything helpful in the server logs.

Here's what it does perfectly from the desktop:

1) Receive a username and street address.
2) Geocode that address to an XY coordinate using ArcGIS Online.
3) Write the data to a feature class in a file geodatabase.
4) Use Intersect_analysis to combine this data with a totally unrelated data set in another geodatabase.
5) Use Append_management to concatenate this new row of data onto a final feature class.

When I publish this script a geoprocessing tool, it simply doesn't work - at least not completely. All I get by way of user feedback from the REST endpoint is the following:

Job Status:  esriJobSucceeded
Results:  None

The geodatabase does not get updated. This seems like it might be a permissions issue, so here's what I've done:

1) Registered the geodatabase in ArcGIS Server Manager.
2) Gave the ArcGIS User account Read, Write, and Modify permissions on the directory which contains the geodatabase.

FWIW, my code is below. Any help would be much, much appreciated!

# Import arcpy module
import arcpy, os

arcpy.AddMessage("Starting the script...")

varWorkingDirectory = r"C:\Data\GISData\SalesForceDemo"
#varWorkingDirectory = os.getcwd()

# Capture the user input
varCustomerName = arcpy.GetParameterAsText(0)
varAddress = arcpy.GetParameterAsText(1)
varCity = arcpy.GetParameterAsText(2)
varState = arcpy.GetParameterAsText(3)
varZip = arcpy.GetParameterAsText(4)

# Delete any old data in the TestAddresses table
arcpy.AddMessage("Deleting any old data in the TestAddresses table...")

try:
    rows = arcpy.UpdateCursor(varWorkingDirectory + r"\SFTest.gdb\TestAddresses")
    for row in rows:
        rows.deleteRow(row)
        del row
    del rows
except:
    arcpy.AddMessage("Could not delete the old data from TestAddresses.")


# Insert the new data into the TestAddresses table so that it can be geoprocessed
arcpy.AddMessage("Inserting new data into the TestAddresses table...")

try:
    rows = arcpy.InsertCursor(varWorkingDirectory + r"\SFTest.gdb\TestAddresses")

    row = rows.newRow()
    row.Name = varCustomerName
    row.Address =varAddress
    row.City = varCity
    row.State = varState
    row.Zip = varZip
    rows.insertRow(row)

    # Delete cursor and row objects to remove locks on the data 
    del row 
    del rows
except:
    arcpy.AddMessage("Could not insert the new data into TestAddresses.")

# Delete the old output feature classes
arcpy.AddMessage("Deleting the old output feature classes...")

try:
    arcpy.Delete_management(varWorkingDirectory + r"\SFTest.gdb\CompletedGeocodingResults")
    arcpy.Delete_management(varWorkingDirectory + r"\SFTest.gdb\CompletedGeocodingResults_In")
except:
    arcpy.AddMessage("Could not delete the old data from CompletedGeocodingResults and CompletedGeocodingResults_In.")

# Local variables:
TestAddresses = varWorkingDirectory + r"\SFTest.gdb\TestAddresses"
World_GeocodeServer = "GIS Servers\\arcgis on geocode.arcgis.com (user)\\World.GeocodeServer"
RadonNew = "C:\\Data\\GISData\\ROE\\NewRadonData.gdb\\RadonNew"
CompletedGeocodingResults = varWorkingDirectory + r"\SFTest.gdb\CompletedGeocodingResults"
FinalGeocodingResultsWithRadon = varWorkingDirectory + r"\SFTest.gdb\CompletedGeocodingResults_In"

# Process: Geocode Addresses
try:
    arcpy.GeocodeAddresses_geocoding(TestAddresses, World_GeocodeServer, "Address Address VISIBLE NONE;Neighborhood <None> VISIBLE NONE;City City VISIBLE NONE;Subregion <None> VISIBLE NONE;Region State VISIBLE NONE;Postal Zip VISIBLE NONE;PostalExt <None> VISIBLE NONE;CountryCode <None> VISIBLE NONE", CompletedGeocodingResults, "STATIC")
except:
    arcpy.AddMessage("Could not perform GeocodeAddresses_geocoding.")

# Process: Intersect
arcpy.AddMessage("Performing Intersect_analysis...")

try:
    arcpy.Intersect_analysis(varWorkingDirectory + r"\SFTest.gdb\CompletedGeocodingResults #;C:\Data\GISData\ROE\NewRadonData.gdb\RadonNew #", FinalGeocodingResultsWithRadon, "ALL", "", "INPUT")
except:
    arcpy.AddMessage("Could not perform Intersect_analysis.")

# Append the new data onto the master featureclass
# Append_management (inputs, target, {schema_type}, {field_mapping}, {subtype})

arcpy.AddMessage("Performing Append_management...")

try:
    arcpy.Append_management(varWorkingDirectory + r"\SFTest.gdb\CompletedGeocodingResults_In", r"\SFTest.gdb\FinalGeocodingResults", "TEST","","")
except:
    arcpy.AddMessage("Could not perform Append_management.")


Outcomes