マップ サービス キャッシュの格納形式を変換(Convert Map Server Cache Storage Format) (サーバ)
サマリ
マップ サービス キャッシュのストレージをエクスプロード形式(10.0 より前の形式)とコンパクト形式の間で変換します。このツールでは、変換後の形式が「変換前と同じ場所に配置」されるので、既存の形式のコピーは作成されません。代わりに、同じキャッシュ フォルダに新しい形式のキャッシュが作成され、古い形式は削除されます。
使用法
-
このツールを使用するには、変換対象のキャッシュを使用するマップ サービスを指定してください。ツールは現在の格納形式を検出し、その情報を使用して、自動的にターゲットの形式を逆の形式に設定します。キャッシュの変換専用として使用する、サービス インスタンスの数を選択することができます。
構文
| パラメータ | 説明 | データ タイプ |
server_name |
キャッシュ形式が変更されるサービスをホストしている ArcGIS Server コンピュータ。 | String |
object_name |
キャッシュ形式が変更されるマップ サービス。 注意:古いキャッシュ形式が、新しいキャッシュ形式に置き換えられます。古い形式に戻りたい場合には、キャッシュのバックアップを作成します。 | String |
data_frame |
マップ サービス用のソース データ フレーム。 | String |
storage_format_type (オプション) |
新しいキャッシュが変換される格納形式。ツールのユーザ インタフェースは、現在のキャッシュの形式を検出し、他の形式をこのパラメータのための唯一のオプションとして表示します。形式には、エクスプロード形式とコンパクト形式があります。 | String |
thread_count (オプション) |
キャッシュを変換する間に使用するマップ サービス インスタンスの数。デフォルトでは、インスタンスの最大数が使用されます(ArcGIS Server サービスの場合、デフォルトは 2 です)。サーバ リソースに余裕がある場合は、最大インスタンス数(ArcCatalog 内の [サービス プロパティ] ダイアログ ボックス、[カタログ] ウィンドウ、または Manager からアクセス可能)を引き上げることができます。そして最大インスタンス数を引き上げてから、ツールの実行時にこのパラメータ値を増分してださい。 | Long |
コードのサンプル
この例では、エクスプロード形式のキャッシュからコンパクト形式のキャッシュに変換するために、ConvertMapServerCacheStorageFormat を使用しています。
# 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
# 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 "
