Summary
Deletes a layer or layers of an existing globe service cache and all tiles in them.
Usage
This is an unrecoverable operation so only use it if you are sure you no longer need the cache.
This tool can be used to delete an existing globe server cache. To delete a cache, specify the ArcGIS Server (host) machine and select the globe service. The layers list will be populated with all available layers in the selected service.
By default all layers of the service are displayed and selected. If you intend to delete only a particular layer's cache, make sure to unselect the ones for which you want to keep the cache.
Delete Globe Server Cache deletes the entire cache folder. Note that after the Delete Globe Server Cache tool runs, it will restart the service. This will, in turn, generate a new set of caches for each layer in the service that was deleted by the delete operation. This is because all globe services require a cache configuration to exist on disk. The cache that gets created automatically on startup of a service is a skeleton representation that does not contain any tiles.
Syntax
arcpy.server.DeleteGlobeServerCache(service, Layer)
Parameter | Explanation | Data Type |
service | The globe service whose layer caches you want to delete. This is a string containing both the server and service information. To see how to construct this string, open ArcCatalog, select the service in the Catalog tree, and note the text in the Location toolbar. Change the backslashes to forward slashes, for example, GIS Servers/arcgis on MYSERVER (admin)/Seattle.GlobeServer. | GlobeServer |
Layer [Layer,...] | The layers in the globe service whose caches will be deleted. All layers of the service are included by default. If a layer is excluded the layer's cache will not be deleted. | String |
Code sample
This example deletes all layers of a cache for a globe service.
#DeleteGlobeServerCache example For ArcGIS Server 10.1 Beta(stand-alone script)
# Name: DeleteGlobeServerCache.py
# Description: The following stand-alone script deletes globe server cache
# Requirements: os, sys, time & traceback modules
# Author: ESRI
# Any line that begins with a pound sign is a comment and will not be executed
# Empty quotes take the default value.
# To accept arguments from the command line replace values of variables to
# "sys.argv[]"
# Import system modules
import arcpy
from arcpy import env
import os, sys, time, datetime, traceback, string
# Set environment settings
env.workspace = "C:/data"
# List of input variables for map service properties
connectionFile = r"C:\Users\<username>\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog"
server = "arcgis on MyServer_6080 (publisher)"
globeServiceName = "tstGlobeService.GlobeService"
globeService = connectionFile + "\\" + server + "\\" + globeServiceName
inputLayers = ""
currentTime = datetime.datetime.now()
arg1 = currentTime.strftime("%H-%M")
arg2 = currentTime.strftime("%Y-%m-%d %H:%M")
file = 'C:/data/report_%s.txt' % arg1
# print results of the script to a report
report = open(file,'w')
try:
starttime = time.clock()
result = arcpy.DeleteGlobeServerCache_server(globeService, inputLayers)
finishtime = time.clock()
elapsedtime = finishtime - starttime
#print messages to a file
while result.status < 4:
time.sleep(0.2)
resultValue = result.getMessages()
report.write ("completed " + str(resultValue))
print "Deleted the GlobeServer cache successfully for globeservice "
globeServiceName + "\n in " + str(elapsedtime) + " sec \n on " + arg2
except Exception, e:
# If an error occurred, print line number and error message
tb = sys.exc_info()[2]
report.write("Failed at \n" "Line %i" % tb.tb_lineno)
report.write(e.message)
report.close()
print "Deleted the globe server cache successfully"
Environments
This tool does not use any geoprocessing environments.
Licensing information
- Basic: Requires 3D Analyst
- Standard: Requires 3D Analyst
- Advanced: Requires 3D Analyst