删除 Globe 服务器缓存 (服务器)

摘要

删除现有 globe 服务缓存及其包含的所有切片。

用法

语法

DeleteGlobeServerCache_Server (server_name, object_name, Layer)
参数说明数据类型
server_name

对要删除缓存的服务进行托管的 ArcGIS Server 计算机。

String
object_name

要删除缓存的 globe 服务的名称。

String
Layer

要删除缓存的 globe 服务中的图层。默认情况下将包含服务的所有图层。如果有一个图层未包含在内,则不会删除该图层的缓存。

String

代码示例

在本例中,将针对名为 tstGlobeService 的服务删除某个缓存的所有图层。

#DeleteGlobeServerCache example (stand-alone script)

# Name: DeleteGlobeServerCache.py
# Description: The following stand-alone script deletes globe server cache
# Requirements: os, sys, time & traceback modules

# 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
server = "MyServer"
globeServerObject = "tstGlobeService"
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(server, globeServerObject, 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 mapservice "
    + service + "\n   at " + cacheDir + service + " 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 step 1 \n" "Line %i" % tb.tb_lineno)
    report.write(e.message)
report.close()
    
print "Deleted the globe server cache successfully"

环境

此工具不使用任何地理处理环境

相关主题

许可信息

ArcView: 需要 3D Analyst
ArcEditor: 需要 3D Analyst
ArcInfo: 需要 3D Analyst

7/10/2012