Manage Map Server Cache Status (Server)

Summary

Usage

  • This tool is useful for rebuilding the cache status after you manually copy tiles into the cache directory or build tiles on demand.

  • This tool is the only way to build a status for a cache created with a previous release of ArcGIS Server or Portal for ArcGIS.

  • Rather than creating a status for the entire cache, you can alternatively use this tool to create status reports for custom areas of interest and scale levels. You do this by setting the Manage Mode parameter (manage_mode in Python) to REPORT_BUNDLE_STATUS. The report is stored in a new file geodatabase named Status.gdb, specifically within a feature class named TaskStatus.

    Note that your cache directory also contains a Status.gdb that pertains to the entire cache and is updated when you use the other Manage Mode options for this tool. You cannot substitute a custom Status.gdb in this location.

Parameters

LabelExplanationData Type
Input Service
Image Service; Map Server
Manage Mode
  • Delete cache statusDeletes the status information used by the server.
  • Rebuild cache statusDeletes, then rebuilds the status information used by the server.
  • Rebuild bundle statusCreates status information in a new file geodatabase named Status.gdb in a folder you specify in the Output Folder parameter. This option is used when you want to create a custom status report for a particular area of interest or set of scales.
String
Scales
(Optional)

The scale levels for which the status will be modified. This parameter is only applicable when building a custom status using the Rebuild bundle status option for the Manage Mode parameter.

Double
Number of caching service instances
(Optional)
Long
Output Folder
(Optional)

Output folder for the Status.gdb. This parameter is only applicable when building a custom status using the Rebuild bundle status option.

Folder
Area Of Interest
(Optional)

An area of interest (polygon) that determines what geography the status report will cover. This parameter is only applicable when building a custom status using the Rebuild bundle status option.

Feature Set
Report Extent
(Optional)

A rectangular extent defining the area for which the status will be built. This parameter is only applicable when building a custom status using the Rebuild bundle status option.

Note that the Area Of Interest parameter allows you to specify an area of interest that is nonrectangular.

  • Current Display Extent Map View—The extent will be based on the active map or scene. This option is only available when there is an active map.
  • Draw Extent Draw Extent—The extent will be based on a rectangle drawn on the map or scene. This option will create a feature class in the project geodatabase and add a layer to the map. The feature class will have the same coordinate system as the map.
    Note:

    This option is not available in the Environments dialog box. It is only available from a tool parameter with an extent data type or from the Environments tab on a tool dialog box.

    Note:

    When the Enable and disable editing from the Edit tab editing option is checked, you must enable editing on the Edit ribbon tab to draw the extent.

  • Extent of a Layer Layer—The extent will be based on an active map layer. Use the drop-down list to choose an available layer or use the Extent of data in all layers option to get the combined extent of all active map layers, excluding the basemap. This option is only available when there is an active map with layers.

    Each map layer has the following options:

    • All Features Select All—The extent of all features in the layer.
    • Selected Features Area from Selected Features—The extent of the selected features in the layer.
    • Visible Features Extent Indicator—The extent of the visible features in the layer.
      Note:

      The extents from the Selected Features Area from Selected Features and Visible Features Extent Indicator options are only available for feature layers.

  • Browse Browse—The extent will be based on an existing dataset.
  • Clipboard Paste—The extent can be copied to and pasted from the clipboard.
    • Copy Extent Copy—Copies the extent coordinates and coordinate system to the clipboard.
    • Use Paste Extent Paste—Pastes the extent coordinates and, optionally, the coordinate system from the clipboard. If the clipboard values do not include a coordinate system, the extent will use the map’s coordinate system.
    Note:

    The extent coordinates are copied to and pasted from the clipboard using the same formatting and order as the ArcPy Extent object: x-min, y-min, x-max, y-max, and the spatial reference.

  • Reset Extent Reset—The extent will be reset to the default value.
  • Manually entered coordinates—The coordinates must be numeric values and in the active map's coordinate system.
    Caution:

    The map may use different display units than the entered coordinates. The use of a cardinal direction (N, S, E, W) is not supported. Use a negative value sign for south and west coordinates.

Extent

Derived Output

LabelExplanationData Type
Output Map Service URL

The output service URL.

String

arcpy.management.ManageMapServerCacheStatus(input_service, manage_mode, {scales}, {num_of_caching_service_instances}, {report_folder}, {area_of_interest}, {report_extent})
NameExplanationData Type
input_service
Image Service; Map Server
manage_mode
  • DELETE_CACHE_STATUSDeletes the status information used by the server.
  • REBUILD_CACHE_STATUSDeletes, then rebuilds the status information used by the server.
  • REPORT_BUNDLE_STATUSCreates status information in a new file geodatabase named Status.gdb in a folder you specify in the Output Folder parameter. This option is used when you want to create a custom status report for a particular area of interest or set of scales.
String
scales
[scales,...]
(Optional)

The scale levels for which the status will be modified. This parameter is only applicable when building a custom status using the REPORT_BUNDLE_STATUS option for the manage_mode parameter.

Double
num_of_caching_service_instances
(Optional)
Long
report_folder
(Optional)

Output folder for the Status.gdb. This parameter is only applicable when building a custom status using the REPORT_BUNDLE_STATUS option.

Folder
area_of_interest
(Optional)

An area of interest (polygon) that determines what geography the status report will cover. This parameter is only applicable when building a custom status using the REPORT_BUNDLE_STATUS option.

Feature Set
report_extent
(Optional)

A rectangular extent defining the area for which the status will be built. This parameter is only applicable when building a custom status using the REPORT_BUNDLE_STATUS option.

Note that the area_of_interest parameter allows you to specify an area of interest that is nonrectangular.

  • MAXOF—The maximum extent of all inputs will be used.
  • MINOF—The minimum area common to all inputs will be used.
  • DISPLAY—The extent is equal to the visible display.
  • Layer name—The extent of the specified layer will be used.
  • Extent object—The extent of the specified object will be used.
  • Space delimited string of coordinates—The extent of the specified string will be used. Coordinates are expressed in the order of x-min, y-min, x-max, y-max.
Extent

Derived Output

NameExplanationData Type
output_folder

The output service URL.

String

Code sample

ManageMapServerCacheStatus example (stand-alone script)

Delete 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.server.ManageMapServerCacheStatus(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 as 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(str(e))

report.close()

Environments

This tool does not use any geoprocessing environments.