Thursday 26 February 2015

arcpy - ArcGIS Geoprocessing Script runs fine in Desktop but crashes as Geoprocessing Service?


I have a small and simple geoprocessing script that I am trying to expose as a geoprocessing service in ArcGIS Server 10 SP4. The script is below. Pardon the hard-coding...


With the hard-coded variables, this script runs perfectly fine in desktop. However, once published as gp service, it crashes in a bad way, like I can't even trap the error. The exact message in the GIS Server log - "Container process 6436 has crashed on machine westchamp24-pc."


A couple of potential causes I can eliminate right off the bat:



  1. Permissions: The entire D: drive is wide open to the 'Everyone' user


  2. Licensing: ArcGIS Server is licensed at Enterprise level


    # Check out the ArcGIS Spatial Analyst extension license
    arcpy.CheckOutExtension("Spatial")


    # Execute CostDistance
    outCostDistance = CostDistance("origin",SOURCE,"#","D:/RasterStuff/backlinkRaster.tif")

    # Execute CostPath
    outCostPath = CostPath("destination", outCostDistance,"D:/RasterStuff/backlinkRaster.tif")

    # Convert Result to Polyline
    arcpy.RasterToPolyline_conversion(outCostPath, "D:/RasterStuff/costPath.shp")
    featSet = arcpy.FeatureSet()

    featSet.load("in_memory/costPath")

    arcpy.SetParameter(0,featSet)

    except: # do stuff with error print finally: print





Answer



I found that when I reverting back to arcgisscripting (instead of arcpy), the gp service works fine...


My code in this script is pretty vanilla - scraped almost entirely from ESRI site, so I have no idea what could be causing the problem.



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...