<?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: MakeFeatureLayer fails in multiprocessing python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498919#M39157</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have generally had more success scaling performance with multiprocessing than with multithreading, but a lot depends on the extensions/packages being used and specific structure of the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe ArcPy requires CPython.&amp;nbsp; Unless functions are specifically written to address the GIL, which CPyton has, multithreading code won't always perform as people might expect.&amp;nbsp; But again, it depends on the specifics.&amp;nbsp; And, if locking I/O is problematic and multithreading can address it, it beats multiprocessing code that doesn't run at all.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Jul 2014 16:50:26 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2014-07-25T16:50:26Z</dc:date>
    <item>
      <title>MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498913#M39151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--- Update -------------------------------&lt;/P&gt;&lt;P&gt;See later posts for specific problem description.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i try to use python multiprocessing to do some processing on chunks of a feature class. I changed the third example from this esri post: &lt;A href="http://blogs.esri.com/esri/arcgis/2012/09/26/distributed-processing-with-arcgis-part-1/" title="http://blogs.esri.com/esri/arcgis/2012/09/26/distributed-processing-with-arcgis-part-1/"&gt;Multiprocessing with ArcGIS – Approaches and Considerations (Part 1) | ArcGIS Blog&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;If i set the poolsize to 1 it runs correctly but if i use more than one process "MakeFeatureLayer" throws a "Cannot open file" or "Dataset does not exist or is not supported" error most of the time for every process but the first one. (I use "MakeFeatureLayer" on three different Files in every process and it fails at one of them for sure)&lt;/P&gt;&lt;P&gt;It seems to be an error related to accesing the same file at the same time out of different processes, because inserting a waiting time befor starting the "MakeFeatureLayer" methods seems to work. Because this problem is not mentioned in the esri post or somewhere else in the www i think it must be my mistake but i just do the same thing like esri in their third example of the mentioned post &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; The only thing mentioned in the blogpost is that you cannot use multiprocessing to update data in a gdb but "MakeFeatureLayer" needs only read access, doesn't it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14059390015935620 jive_text_macro" jivemacro_uid="_14059390015935620"&gt;
&lt;P&gt;def worker(ranges):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i = ranges[0]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; j = ranges[1]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("started processing thread ")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(ranges)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CheckOutExtension("3D")&lt;/P&gt;
&lt;P&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; time.sleep(1*(ranges[2]-1))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; samples=arcpy.MakeFeatureLayer_management(Input_Point_Features, "point_layer{0}".format(i), "OBJECTID &amp;gt;= {0} AND OBJECTID &amp;lt;= {1}".format(i, j))&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;anyone some suggestions?&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 10:42:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498913#M39151</guid>
      <dc:creator>GeorgZweyer</dc:creator>
      <dc:date>2014-07-21T10:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498914#M39152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At least for me, it is hard to provide much feedback given the limited code snippet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you executing this code through the interactive Python window in ArcGIS Desktop? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 16:48:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498914#M39152</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2014-07-23T16:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498915#M39153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Joshua,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;no it runs as a script tool and out of process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so this is a edited version of the example from the esri blog post i used. (my code is much more complex now but i can explain my problem better with that snipplet)&lt;/P&gt;&lt;P&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;&amp;nbsp; &lt;/CODE&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14062109117204941 jive_text_macro" jivemacro_uid="_14062109117204941" modifiedtitle="true"&gt;
