Manage Map Server Cache Status (Server)

License Level:BasicStandardAdvanced

Summary

Manages internal data kept by the server about the built tiles in a map or image service cache.

Usage

Syntax

ManageMapServerCacheStatus_server (input_service, {scales}, manage_mode, {num_of_caching_service_instances}, {report_folder}, {report_extent}, {area_of_interest})
ParameterExplanationData Type
input_service

The map or image service for which the status will be modified.

This is a string containing both the server and service information. To see how to construct this string, open ArcCatalog, select your service in the Catalog tree, and note the text in the Location toolbar. Then change the backslashes to forward slashes, for example, GIS Servers/arcgis on MYSERVER (admin)/USA.MapServer.

String
scales
(Optional)

This parameter is intended for use with future releases of ArcGIS.

Double
manage_mode
  • DELETE_CACHE_STATUSDeletes the status information used by the server.
  • REBUILD_CACHE_STATUSDeletes and then rebuilds the status information used by the server.
String
num_of_caching_service_instances
(Optional)

The total number of instances of the System/CachingTools service that you want to dedicate toward running this tool. You can increase the maximum number of instances per machine of the System/CachingTools service using the Service Editor window available through an administrative connection to ArcGIS Server. Ensure your server machines can support the chosen number of instances.

Long
report_folder
(Optional)

This parameter is intended for use with future releases of ArcGIS.

Folder
report_extent
(Optional)

This parameter is intended for use with future releases of ArcGIS.

Extent
area_of_interest
(Optional)

This parameter is intended for use with future releases of ArcGIS.

Feature Set

Code Sample

Manage Map Server Cache Status example

Deletes the status information for a cache

# 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, 
                                                     manageMode, scales,
                                                     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()

Environments

This tool does not use any geoprocessing environments

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
1/21/2015