I have been able to successfully publish a locator to our portal. Works great in a web map and in ArcGIS Pro both in the locator pane and the batch geocoding tools. Used the Create Locator tool in ArcGIS Pro 2.7.2 and published to Enterprise 10.6.1.
I am now trying to update the locator with new addresses. I have successfully used the Rebuild Address Locator tool and tested it locally in Pro to see that the new addresses are being found. However I am getting ERROR 001369: Failed to create the service whenever I try to overwrite or update the locator and geocoding service. I have tried the Overwrite Locator tool in Pro and also this Updating Geocoding Services script. I have also now downgraded to ArcGIS Pro 2.6.3 and rebuilt the locator from scratch, but am still getting the same error when overwriting.
# Execute StageService to convert sddraft file to a service definition (sd) file
arcpy.server.StageService(sddraft_file, sd_file)
# Execute UploadServiceDefinition to publish the service definition file as a service
arcpy.server.UploadServiceDefinition(sd_file, ags_connection)
arcpy.AddMessage("The geocode service was successfully published")
It does the StageService fine but is erroring on the Upload Service Definition line. Here is the full error message from the script output:
An error occured ERROR 001369: Failed to create the service.
Failed to execute (Publish Service Definition).
Failed.
Failed to execute (Publish Service Definition).
Failed.
Failed to execute (UploadServiceDefinition).
ERROR 001369: Failed to create the service.
Failed to execute (Publish Service Definition).
Failed.
Failed to execute (Publish Service Definition).
Failed.
Failed to execute (UploadServiceDefinition).
Error thrown
Traceback (most recent call last):
File "Update.py", line 235, in main
arcpy.server.UploadServiceDefinition(sd_file, ags_connection)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\server.py", line 1263, in UploadServiceDefinition
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\server.py", line 1260, in UploadServiceDefinition
retval = convertArcObjectToPythonObject(gp.UploadServiceDefinition_server(*gp_fixargs((in_sd_file, in_server, in_service_name, in_cluster, in_folder_type, in_folder, in_startupType, in_override, in_my_contents, in_public, in_organization, in_groups), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 511, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 001369: Failed to create the service.
Failed to execute (Publish Service Definition).
Failed.
Failed to execute (Publish Service Definition).
Failed.
Is anyone able to help with this? Thanks.
Could you stop the existing Geocode Service, and then redo the proces?
@JayantaPoddar , I have narrowed down the error to ArcGIS Server being unable to rename the service. This occurred regardless if I manually stopped the service prior to doing the overwrite, or if ArcGIS Server automatically stopped the service during the overwrite. Here are some logs of both scenarios.
Creating the Locator service then overwriting it:
Overwrite Locator_YYY Service
VERBOSE Job 'j245c93962c164bd58f60ef87eaf56eda' for service 'System/PublishingToolsEx' completed its execution. The status of the job after completion was 'esriJobFailed'. Elapsed time '25644' ms. 2021-03-26T20:29:01 Server
SEVERE Error executing tool. PublishServiceDefinition Job ID: j245c93962c164bd58f60ef87eaf56eda : ERROR 001369: Failed to create the service. (more) 2021-03-26T20:29:01 System/PublishingToolsEx.GPServer
VERBOSE Execute job j245c93962c164bd58f60ef87eaf56eda 2021-03-26T20:29:01 System/PublishingToolsEx.GPServer
VERBOSE End execute 2021-03-26T20:29:01 System/PublishingToolsEx.GPServer
INFO Deleted the item 'i038f087b-77dd-4694-bb6a-68537ec31ae0' successfully. 2021-03-26T20:29:01 Admin
SEVERE Failed to create the service.: ERROR: code:500, Failed to rename service 'Locator_YYY.GeocodeServer'., Internal server error. 2021-03-26T20:29:01 System/PublishingToolsEx.GPServer
FINE End create service wrapper 2021-03-26T20:29:01 System/PublishingToolsEx.GPServer
VERBOSE Released 'service-locator_yyy_202103262028.geocodeserver' workflow lock. 2021-03-26T20:29:01 Admin
VERBOSE Released 'service-locator_yyy.geocodeserver' workflow lock. 2021-03-26T20:29:01 Admin
SEVERE Failed to rename service 'Locator_YYY.GeocodeServer'. 2021-03-26T20:29:01 Admin
FINE Shutting down an instance of service 'Locator_YYY.GeocodeServer'. 2021-03-26T20:28:36 Locator_YYY.GeocodeServer
FINE Shutting down an instance of service 'Locator_YYY.GeocodeServer'. 2021-03-26T20:28:36 Locator_YYY.GeocodeServer
VERBOSE Acquired 'service-locator_yyy.geocodeserver' workflow lock. 2021-03-26T20:28:36 Admin
VERBOSE Stopping the service 'Locator_YYY.GeocodeServer'. 2021-03-26T20:28:36 Admin
INFO Service to publish: [name: Locator_YYY; type: GeocodeServer]. 2021-03-26T20:28:36 System/PublishingToolsEx.GPServer
VERBOSE Job j245c93962c164bd58f60ef87eaf56eda is successfully submitted. 2021-03-26T20:28:35 System/PublishingToolsEx.GPServer
Create Locator_YYY
VERBOSE Job 'j09315681d0ba4a9abff4246a7955a24e' for service 'System/PublishingTools' completed its execution. The status of the job after completion was 'esriJobSucceeded'. Elapsed time '25076' ms. 2021-03-26T20:13:20 Server
INFO Service published [name: Locator_YYY; type: GeocodeServer]. 2021-03-26T20:13:17 System/PublishingToolsEx.GPServer
INFO Service 'Locator_YYY.GeocodeServer' was created successfully. 2021-03-26T20:13:10 Admin
INFO Service to publish: [name: Locator_YYY; type: GeocodeServer]. 2021-03-26T20:12:57 System/PublishingToolsEx.GPServer
VERBOSE Job j09315681d0ba4a9abff4246a7955a24e is successfully submitted. 2021-03-26T20:12:55 System/PublishingTools.GPServer
Creating the locator service, manually stopping the service, then overwriting it:
Overwrite Locator_AAA Service
VERBOSE Job 'jc09b7e8d949c41ef8750e7237f9d9d85' for service 'System/PublishingTools' completed its execution. The status of the job after completion was 'esriJobFailed'. Elapsed time '27614' ms. 2021-03-27T08:55:49 Server
SEVERE Error executing tool. PublishServiceDefinition Job ID: jc09b7e8d949c41ef8750e7237f9d9d85 : ERROR 001369: Failed to create the service. (more) 2021-03-27T08:55:49 System/PublishingTools.GPServer
SEVERE Error executing tool. PublishServiceDefinition Job ID: ja56785d59ca7429390142f914c288b7c : ERROR 001369: Failed to create the service. (more) 2021-03-27T08:55:47 System/PublishingToolsEx.GPServer
VERBOSE Execute job ja56785d59ca7429390142f914c288b7c 2021-03-27T08:55:47 System/PublishingToolsEx.GPServer
VERBOSE End execute 2021-03-27T08:55:47 System/PublishingToolsEx.GPServer
INFO Deleted the item 'i50bc29e8-722f-4bc6-b531-3201340105b1' successfully. 2021-03-27T08:55:47 Admin
SEVERE Failed to create the service.: ERROR: code:500, Failed to rename service 'Locator_AAA.GeocodeServer'., Internal server error. 2021-03-27T08:55:47 System/PublishingToolsEx.GPServer
FINE End create service wrapper 2021-03-27T08:55:47 System/PublishingToolsEx.GPServer
VERBOSE Released 'service-locator_aaa_202103270855.geocodeserver' workflow lock. 2021-03-27T08:55:47 Admin
VERBOSE Released 'service-locator_aaa.geocodeserver' workflow lock. 2021-03-27T08:55:47 Admin
SEVERE Failed to rename service 'Locator_AAA.GeocodeServer'. 2021-03-27T08:55:47 Admin
WARNING Unable to process request. Error handling service request :Could not find service. Service may be stopped or it may not be configured. 2021-03-27T08:55:40 Rest
INFO Service to publish: [name: Locator_AAA; type: GeocodeServer]. 2021-03-27T08:55:23 System/PublishingToolsEx.GPServer
VERBOSE Job jc09b7e8d949c41ef8750e7237f9d9d85 is successfully submitted. 2021-03-27T08:55:21 System/PublishingTools.GPServer
Stop Locator_AAA Service
VERBOSE Released 'service-locator_aaa.geocodeserver' workflow lock. 2021-03-27T08:51:47 Admin
VERBOSE Stopping the service 'Locator_AAA.GeocodeServer'. 2021-03-27T08:51:46 Admin
FINE Shutting down an instance of service 'Locator_AAA.GeocodeServer'. 2021-03-27T08:51:46 Locator_AAA.GeocodeServer
VERBOSE Acquired 'service-locator_aaa.geocodeserver' workflow lock. 2021-03-27T08:51:46 Admin
Create Locator_AAA
VERBOSE Job 'je99488525f97409f8d54f9b88cf63875' for service 'System/PublishingTools' completed its execution. The status of the job after completion was 'esriJobSucceeded'. Elapsed time '25411' ms. 2021-03-27T08:49:42 Server
INFO Service published [name: Locator_AAA; type: GeocodeServer]. 2021-03-27T08:49:40 System/PublishingToolsEx.GPServer
INFO Service 'Locator_AAA.GeocodeServer' was created successfully. 2021-03-27T08:49:32 Admin
INFO Service to publish: [name: Locator_AAA; type: GeocodeServer]. 2021-03-27T08:49:18 System/PublishingToolsEx.GPServer
VERBOSE Job je99488525f97409f8d54f9b88cf63875 is successfully submitted. 2021-03-27T08:49:16 System/PublishingTools.GPServer
Are you planning to make this an automated solution? If so, I would be interested to how you are able to automate the stopping of the geocode service as this is part of the current process that I have thus far been unable to migrate from a python 2.7 script (ArcMap) to python 3.6 script (Pro).
@MichaelVolz I was planning to semi automate this - on demand at the moment. From looking at the logs, you shouldn't need to manually stop the service as the overwrite process handles it all. That Updating Geocoding Services script in my original post already works in Pro & Python 3.6.
Here's a great video with various options for updating locators and services where that script is discussed:
https://community.esri.com/t5/devsummit-conference-videos/updating-your-locator-service/m-p/976744
@MichaelVolz, this is something I've been working on lately; automating the rebuild and republishing of locator services since in our city, they need to be done on a weekly basis. While I am still working out how to programmatically replace the service once it has been rebuilt, the code for rebuilding the locator and stopping the service via python is below: