Convert Map Server Cache Storage Format (Server)
Summary
Converts the storage of a map service cache between the exploded (pre-10.0) format and the compact format. The tool converts the format "in place", meaning it does not make a copy of the existing format. Instead, it creates the new format cache in the same cache folder and deletes the old format.
Usage
-
To use this tool, specify the map service whose cache you want to convert. The tool detects the current storage format and uses that information to automatically set the target format to the opposite format. You can choose how many service instances to dedicate to cache conversion.
Syntax
Parameter | Explanation | Data Type |
server_name |
The ArcGIS Server machine hosting the service whose cache format will be changed. | String |
object_name |
The map service whose cache format will be changed. Caution: The new cache format replaces the old cache format. Make a backup of your cache if you wish to go back to your old format. | String |
data_frame |
The source data frame for the map service. | String |
storage_format_type (Optional) |
The storage format to which the new cache will be converted. The tool user interface detects your current cache format and lists the other format as the only option for this parameter. The formats are EXPLODED and COMPACT. | String |
thread_count (Optional) |
Number of map service instances to use while converting the cache. By default the maximum allowable number of instances will be used (default for an ArcGIS Server service is 2) . If you have more server power, you can raise the maximum allowable number of instances (accessible from the Service Properties dialog box in ArcCatalog, the Catalog window, or Manager), then raise this parameter when you run the tool. | Long |
Code Sample
This example uses ConvertMapServerCacheStorageFormat to convert an exploded cache to a compact cache.
# ConvertMapServerCacheStorageFormat example (stand-alone script) # Name: ConvertMapServerCacheStorageFormat.py # Description: The following stand-alone script demonstrates how to convert map # server cache storage format to the alteranate storage format # 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, string, datetime, traceback # Set environment settings env.workspace = "C:/data" # List of variables for mapservice properties server = "MyServer" service = "Rainfall" dataFrame = "" threadCount = "2" 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') # One can leave the variable for storage format marked "COMPACT" to "" (default) try: starttime = time.clock() result = arcpy.ConvertMapServerCacheStorageFormat_server (server, service, dataFrame, "COMPACT" , threadCount) 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 "Converted Map Server Cache Storage format for " + 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 "Converted Map Server Cache Storage format "