<?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: Pro - Analyze Service Draft results as python object in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1405310#M70250</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/11168"&gt;@FredSpataro&lt;/a&gt;&amp;nbsp;no never figured this out. Ended up checking the analysis messages during the stage process similar to the examples they have published in the MapServiceDraft help.&lt;/P&gt;&lt;P&gt;However this is not very desirable as you describe it takes for ever for large maps with unregistered data sources to copy to local data... and then for us to fail the script because this may not be the desirable result. Not sure why the difference in this workflow compared to Geocode Drafts or legacy MXD publications but certainly is not optimal and different than the UI experience.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Apr 2024 16:44:17 GMT</pubDate>
    <dc:creator>RonnieRichards</dc:creator>
    <dc:date>2024-04-03T16:44:17Z</dc:date>
    <item>
      <title>Pro - Analyze Service Draft results as python object</title>
      <link>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1282143#M67507</link>
      <description>&lt;P&gt;In the ArcGIS Desktop arcpy method CreateMapSDDraft it output a dictionary of the analysis results. This was easy to parse and perform actions before publication takes place.&amp;nbsp;&lt;A href="https://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/createmapsddraft.htm" target="_blank" rel="noopener"&gt;https://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/createmapsddraft.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In ArcGIS Pro it is a bit unclear the results of the analysis.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Stage Service does not explicitly state this except in one of the examples uses the arcpy.GetMessages(1) call to get the warnings. This appears to be text and not the easiest to parse.&lt;BR /&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/server/stage-service.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/tool-reference/server/stage-service.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;My parsing attempt:&amp;nbsp;&lt;SPAN&gt;analysisMessages&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;eval&lt;/SPAN&gt;&lt;SPAN&gt;(arcpy.GetMessages(&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;).split(&lt;/SPAN&gt;&lt;SPAN&gt;'('&lt;/SPAN&gt;&lt;SPAN&gt;)[&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;][:-&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;].strip())&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Is there another way to get the analysis results as a dictionary? It appears we have lost some functionality as we would like to look for any "copy to server" warnings before the publication process.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2023 14:47:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1282143#M67507</guid>
      <dc:creator>RonnieRichards</dc:creator>
      <dc:date>2023-04-25T14:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: Pro - Analyze Service Draft results as python object</title>
      <link>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1282805#M67515</link>
      <description>&lt;P&gt;Can you just set the output of the sddraft to a variable and access it that way?&amp;nbsp; I only have a CreateGeocodeSDDraft() to check this on, but doing this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;analyze_messages = arcpy.CreateGeocodeSDDraft(params and stuff)&lt;/LI-CODE&gt;&lt;P&gt;give mes this in the debugger:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;analyze_messages = {'errors': {}, 'warnings': {('Locator will be copied to the server', 24044): []}, 'messages': {('Composite locator will be copied to the server', 30009): []}}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 26 Apr 2023 14:14:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1282805#M67515</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-04-26T14:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Pro - Analyze Service Draft results as python object</title>
      <link>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1282840#M67519</link>
      <description>&lt;P&gt;Jeff thanks for the suggestion. This is interesting the workflow attempted here is with Map Services and very interesting they are different. What you are sharing makes sense from the workflow perspective and appears to work for Geocode SD drafts but not for map service drafts.&lt;/P&gt;&lt;P&gt;I am using:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;arcpy&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;sharing&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;CreateSharingDraft which results in a MapServiceDraft&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/sharing/createsharingdraft.htm" target="_blank" rel="noopener"&gt;CreateSharingDraft—ArcGIS Pro | Documentation&amp;nbsp;&amp;nbsp;&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/sharing/mapservicedraft-class.htm" target="_blank" rel="noopener"&gt;MapServiceDraft—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;MapServiceDraft.exportToSDDraft() - This only provides the path to the .sddraft which seems pointless since this is already the input object. Ideally this return would include messages dictionary such as the CreateGeocodeSD you shared and similar to the legacy&amp;nbsp;CreateMapSDDraft.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;arcpy.StageService is then used to create the SD and this returns warnings in the GetMessages(1) and errors are exceptions&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;It seems silly and in some way too late these messages are only returned when the arcpy.StageService occurs because when layers are identified as not registered with server, the process creating the .sd can take forever. In the old Map Service workflow this would not have progresses this far since our older scripts would warn the publisher to resolve the data sources before publication. In past. the layer data source is not registered warnings occurred&amp;nbsp;during the create draft phase and now this is part of staging?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 26 Apr 2023 15:03:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1282840#M67519</guid>
      <dc:creator>RonnieRichards</dc:creator>
      <dc:date>2023-04-26T15:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Pro - Analyze Service Draft results as python object</title>
      <link>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1282854#M67521</link>
      <description>&lt;P&gt;Yeah, it was worth a shot. I have some maps that I want to automate like this so I'll keep it in mind while creating the scripts and will take a look at it from the CreateSharingDraft onward.&amp;nbsp; I'm finding this process of automating publishing to be a lot more extensive and a lot less documented.&amp;nbsp; Especially for publishing routing services and the 'Create Route Analysis Layer' creating serialized datasets in the workspace instead of overwriting the one. Not very efficient.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 15:23:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1282854#M67521</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-04-26T15:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Pro - Analyze Service Draft results as python object</title>
      <link>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1405269#M70247</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7683"&gt;@RonnieRichards&lt;/a&gt;&amp;nbsp;Did you figure anything out on this?&amp;nbsp; I'm having about the same issue... setting sharing_draft.copyDataToServer = False and I want to be able to get the 'data source not registered' warning/error BEFORE creating the .sd file.&amp;nbsp; So far it will copy all the data locally, then tell me it's not registered.&amp;nbsp; Which is especially not good for large datasets.&amp;nbsp; The 'analyze' button in the UI must be doing something that's not exposed to the api or gp toolset?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 15:47:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1405269#M70247</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2024-04-03T15:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Pro - Analyze Service Draft results as python object</title>
      <link>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1405309#M70249</link>
      <description>&lt;P&gt;It looks like the old AnalyzeForSD is still there library but is appears to fail opening the APRX ...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from an ArcMap 10.8 install: mapping.py:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def AnalyzeForSD(sddraft):
    """AnalyzeForSD(sddraft)
       Analyzes Service Definition Draft ( .sddraft ) files to determine
       suitability and sources of potential performance issues before  converting
       a Service Definition Draft file to a Service Definition ( .sd )  file.
       
         sddraft(String):
       A string that represents the path and file name for the Service Definition
       Draft ( .sddraft ) file."""
    import arcgisscripting
    return convertArcObjectToPythonObject(arcgisscripting._analyzeForSD(*gp_fixargs([sddraft], True)))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My attempt at running this in Pro... all the imports work and it seems to start reading the sddraft&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcpy.arcobjects.arcobjectconversion import convertArcObjectToPythonObject
