Manage cache tiles python on server side script

2700
7
04-11-2017 02:48 PM
CoryHines
New Contributor

I am running server 10.4 an attempting to automate some cache updates.  In a SQL database I have a polygon feature class I use to isolate areas that need to be updated each day.  The issue I'm running in to is the -AOI and the -extent parameters are not being honored and the full extent is being re-cached.  I have tested both with no success.  Has anyone else ran into this?

python.exe "C:\Program Files\ArcGIS\Server\tools\admin\managecachetiles.py" -u domain\user -p *** -s http://server.domain:6080 -n Service:MapServer -scales "76800;38400;19200;9600;4800;2400;1200;600;300;150" -mode RECREATE_ALL_TILES -i 3 -AOI "G:\connect\ags@gis.sde\gis.DBO.CacheUpdate -wait DO_NOT_WAIT

Thanks for any insight.

Cory

0 Kudos
7 Replies
JonathanQuinn
Esri Notable Contributor

Hm, I tested this on my end and could reproduce the behavior.  I tried with the Manage Map Server Cache Tiles tool directly and didn't see a problem.  You may want to write your own script to run using the tool directly instead of relying on the admin tools and also contact Support to report the behavior.

0 Kudos
CoryHines
New Contributor

Thanks for checking this on your end Jonathan.  I will put in a support ticket to see what they come up with.

As a side note the reason I went this route is because I was unable to get a stand alone python script to run on the server side.  I tried many different ways and it always threw an error when attempting to connect to my service.  I tried referencing a connection file as well as hard coding the connection.

The only way I've been able to run this process is via my desktop as stand-alone or python script, but I would like to avoid using my pc for this type of task.

Thanks again for your help.

Cory

0 Kudos
JonathanQuinn
Esri Notable Contributor

Do you recall what error were you getting?  A convenient way to step through creating your own script is to run the tool in ArcMap, and then copy the result as a python snippet. You can try to run it again in the Python window or in a standalone script.  If you're using it in a standalone script it's important to replace the connection string for the GIS Server, (which would default to "GIS Servers\<gis_server_connection_name.ags" or something similar), with the correct path on disk.

0 Kudos
MichaelVolz
Esteemed Contributor

Can you post your python script?

I have scripts managing caches up and running for years with the ManageMapServerCacheTiles_server call in python from a GIS process server that is separate from the ArcGIS Server (AGS) servers, so maybe you just have a syntax error.

Have you ever tried to update a cache with python in a lower version of AGS (e.g. 10.2.x, 10.3.x)?

0 Kudos
CoryHines
New Contributor

Hi Guys,

I have a python script that uses my cache update polygon layer and it works flawlessly on my desktop pc.  The command line script on the server that I posted above also works flawlessly except the cache update polygon parameter doesn't work with either -AOI or -extent.  I have updated the path of the connection file when being run on the server to the connected drive G:  That stand alone python script is at the bottom.  That script gives me the standard 000732 Dataset does not exist or is not supported error.

Line 43Failed to execute. Parameters are not valid.
ERROR 000732: Input Service: Dataset G:\connect\admin.ags\Labels.MapServer does not exist or is not supported
Failed to execute (ManageMapServerCacheTiles).

Here is the script above and the response.  I of course limited to 2 small scale levels in the interest of time.  It even acknowledges the CacheUpdate layer as "Feature Set" while executing.  I also tried using double \\ in the path for the polygon layer and get the same result.

C:\Python27\ArcGISx6410.4>python.exe "C:\Program Files\ArcGIS\Server\tools\admin\managecachetiles.py" -u domain\user -p password -s http://domain.server:6080 -n Labels:MapServer -scales "76800;38400" -mode RECREATE_ALL_TILES -i 3 -AOI "G:\connect\ags@gis.sde\gis.DBO.CacheUpdate -wait DO_NOT_WAIT
Submitted.
Executing...
Executing (Manage Map Cache Tiles): ManageMapCacheTiles Labels:MapServer 76800;38400 3 RECREATE_ALL_TILES # "G:\connect\ags@gis.sde\gis.DBO.CacheUpdate -wait DO_NOT_WAIT" "Feature Set"
Start Time: Wed Apr 12 11:18:16 2017
Finished:: 0 percent
Finished:: 0 percent
Estimated Time Remaining: Calculating...
Estimated Time Remaining: Calculating...
Finished:: 23 percent
Estimated Time Remaining: 3 minutes 45 seconds
Finished:: 106 percent
Estimated Time Remaining: Calculating...

C:\Python27\ArcGISx6410.4>

# Import system modules
import arcpy
from arcpy import env
import os, sys, time, datetime, traceback, string

# Set environment settings
env.workspace = "C:/scripts"

# List of input variables for map service properties
connectionFile = r"G:\connect"
server = "admin.ags"
service = "Labels.MapServer"
mapService = connectionFile + "\\" + server + "\\" + labels
scales = [115200,76800,38400,19200]
numOfCachingServiceInstances = 3
updateMode = "RECREATE_ALL_TILES"
areaOfInterest = "G:\\connect\\ags@gis.sde\\gis.DBO.CacheUpdate"
waitForJobCompletion = "DO_NOT_WAIT"
updateExtents = ""
.
.
.
result = arcpy.ManageMapServerCacheTiles_server(mapService, scales,
updateMode,
numOfCachingServiceInstances,
areaOfInterest, updateExtents,
waitForJobCompletion)

0 Kudos
MichaelVolz
Esteemed Contributor

I'm wondering if your script has an issue with the areaOfInterest as it looks like an SDE connection.  Just as a test, can you copy the area of interest feature class from SDE to a file geodatabase and then run your script on a path to the file geodatabase.  In my update scripts, I save out the areas to be updated to a file geodatabase and I do not have this data in an SDE geodatabase.

0 Kudos
CoryHines
New Contributor

Same result, it rebuilds the entire extent.  I'm going to log a support ticket with Esri.  I did stumble upon a post from a couple of years ago indicating this is likely a bug, but that was a couple of versions ago.  Would have thought they would have fixed something this minor by now.

Thanks Michael.

https://community.esri.com/thread/115414 

0 Kudos