keep existing cache Example

720
0
04-21-2014 02:19 PM
KevinJohnson
Occasional Contributor
Hello,
I'm trying to script republishing a map service that already has a cache and am having problems getting it to keep the existing cache.   my script is using a combo of arcpy.mapping.CreateMapSDDraft, arcpy.StageService_server and arcpy.UploadServiceDefinition_server.
Does anyone have an example of how to script republishing a service while keeping your existing cache?   I've been trying to set properties of the .sddraft file by following
doc = DOM.parse(sddraft)
    #turn on caching in the configuration properties
    configProps = doc.getElementsByTagName('ConfigurationProperties')[0]
    propArray = configProps.firstChild
    propSets = propArray.childNodes
    for propSet in propSets:
        keyValues = propSet.childNodes
        for keyValue in keyValues:
            if keyValue.tagName == 'Key':
                print "found Key"
                print str(keyValue.firstChild.data)
                if keyValue.firstChild.data == "KeepExistingMapCache":
                    print "found keep existing cache prop"
                    #keep existing caching
                    keyValue.nextSibling.firstChild.data = 'true'
                elif keyValue.firstChild.data == "isCached":
                    print "found is cached prop"
                    #turn on caching
                    keyValue.nextSibling.firstChild.data = 'true'
                elif keyValue.firstChild.data == "antialiasingMode":
                    keyValue.nextSibling.firstChild.data = 'Fast'


Hoping that Im missing something here and thats it's possible to do this.  Oh and im using 10.1 sp1
Thanks
Tags (2)
0 Kudos
0 Replies