<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to set Instance Type to Dedicated with 1 and 2 Min/Max instances in Service Definition draft? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-set-instance-type-to-dedicated-with-1-and-2/m-p/1115626#M62949</link>
    <description>&lt;P&gt;Very good.&amp;nbsp; If I recall correctly, I opted for the JSON route only because the python code seemed simpler doing the updates that way versus navigating through the dom.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Nov 2021 13:31:24 GMT</pubDate>
    <dc:creator>DonMorrison1</dc:creator>
    <dc:date>2021-11-10T13:31:24Z</dc:date>
    <item>
      <title>How to set Instance Type to Dedicated with 1 and 2 Min/Max instances in Service Definition draft?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-instance-type-to-dedicated-with-1-and-2/m-p/1115444#M62940</link>
      <description>&lt;P&gt;I have a script to publish data from an SDE to ArcGIS Enterprise. The script will enable feature access in the SD draft before publishing. I'm looking for some guidance or examples on how to also change the Instance Type to Dedicated and set the min/max # of instances. The script I have defaults the services to Shared Instance.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;'''Modify the .sddraft file to enable overwriting services'''
# Read the file
doc = DOM.parse(sddraft_output_filename)

# Enable overwrite existing service
tagsType = doc.getElementsByTagName('Type')
for tagType in tagsType:
    if tagType.parentNode.tagName == 'SVCManifest':
        if tagType.hasChildNodes():
            tagType.firstChild.data = 'esriServiceDefinitionType_Replacement'

'''Modify the .sddraft file to enable feature access'''
# Find all elements named TypeName
# This is where the addition layers and capabilities are defined
typeNames = doc.getElementsByTagName('TypeName')
for typeName in typeNames:
    # Get the TypeName to enable
    if typeName.firstChild.data == 'FeatureServer':
        extension = typeName.parentNode
        for extElement in extension.childNodes:
            # Enable feature access
            if extElement.tagName == 'Enabled':
                extElement.firstChild.data = 'true'

# Get all the value tags.
values = doc.getElementsByTagName('Value')
for value in values:
    if value.hasChildNodes():
        # Change the default WebCapabilities from 'Query,Create,Update,Delete,Uploads,Editing' to just 'Query'.
        if value.firstChild.data == 'Query,Create,Update,Delete,Uploads,Editing':
            value.firstChild.data = 'Query,Create,Update,Delete'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 22:03:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-instance-type-to-dedicated-with-1-and-2/m-p/1115444#M62940</guid>
      <dc:creator>tigerwoulds</dc:creator>
      <dc:date>2021-11-09T22:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to set Instance Type to Dedicated with 1 and 2 Min/Max instances in Service Definition draft?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-instance-type-to-dedicated-with-1-and-2/m-p/1115473#M62941</link>
      <description>&lt;P&gt;The way I was able change the min and max instances was using the &lt;A href="https://developers.arcgis.com/rest/enterprise-administration/server/service.htm" target="_self"&gt;REST API&lt;/A&gt;&amp;nbsp;after the publish is complete. I call "&lt;SPAN&gt;https://&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/enterprise-administration/server/services.htm" target="_blank" rel="noopener"&gt;&amp;lt;services-url&amp;gt;&lt;/A&gt;&lt;SPAN&gt;/&amp;lt;folder&amp;gt;/&amp;lt;serviceName.serviceType&amp;gt;"&amp;nbsp;&lt;/SPAN&gt; to get the JSON definition of the service, edit the JSON, then call "&lt;SPAN&gt;https://&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/enterprise-administration/server/services.htm" target="_blank" rel="noopener"&gt;&amp;lt;services-url&amp;gt;&lt;/A&gt;&lt;SPAN&gt;/&amp;lt;folder&amp;gt;/&amp;lt;serviceName.serviceType&amp;gt;/edit" to&amp;nbsp;&lt;/SPAN&gt;send it back.&amp;nbsp; There is probably an easier way...&amp;nbsp; I'm not sure about the instance type.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 23:32:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-instance-type-to-dedicated-with-1-and-2/m-p/1115473#M62941</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2021-11-09T23:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to set Instance Type to Dedicated with 1 and 2 Min/Max instances in Service Definition draft?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-instance-type-to-dedicated-with-1-and-2/m-p/1115480#M62942</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/192850"&gt;@DonMorrison1&lt;/a&gt;&amp;nbsp;Thanks for the response. I do actually have a script to change the instance type to dedicated and set the min/min instances after a service is published. FYI you can change the Instance Type from&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;https://&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/enterprise-administration/server/services.htm" target="_blank" rel="noopener nofollow noreferrer"&gt;&amp;lt;services-url&amp;gt;&lt;/A&gt;&lt;SPAN&gt;/&amp;lt;folder&amp;gt;/&amp;lt;serviceName.serviceType&amp;gt;/&lt;STRONG&gt;changeProvider&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Use 'ArcObjects11' for Dedicated and 'DMaps' for Shared&lt;/P&gt;&lt;P&gt;In terms of setting the service to Dedicated with the Min/Max before publishing, I think I have that figured out now.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;keys = doc.getElementsByTagName('Key')
for key in keys:
    k = key.firstChild.data
    v = key.nextSibling.firstChild
    if k == 'MinInstances':
        v.data = 0  # min instance
    elif k == 'MaxInstances':
        v.data = 1  # max instance
    elif k == 'provider':
        v.data = 'ArcObjects11'  # Dedicated Instance&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 02:30:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-instance-type-to-dedicated-with-1-and-2/m-p/1115480#M62942</guid>
      <dc:creator>tigerwoulds</dc:creator>
      <dc:date>2021-11-11T02:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to set Instance Type to Dedicated with 1 and 2 Min/Max instances in Service Definition draft?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-set-instance-type-to-dedicated-with-1-and-2/m-p/1115626#M62949</link>
      <description>&lt;P&gt;Very good.&amp;nbsp; If I recall correctly, I opted for the JSON route only because the python code seemed simpler doing the updates that way versus navigating through the dom.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 13:31:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-set-instance-type-to-dedicated-with-1-and-2/m-p/1115626#M62949</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2021-11-10T13:31:24Z</dc:date>
    </item>
  </channel>
</rss>

