<?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 Is multi-processing supported in custom ArcGis Pro scripts? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/is-multi-processing-supported-in-custom-arcgis-pro/m-p/801463#M2010</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having problems running a multi-process script when executed from the ArcGIS Pro application.&amp;nbsp; The script works fine when invoked from the command line.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is sample code to reproduce the problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;import arcpy&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;import multiprocessing&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;def mp_process(inputs):&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; task = inputs&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; # do some work&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; return task&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;if __name__ == "__main__":&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; # create pool&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; pool = multiprocessing.Pool(2)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; arcpy.AddMessage(str(pool.map(mp_process, [1,2,3,4])))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This simple geo-processing script fails to execute when invoked from ArcGIS Pro.&amp;nbsp; The following exception is reported:&lt;/P&gt;&lt;P&gt;_pickle.PicklingError: Can't pickle &amp;lt;function mp_process at 0x000001C5CD672510&amp;gt;: attribute lookup mp_process on __main__ failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can run this script from the command line with no issues, but from ArcGIS Pro it throws this exception.&amp;nbsp; Does anyone know if there is a way to implement multi-processing in ArcGIS Pro custom geoprocessing tools??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Dec 2018 13:29:20 GMT</pubDate>
    <dc:creator>JoseManriquez</dc:creator>
    <dc:date>2018-12-17T13:29:20Z</dc:date>
    <item>
      <title>Is multi-processing supported in custom ArcGis Pro scripts?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/is-multi-processing-supported-in-custom-arcgis-pro/m-p/801463#M2010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having problems running a multi-process script when executed from the ArcGIS Pro application.&amp;nbsp; The script works fine when invoked from the command line.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is sample code to reproduce the problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;import arcpy&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;import multiprocessing&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;def mp_process(inputs):&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; task = inputs&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; # do some work&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; return task&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;if __name__ == "__main__":&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; # create pool&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; pool = multiprocessing.Pool(2)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; arcpy.AddMessage(str(pool.map(mp_process, [1,2,3,4])))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This simple geo-processing script fails to execute when invoked from ArcGIS Pro.&amp;nbsp; The following exception is reported:&lt;/P&gt;&lt;P&gt;_pickle.PicklingError: Can't pickle &amp;lt;function mp_process at 0x000001C5CD672510&amp;gt;: attribute lookup mp_process on __main__ failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can run this script from the command line with no issues, but from ArcGIS Pro it throws this exception.&amp;nbsp; Does anyone know if there is a way to implement multi-processing in ArcGIS Pro custom geoprocessing tools??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Dec 2018 13:29:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/is-multi-processing-supported-in-custom-arcgis-pro/m-p/801463#M2010</guid>
      <dc:creator>JoseManriquez</dc:creator>
      <dc:date>2018-12-17T13:29:20Z</dc:date>
    </item>
  </channel>
</rss>