import arcgisscripting
from arcpy.geoprocessing._base import gp_fixargs
sddraft = r"C:\Temp\Map.sddraft"
r = convertArcObjectToPythonObject(arcgisscripting._analyzeForSD(*gp_fixargs([sddraft], True)))
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;File "&amp;lt;stdin&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ValueError: C:\Temp\Map.aprx&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 16:43:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1405309#M70249</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2024-04-03T16:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Pro - Analyze Service Draft results as python object</title>
      <link>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1405310#M70250</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/11168"&gt;@FredSpataro&lt;/a&gt;&amp;nbsp;no never figured this out. Ended up checking the analysis messages during the stage process similar to the examples they have published in the MapServiceDraft help.&lt;/P&gt;&lt;P&gt;However this is not very desirable as you describe it takes for ever for large maps with unregistered data sources to copy to local data... and then for us to fail the script because this may not be the desirable result. Not sure why the difference in this workflow compared to Geocode Drafts or legacy MXD publications but certainly is not optimal and different than the UI experience.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 16:44:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1405310#M70250</guid>
      <dc:creator>RonnieRichards</dc:creator>
      <dc:date>2024-04-03T16:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Pro - Analyze Service Draft results as python object</title>
      <link>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1405353#M70252</link>
      <description>&lt;P&gt;Thanks for the follow up... looks like someone else created an 'idea' for this:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/add-an-arcpy-mapping-analyzeforsd-equivalent-to/idc-p/1405280#M29212" target="_blank"&gt;https://community.esri.com/t5/arcgis-pro-ideas/add-an-arcpy-mapping-analyzeforsd-equivalent-to/idc-p/1405280#M29212&lt;/A&gt;&lt;/P&gt;&lt;P&gt;but classically not getting thru ...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 18:00:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/pro-analyze-service-draft-results-as-python-object/m-p/1405353#M70252</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2024-04-03T18:00:38Z</dc:date>
    </item>
  </channel>
</rss>

