Project data source cached when trying to publish GP service?

217
1
Jump to solution
06-05-2020 01:24 PM
MollyFoley
Regular Contributor

I recently had to change a script to point to a different directory to find my SDE connections. When I try to republish the service so the paths are updated on the server, it says that my script contains a broken project data source and then lists the old path, even though the script no longer contains any references to the old path. How do I fix this? This is not the only GP service I've changed the path for; all the other ones I've changed have been able to overwrite the old services without error. 

Current code with new path:

#Get MonitoringPoint, Patches, and PC layers from database.
fa_db_con = r'C:\Users\mfoley10\AppData\Roaming\ESRI\Desktop10.7\ArcCatalog\FocalAreas_HabitatWriter.sde'
hbw_db_con = r'C:\Users\mfoley10\AppData\Roaming\ESRI\Desktop10.7\ArcCatalog\HabitatMonitoring_HabitatWriter.sde'
mpFC = fa_db_con + '\FocalAreas.dbo.MonitoringPoint'
patchesFC =  hbw_db_con + '\HabitatMonitoring.DBO.Patches'
pcFC = hbw_db_con + '\HabitatMonitoring.DBO.ProtectiveCover'‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Errors I get when analyzing the service for overwriting:

00068 Script PrintHabitatMap contains broken project data source: C:\Users\mfoley10\AppData\Roaming\ESRI\Desktop10.6\ArcCatalog\HabitatMonitoring_nbcidb_HabitatWriter.sde

00068 Script PrintHabitatMap contains broken project data source: C:\Users\mfoley10\AppData\Roaming\ESRI\Desktop10.6\ArcCatalog\FocalAreas_nbcidb_HabitatWriter.sde 

00178 Data: C:\Users\mfoley10\AppData\Roaming\ESRI\Desktop10.6\ArcCatalog\HabitatMonitoring_nbcidb_HabitatWriter.sde, used by Script PrintHabitatMap cannot be copied to the server

00178 Data: C:\Users\mfoley10\AppData\Roaming\ESRI\Desktop10.6\ArcCatalog\FocalAreas_nbcidb_HabitatWriter.sde, used by Script PrintHabitatMap cannot be copied to the server

The folder "...Desktop10.6\ArcCatalog\..." doesn't even exist on my computer. Regardless, I ran this code anyway to see if it would do anything (it didn't):

#(I typed out the full old path)
arcpy.env.workspace = 'C:\Users...\HabitatMonitoring_nbcidb_HabitatWriter.sde'
arcpy.ClearWorkspaceCache()‍‍‍‍‍‍‍‍‍

Next, I validated all my connections:

I have tried to see if changing the names of the connections listed in the Data Store to match that of the new paths in the script makes it publishable, but no luck (e.g. FocalAreas_nbcidb_HabitatWriter  gets changed to the new name which is FocalAreas_HabitatWriter).

I have made sure no draft services exist in the "Staging" folder that are caching that path.

I have even deleted the PrintHabitatMap geoprocessing service altogether to see if I could just publish a fresh one and it still won't let me.

The PrintHabitatMap geoprocessing service takes some MXDs out of a registered folder and alters them according to user input. I have since checked the option in the MXDs for storing relative paths on and I have reset the data sources for all the data in the MXDs to be sure they are pointing to the right locations. I then copied those MXDs into the appropriate folder on the server machine (the registered folder is in a different location on each machine, hence the copying). 

I cannot find ANYWHERE with that old path in it. I don't get where that old path is being stored or how the server keeps finding it.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
MollyFoley
Regular Contributor

"Solved" this by some miracle and sheer dumb luck after hours of fiddling around and exiting in and out of ArcMap. 

1) Load up your toolbox and run the script. Open the results window.

2) Share result as a geoprocessing service and set all your settings

3) Hit "Publish" and wait for the errors to appear

4) Exit out of the publishing dialog but SAVE the service draft

5) Exit out of ArcMap

6) Reopen ArcMap and go into your server connection

7) Open the "Drafts" folder in your server connection and double click on the draft

😎 Run "Analyze" again. This time no errors appear

9) Publish. It will succeed and run as expected for absolutely no reason. Thanks ESRI.

View solution in original post

0 Kudos
1 Reply
MollyFoley
Regular Contributor

"Solved" this by some miracle and sheer dumb luck after hours of fiddling around and exiting in and out of ArcMap. 

1) Load up your toolbox and run the script. Open the results window.

2) Share result as a geoprocessing service and set all your settings

3) Hit "Publish" and wait for the errors to appear

4) Exit out of the publishing dialog but SAVE the service draft

5) Exit out of ArcMap

6) Reopen ArcMap and go into your server connection

7) Open the "Drafts" folder in your server connection and double click on the draft

😎 Run "Analyze" again. This time no errors appear

9) Publish. It will succeed and run as expected for absolutely no reason. Thanks ESRI.

0 Kudos