I am publishing an ArcGIS geoprocessing service using a Python script tool and can't seem to figure out the correct output path to use. I would like to share the results as a map service, which means that, according to this documentation, I should not use the "in_memory/output_file" scheme.
So, my script writes to a permanent location on my server:
output_path = r"\\server\path\to\data\geodatabase.gdb"
output_layer = os.path.join(output_path, "Result")
arcpy.SetParameterAsText(1, output_layer)
But there are some issues that seem to remain.
Although the tool runs successfully in ArcMap, it fails after its published on the server with an error that says the output layer already exists.
Assuming I set the geoprocessing environments to overwrite the output, is this the behavior I want? What if there are multiple instances of the geoprocessing tool running... will they not conflict with each other when trying to read/write?
If I understand correctly, a new folder is created for each job, something like:
c:\arcgisserver\directories\arcgisjobs\%service%_gpserver\%jobid%\
I just can't figure out how I can define my output file to be placed there so that it can get pushed up in a temporary map service result.