管理地图服务器缓存状态 (Server)
摘要
管理服务器所保存的与地图或影像服务缓存中的构建切片有关的内部数据。
用法
- 此工具可移除或重新构建缓存状态信息。通过手动复制切片或根据需要构建切片而更改缓存的状态时,此功能非常有用。您还可以使用此功能构建以先前版本的 ArcGIS Server 创建的缓存的状态。
语法
ManageMapServerCacheStatus_server (input_service, scales, manage_mode, num_of_caching_service_instances, report_folder, {report_extent}, {area_of_interest})
参数 | 说明 | 数据类型 |
input_service | 将修改其状态的地图或影像服务。 这是一个包含服务器和服务器信息的字符串。要查看构建此字符串的方法,请打开 ArcCatalog,选择“目录”树中的服务,并注意位置 工具条中的文本。然后将反斜线改为正斜线,例如,MYSERVER (admin)/USA.MapServer 上的 GIS Servers/arcgis。 | String |
scales |
该参数旨在与 ArcGIS 的未来版本一同使用。 | Double |
manage_mode |
| String |
num_of_caching_service_instances |
专用于运行该工具的系统/缓存工具服务实例的总数。您可以通过与 ArcGIS Server 的管理连接,使用 服务编辑器 窗口,增加系统/缓存工具服务的每台计算机的最大实例数。确保您的服务器计算机可以支持所选数量的实例。 | Long |
report_folder |
该参数旨在与 ArcGIS 的未来版本一同使用。 | Folder |
report_extent (可选) |
该参数旨在与 ArcGIS 的未来版本一同使用。 | Extent |
area_of_interest (可选) |
该参数旨在与 ArcGIS 的未来版本一同使用。 | Feature Set |
代码实例
管理地图服务器缓存状态示例
删除缓存的状态信息
# Name: ManageMapServerCacheStatus.py
# Description: The following stand-alone script demonstrates how to delete
# Status of cache using ManageMapServerCachStatus tool
# Requirements: os, sys, time and 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
connectionFile = r"C:\Users\<username>\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog"
server = "arcgis on MyServer_6080 (publisher)"
serviceName = "Rainfall.MapService"
inputService = connectionFile + "\\" + server + "\\" + serviceName
scales = ""
manageMode = "DELETE_CACHE_STATUS"
numOfCachingServiceInstances = "2"
outputFolder = ""
areaOfInterest = ""
reportExtents = ""
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')
# use "scales[0]","scales[-1]","scales[0:3]"
try:
starttime = time.clock()
result = arcpy.ManageMapServerCacheStatus_server(inputService, scales[-1],
manageMode,
numOfCachingServiceInstances,
outputFolder,
areaOfInterest,
reportExtents)
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 "Reported the Bundle status for scale =" + str(scales[-1]) + "of "
serviceName + "at " + outputFolder + "\n using specified feature class "
areaOfInterest + " 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 3 \n" "Line %i" % tb.tb_lineno)
report.write(e.message)
report.close()
环境
此工具不使用任何地理处理环境
许可信息
ArcGIS for Desktop Basic:是
ArcGIS for Desktop Standard:是
ArcGIS for Desktop Advanced:是
9/15/2013