<?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 can I debug a script tool that is running multiple threads? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-can-i-debug-a-script-tool-that-is-using/m-p/496373#M38979</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You mention splitting "the work between multiple threads," but then you also state that Add Message "does not work inside multiprocessing."&amp;nbsp; Multi-threading and multi-processing are not one of the same.&amp;nbsp; Are you using Python &lt;A class="link-titled" href="https://docs.python.org/3/library/multiprocessing.html" title="https://docs.python.org/3/library/multiprocessing.html"&gt;multiprocessing — Process-based parallelism — Python 3.7.3 documentation&lt;/A&gt; ?&amp;nbsp; If so, what is the overall structure of your multiprocessing?&amp;nbsp; And, what geoprocessing tools or ArcPy classes are you using?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 May 2019 21:56:09 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2019-05-20T21:56:09Z</dc:date>
    <item>
      <title>How can I debug a script tool that is using multiprocessing?</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-debug-a-script-tool-that-is-using/m-p/496372#M38978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a script tool that does a lot of processing on large amounts of data and needs to split the work between multiple CPUs to be efficient; however, I am having trouble understanding how I can debug the work that is happening within each CPU.&amp;nbsp;It seems that arcpy.AddMessage does not work inside multiprocessing and I can't seem to attach my debugger to the command window that is opened when I run the tool. When I try attaching none of my breakpoints are hit and it says no symbols have been loaded.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 May 2019 21:49:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-debug-a-script-tool-that-is-using/m-p/496372#M38978</guid>
      <dc:creator>KylePerri</dc:creator>
      <dc:date>2019-05-20T21:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can I debug a script tool that is running multiple threads?</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-debug-a-script-tool-that-is-using/m-p/496373#M38979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You mention splitting "the work between multiple threads," but then you also state that Add Message "does not work inside multiprocessing."&amp;nbsp; Multi-threading and multi-processing are not one of the same.&amp;nbsp; Are you using Python &lt;A class="link-titled" href="https://docs.python.org/3/library/multiprocessing.html" title="https://docs.python.org/3/library/multiprocessing.html"&gt;multiprocessing — Process-based parallelism — Python 3.7.3 documentation&lt;/A&gt; ?&amp;nbsp; If so, what is the overall structure of your multiprocessing?&amp;nbsp; And, what geoprocessing tools or ArcPy classes are you using?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 May 2019 21:56:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-debug-a-script-tool-that-is-using/m-p/496373#M38979</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-05-20T21:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: How can I debug a script tool that is using multiprocessing?</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-debug-a-script-tool-that-is-using/m-p/496374#M38980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, you're right. I edited my post. I am using multiprocessing not multithreading.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 May 2019 22:02:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-debug-a-script-tool-that-is-using/m-p/496374#M38980</guid>
      <dc:creator>KylePerri</dc:creator>
      <dc:date>2019-05-20T22:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I debug a script tool that is using multiprocessing?</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-debug-a-script-tool-that-is-using/m-p/496375#M38981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might find it easier to do this outside of the ArcMap/ArcGIS Pro application environment using a standalone script, and log to a separate file. As it happens, I put this up last night, which may be helpful:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/people/ctognelaesriaustralia-com-au-esridist/blog/2019/05/20/threading-and-subprocessing-for-speed-and-resilience"&gt;https://community.esri.com/people/ctognelaesriaustralia-com-au-esridist/blog/2019/05/20/threading-and-subprocessing-for-speed-and-resilience&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The bugs you're running into, are they because you're doing multi-process work? Or are they potentially problems in the data you're processing, etc--what I'm trying to say is, if you weren't multi-processing, would you still run into these issues? If they're the latter, then perhaps sticking with a single thread--that you can debug--while you work on solving those problems against a subset of the data would be useful. Adding multi-processing can make them difficult to track down.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Raymond Hettinger has a couple of good talks on concurrency. Here's one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=9zinZmE3Ogk"&gt;https://www.youtube.com/watch?v=9zinZmE3Ogk&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 May 2019 23:20:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-debug-a-script-tool-that-is-using/m-p/496375#M38981</guid>
      <dc:creator>ChrisTognela</dc:creator>
      <dc:date>2019-05-20T23:20:56Z</dc:date>
    </item>
  </channel>
</rss>