&lt;P&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;&amp;nbsp; import&lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;multiprocessing&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;&lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0px !important; padding: 0px !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"&gt;&amp;nbsp; import&lt;/CODE&gt; &lt;CODE class="python plain" style="font-size: 13px; margin: 0px !important; padding: 0px !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"&gt;numpy&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0px !important; padding: 0px !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"&gt;&lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0px !important; padding: 0px !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"&gt;&amp;nbsp; import&lt;/CODE&gt; &lt;CODE class="python plain" style="font-size: 13px; margin: 0px !important; padding: 0px !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"&gt;arcpy&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0px !important; padding: 0px !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"&gt;&lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0px !important; padding: 0px !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"&gt;&amp;nbsp; def&lt;/CODE&gt; &lt;CODE class="python plain" style="font-size: 13px; margin: 0px !important; padding: 0px !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"&gt;worker(ranges):&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="index4 line alt2 number5" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;i, j &lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;=&lt;/CODE&gt; &lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;ranges[&lt;/CODE&gt;&lt;CODE class="python value" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: #009900 !important; background: none !important;"&gt;0&lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;], ranges[&lt;/CODE&gt;&lt;CODE class="python value" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: #009900 !important; background: none !important;"&gt;1&lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;]&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line index5 alt1 number6" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;lyr &lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;=&lt;/CODE&gt; &lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;arcpy.management.MakeFeatureLayer(&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line number7 alt2 index6" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python string" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: blue !important; background: none !important;"&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;Input_Point_Features&lt;/SPAN&gt;&lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;,&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line number8 alt1 index7" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue;"&gt;"point_layer{0}"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt;.format(i)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;, &lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line number8 alt1 index7" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python comments" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: #008200 !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue;"&gt;"OBJECTID &amp;gt;= {0} AND OBJECTID &amp;lt;= {1}"&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt;.format(i, j)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;SPAN style="color: black; font-size: 13px; line-height: 1.5; background-color: initial;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="line alt1 index9 number10" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px !important; padding: 0px 1em !important; background: none white !important;"&gt;&lt;SPAN style="color: #333333; font-size: 14px;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; result&lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;_table &lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;=&lt;/CODE&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;calculatesomething(lyr)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="line index12 number13 alt2" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;result_array &lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;=&lt;/CODE&gt; &lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;arcpy.da.TableToNumPyArray(result_table, [&lt;/CODE&gt;&lt;CODE class="python string" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: blue !important; background: none !important;"&gt;"*"&lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;])&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line number14 alt1 index13" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;arcpy.management.Delete(gn_table)&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line number15 index14 alt2" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;return&lt;/CODE&gt; &lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;result_array&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line number16 alt1 index15" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python comments" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: #008200 !important; background: none !important;"&gt;# End generate_near_table function&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="number17 line alt2 index16" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;/P&gt;
&lt;P class="number17 line alt2 index16" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;def&lt;/CODE&gt; &lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;main():&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="index18 line alt2 number19" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px !important; padding: 0px 1em !important; background: none white !important;"&gt;&lt;SPAN style="color: #333333; font-size: 14px;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;ranges &lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;=&lt;/CODE&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;somegeneratetvalues&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="index18 line alt2 number19" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px !important; padding: 0px 1em !important; background: none white !important;"&gt;&lt;/P&gt;
&lt;P class="line number23 index22 alt2" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;pool &lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;=&lt;/CODE&gt; &lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;multiprocessing.Pool()&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line number24 alt1 index23" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;result_arrays &lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;=&lt;/CODE&gt; &lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;pool.&lt;/CODE&gt;&lt;CODE class="python functions" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: #ff1493 !important; background: none !important;"&gt;map&lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;(worker, ranges)&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line index24 number25 alt2" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;/P&gt;
&lt;P class="line index25 number26 alt1" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python comments" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: #008200 !important; background: none !important;"&gt;# Concatenate the resulting arrays and create an output table&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="index26 line alt2 number27" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python comments" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: #008200 !important; background: none !important;"&gt;# reporting any identical records.&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line index27 alt1 number28" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;result_array &lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;=&lt;/CODE&gt; &lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;numpy.concatenate(result_arrays,axis&lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;=&lt;/CODE&gt;&lt;CODE class="python value" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: #009900 !important; background: none !important;"&gt;0&lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;)&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="number29 line alt2 index28" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;arcpy.da.NumPyArrayToTable(result_array, "mytargetlocation"&lt;/CODE&gt;&lt;CODE class="python string" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: blue !important; background: none !important;"&gt;&lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;)&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line alt1 number30 index29" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;/P&gt;
&lt;P class="line index30 number31 alt2" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python comments" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: #008200 !important; background: none !important;"&gt;# Synchronize the main process with the job processes to&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line number32 index31 alt1" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python comments" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: #008200 !important; background: none !important;"&gt;# Ensure proper cleanup.&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line number33 index32 alt2" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;pool.close()&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line number34 alt1 index33" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;pool.join()&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="number35 line alt2 index34" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python comments" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: #008200 !important; background: none !important;"&gt;# End main&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="index35 line alt1 number36" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;/P&gt;
&lt;P class="line index36 alt2 number37" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;if&lt;/CODE&gt; &lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;__name__ &lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;=&lt;/CODE&gt;&lt;CODE class="python keyword" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: bold !important; color: #006699 !important; background: none !important;"&gt;=&lt;/CODE&gt; &lt;CODE class="python string" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: blue !important; background: none !important;"&gt;'__main__'&lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;:&lt;/CODE&gt;&lt;/P&gt;
&lt;P class="line index37 alt1 number38" style="font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; color: #333333; margin: 0 !important; padding: 0 1em !important; background: none white !important;"&gt;&lt;CODE class="python spaces" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; background: none !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/CODE&gt;&lt;CODE class="python plain" style="font-size: 13px; margin: 0 !important; padding: 0 !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; color: black !important; background: none !important;"&gt;main()&lt;/CODE&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is:&lt;/P&gt;&lt;P&gt;MakeFeatureLayer fails if two or more processes try to run it on the same data at the same time.If i run it&amp;nbsp; with two processes and insert a few seconds waiting time for one of them everything is fine. But every example i could find on the internet used MakeFeatureLayer and multiprocessing equaly to the code above and none of them used some sort of mutual exclusion.&lt;/P&gt;&lt;P&gt;(I'm using multiprocessing.Lock right now to fix the problem and it works most of the time. Still sometimes it fails. I think the cause of this is ArcScene running and occasionally accessing the data in the same moment i try to use MakeFeatureLayer on it, but i'm not sure about it)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 14:22:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498915#M39153</guid>
      <dc:creator>GeorgZweyer</dc:creator>
      <dc:date>2014-07-24T14:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498916#M39154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What happens if you set maxtasksperchild=1 when instantiating the pool?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;I realize this isn't a good idea operationally since it will kill performance, especially on Windows, but it will be interesting to see how it affects the errors.&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 14:43:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498916#M39154</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2014-07-24T14:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498917#M39155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also, how big are the data sets you are working with?&amp;nbsp; Would it be possible for each child process to make an in-memory copy of the data set, or possibly a temporary copy on disk?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there is some kind of file locking occurring, even though you aren't editing the data, maybe giving each child process its own copy of the data to work on would work around the issue.&amp;nbsp; Clunky, but you will still need a workaround if this is being caused by a bug.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 15:03:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498917#M39155</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2014-07-24T15:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498918#M39156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The locking could be a cause but if no edits are being made it shouldnt lock out just reading. Locks are made at the process level so multi-threading is often fine while multi-processing isn't in cases such as shapefiles or FGBDs where there is not multi-user editing functionality. Try using threads instead of processes and see what happens. I usually use threading for that reason, you only show up once in the database connection log so you cant lock yourself out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jul 2014 14:33:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498918#M39156</guid>
      <dc:creator>ChrisMathers</dc:creator>
      <dc:date>2014-07-25T14:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498919#M39157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have generally had more success scaling performance with multiprocessing than with multithreading, but a lot depends on the extensions/packages being used and specific structure of the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe ArcPy requires CPython.&amp;nbsp; Unless functions are specifically written to address the GIL, which CPyton has, multithreading code won't always perform as people might expect.&amp;nbsp; But again, it depends on the specifics.&amp;nbsp; And, if locking I/O is problematic and multithreading can address it, it beats multiprocessing code that doesn't run at all.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jul 2014 16:50:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498919#M39157</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2014-07-25T16:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498920#M39158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Joshua and Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first of all thanks for your answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;What happens if you set maxtasksperchild=1 when instantiating the pool?&lt;/SPAN&gt;&lt;/P&gt;

&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It happens while the workers work on the first set of tasks so this won't help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Also, how big are the data sets you are working with?&amp;nbsp; Would it be possible for each child process to make an in-memory copy of the data set, or possibly a temporary copy on disk?&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well the MakeFeatureLayer function calls are for exactly this purpose. Calling some function that have to read the same data synchronously failed in the past so i came up with this. (This shouldn't have happened, too, cause all these functions also just need reading access to the data)&lt;/P&gt;&lt;P&gt;I can try to make a copy "in_memory" rather than a layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Try using threads instead of processes and see what happens.&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could try this, but it would not be a solution to the problem cause i implemented multiprocessing to make use of multiple processor cores. Multithreading doesn't offer that as far as i know in the Python implementation ArcGIS uses.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One workaround i have in mind is to catch the exception earlier and let the process try the data access once more.&lt;/P&gt;&lt;P&gt;Also i ran the script as a standalone python script (with ArcGIS completly closed) for an hour without an error wich is a clue for my "&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;ArcScene running is occasionally accessing the data in the same moment i try to use MakeFeatureLayer on it" theory to be correct.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;Is there a chance that someone from esri stumbles upon this thread and give an answer on the expected behavior of the "MakeFeatureLayer" function or do i have to contact tech support directly?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2014 08:06:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498920#M39158</guid>
      <dc:creator>GeorgZweyer</dc:creator>
      <dc:date>2014-07-28T08:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498921#M39159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you think ArcScene is actually causing the problem, in terms of locking the file, I wonder what would happen if you went into Windows Explorer and made the files in question read-only.&amp;nbsp; It could be it makes everything worse, or it might prevent ArcScene from exclusively accessing the file when other programs are trying to read it.&amp;nbsp; Simple enough to try.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2014 13:24:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498921#M39159</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2014-07-28T13:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498922#M39160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for the participation so far. Sadly my problem still persists. I still think that ArcScene is causing it somehow but not that simultaneous file access from ArcScene is the cause anymore. I inserted a retry mechanism that trys the data access two additional times after two 10 seconds breaks, but the data access fails everytime. I looked into the folder of the gdb and could not find any abnormal lock files there. One sr.lock for every data source and every process and one rd.lock everytime data is acually read. &lt;/P&gt;&lt;P&gt;Furthermore, it looks like this problem only occures if the script is started out of ArcScene, not if ArcScene is just running like i thought before, but i am not sure about that, because there is no way to reliable reproduce the error. So starting the script out of a command line window seems to work correctly.&lt;/P&gt;&lt;P&gt;I also noticed that in addition to the &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;"Cannot open file" and "Dataset does not exist or is not supported" errors, sometimes a "Error executing function" error is thrown.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;One more point. Runing the script out of ArcScene with only one worker process seems to work correctly, again this is only an asumption, but it is not the case that there is always one worker thread which is fine. I had one test with 4 worker processes and 2 of them crashed during the handling of their first task and the other 2 during their second.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am pretty frustrated right now and i am running out of ideas. The only solution for me now seems to be to only use the script out of the command line.&lt;/P&gt;&lt;P&gt;As i am writing this it comes to my mind that i am using layers as input if i run the script from inside ArcScene which is not the case if i run it from command line, so maybe there is a problem with using "MakeFeatureLayer" on layer?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for any language errors. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jul 2014 13:24:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498922#M39160</guid>
      <dc:creator>GeorgZweyer</dc:creator>
      <dc:date>2014-07-29T13:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498923#M39161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does enabling or disabling 'Background Processing' make a difference?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the script works fine from a Windows command line, and even when ArcScene is open, I am wondering if there is a communication issue between ArcScene and the process it is spawning, if Background Processing is enabled.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jul 2014 13:50:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498923#M39161</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2014-07-29T13:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498924#M39162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It runs without background processing. I tried it with now, but i dont get my console output anymore, so its hard to tell if any error occurs. Maybe i can write to a log file, but i dont think enableing background processing would better anything &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But that was a good idea &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt; background processing often screws up everything &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2014 07:47:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498924#M39162</guid>
      <dc:creator>GeorgZweyer</dc:creator>
      <dc:date>2014-07-30T07:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498925#M39163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After a few test runs i seem to have found the cause of the problem. Well not really the cause of the problem but at least the case were it can occur.&lt;/P&gt;&lt;P&gt;As i mentioned in my last post the only difference between starting it from comandline or from ArcScene is that i use Layers as input if i start it from ArcScene. So i made a few runs from inside ArcGis with only "true files" as input and no error occured so far!&lt;/P&gt;&lt;P&gt;So the problem seems to be: &lt;STRONG&gt;Error in "MakeFeatureLayer" on layer while multiprocessing in python&lt;/STRONG&gt;. (Well also on raster layer and "CopyFeatures/Raster" also throws ErrorExecutingFunction sometimes)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2014 08:50:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498925#M39163</guid>
      <dc:creator>GeorgZweyer</dc:creator>
      <dc:date>2014-07-30T08:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498926#M39164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does this have to be run from within ArcScene? Can you just run it stand alone with Scene closed?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2014 13:24:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498926#M39164</guid>
      <dc:creator>ChrisMathers</dc:creator>
      <dc:date>2014-07-30T13:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498927#M39165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No that's not really a must have. I just wanted to make it possible to use layers with selections as input. Also running it from ArcScene but without using layers as input seems to work fine. Well i think i just have to get along with that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2014 07:22:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/498927#M39165</guid>
      <dc:creator>GeorgZweyer</dc:creator>
      <dc:date>2014-07-31T07:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: MakeFeatureLayer fails in multiprocessing python</title>
      <link>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/1498066#M70925</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;Any news on this issue? I'm having the same problem using ArcGIS Pro 2.9.5. My input feature class sits in SQL Server. Using arcpy.Exists() it is easy to see that it returns False sometimes, which makes no sense. It is pretty random.&amp;nbsp;In my case, I wonder if this issue is somehow related with this one, only that this seems to have been fixed in ArcGIS Server specifically:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://support.esri.com/es-es/bug/in-arcgis-pro-when-a-geoprocessing-service-is-created-f-bug-000151441" target="_blank"&gt;BUG-000151441 for ArcGIS GIS Server (esri.com)&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I could add a retry until it returns True, but i'm not sure if the subsequent functions will work as this data access error is random.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jose&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 06:09:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/makefeaturelayer-fails-in-multiprocessing-python/m-p/1498066#M70925</guid>
      <dc:creator>JoseSousa</dc:creator>
      <dc:date>2024-06-27T06:09:07Z</dc:date>
    </item>
  </channel>
</rss>

