Convertir le format d’un cache de serveur de carte (Serveur)

Niveau de licence :De baseStandardAvancé

Récapitulatif

Convertit le stockage d'un cache de service d'imagerie ou de carte entre le format éclaté et le format compact. L'outil convertit le format en place, ce qui signifie qu'il ne fait pas une copie du format du cache existant. Il crée plutôt le nouveau format du cache dans le même dossier de cache et supprime l'ancien format.

Effectuez une sauvegarde de votre cache avant d'exécuter cet outil si vous comptez revenir à l'ancien format.

Utilisation

Syntaxe

ConvertMapServerCacheStorageFormat_server (input_service, {num_of_caching_service_instances})
ParamètreExplicationType de données
input_service

Service de carte ou d'imagerie dont vous souhaitez convertir le format du cache.

Cette chaîne contient les informations relatives au serveur et au service. Pour savoir comment construire cette chaîne, ouvrez ArcCatalog, sélectionnez votre service dans l'arborescence du catalogue et notez le texte dans la barre d'outils Emplacement. Remplacez les barres obliques inverses par des barres obliques, par exemple, GIS Servers/arcgis on MYSERVER (admin)/USA.MapServer.

String
num_of_caching_service_instances
(Facultatif)

Nombre total d'instances du service des outils de mise en cache du dossier système que vous souhaitez utiliser pour exécuter cet outil. Vous pouvez augmenter le nombre maximum d'instances par machine du service des outils de mise en cache du dossier système en ouvrant la fenêtre Editeur de services via une connexion administrateur à ArcGIS Server. Assurez-vous que vos machines serveur peuvent prendre en charge le nombre d'instances sélectionné.

Long

Exemple de code

Exemple ConvertMapServerCacheStorageFormat

Convertit le format de stockage du cache d'un service.

# 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

# 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"

# Set local variables for mapservice properties
connectionFile = r"C:\Users\<username>\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog"
server = "arcgis on MyServer_6080 (publisher)"
serviceName = "Rainfall.MapServer"
inputService = connectionFile + "\\" + server + "\\" + serviceName
numOfCachingServiceInstances = "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)
# Execute ConvertMapServerCacheFormat
try:
    starttime = time.clock()
    result = arcpy.ConvertMapServerCacheStorageFormat_server(inputService,
                                                             numOfCachingServiceInstances)
    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 " + serviceName + " 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 "

Environnements

Cet outil n'utilise aucun environnement de géotraitement

Thèmes connexes

Informations de licence

ArcGIS for Desktop Basic : Oui
ArcGIS for Desktop Standard : Oui
ArcGIS for Desktop Advanced : Oui
9/12/2013