<?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: Using multiprocessing in gp service in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-multiprocessing-in-gp-service/m-p/1620364#M74316</link>
    <description>&lt;P&gt;&amp;nbsp;I found the way to do it but it still in testing.&lt;/P&gt;&lt;P&gt;First you create and publish a separate script ("child") that do the part that should be executed in parallel.&lt;/P&gt;&lt;P&gt;It gets parameters just like any gp service.&lt;/P&gt;&lt;P&gt;Then you write a tool that run gp service (use this:&amp;nbsp;&lt;A href="https://enterprise.arcgis.com/en/server/10.8/publish-services/windows/using-a-service-in-python-scripts.htm#ESRI_SECTION1_76BCC792830C479298250C5C06652EE6" target="_blank"&gt;https://enterprise.arcgis.com/en/server/10.8/publish-services/windows/using-a-service-in-python-scripts.htm#ESRI_SECTION1_76BCC792830C479298250C5C06652EE6&lt;/A&gt;&amp;nbsp; ).&lt;/P&gt;&lt;P&gt;In such a script you can control the number of parallel instances, giving each one a different variable and then check that all instances are finished before continue the father script that aggregate or append the results.&lt;/P&gt;&lt;P&gt;the child script should return his private results to the caller somehow (url to the results or string).&lt;/P&gt;&lt;P&gt;After the father script was running in Pro I had not problem publishing it as gp service as a "father" service.&lt;/P&gt;&lt;P&gt;Running this father service I could see the number of running processes for the "child" service going up when&amp;nbsp;the father script run a few instances of the child in parallel.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jun 2025 10:43:25 GMT</pubDate>
    <dc:creator>ModyBuchbinder</dc:creator>
    <dc:date>2025-06-03T10:43:25Z</dc:date>
    <item>
      <title>Using multiprocessing in gp service</title>
      <link>https://community.esri.com/t5/python-questions/using-multiprocessing-in-gp-service/m-p/1617517#M74242</link>
      <description>&lt;P&gt;I would like to use multiprocessing module in python to use more cores in process that I can split to independent parts.&lt;/P&gt;&lt;P&gt;I create a small script. Running it in Pro works (but open a CMD window) and I could publish it to the server.&lt;/P&gt;&lt;P&gt;It does not work on the server and gives no error message.&lt;/P&gt;&lt;P&gt;Second test that I tried is to write a python that uses multiprocessing. Then create a short bat file that call this script.&lt;/P&gt;&lt;P&gt;Then my main script in pro just do os.system(bat file).&lt;/P&gt;&lt;P&gt;Again, runs in Pro, published with no comments but does not run on server.&lt;/P&gt;&lt;P&gt;Found this:&amp;nbsp;&lt;A href="https://community.esri.com/t5/python-questions/usage-of-multiprocessing-in-a-python-based/m-p/50820#M4017" target="_blank"&gt;https://community.esri.com/t5/python-questions/usage-of-multiprocessing-in-a-python-based/m-p/50820#M4017&lt;/A&gt;&amp;nbsp;from few years back with no answer.&lt;/P&gt;&lt;P&gt;Anybody have an idea?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 22 May 2025 13:53:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-multiprocessing-in-gp-service/m-p/1617517#M74242</guid>
      <dc:creator>ModyBuchbinder</dc:creator>
      <dc:date>2025-05-22T13:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using multiprocessing in gp service</title>
      <link>https://community.esri.com/t5/python-questions/using-multiprocessing-in-gp-service/m-p/1617537#M74243</link>
      <description>&lt;P&gt;What Message Level do you have the GP service set to?&amp;nbsp; If it is set to Info, the client should get all of the messages and errors back from the job.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 May 2025 14:33:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-multiprocessing-in-gp-service/m-p/1617537#M74243</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2025-05-22T14:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using multiprocessing in gp service</title>
      <link>https://community.esri.com/t5/python-questions/using-multiprocessing-in-gp-service/m-p/1617546#M74245</link>
      <description>&lt;P&gt;For someone who has designed, configured, and managed many ArcGIS Enterprise deployments supporting upwards of tens of thousands of GIS services, using multiprocessing in a geoprocessing service comes with enormous risks to the stability of the service and the application as a whole.&amp;nbsp; Depending on how the multiprocessing jobs are setup, and how the GP service is configured, it would be very easy for a single GP service to overwhelm all of the resources on an ArcGIS Enterprise deployment.&amp;nbsp; Maybe this has already been thought through and discussed with the OS admins, but I mention it here as a general warning to others who might come across this thread.&lt;/P&gt;</description>
      <pubDate>Thu, 22 May 2025 14:38:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-multiprocessing-in-gp-service/m-p/1617546#M74245</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2025-05-22T14:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using multiprocessing in gp service</title>
      <link>https://community.esri.com/t5/python-questions/using-multiprocessing-in-gp-service/m-p/1617851#M74264</link>
      <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;My message setting is info and I get NO messages.&lt;/P&gt;&lt;P&gt;I am aware of the resources problem. If you use multiprocessing&amp;nbsp;wisely you can limit the number of parallel processes.&lt;/P&gt;&lt;P&gt;If you have a server with many cores and each gp service do a lot of work but does not called very often you should be able to get better performance.&lt;/P&gt;&lt;P&gt;Currently the tool just ended without calling the function I need to run in parallel.&lt;/P&gt;&lt;P&gt;Again, it works on Pro so my code is working. Something in the server env stopping it.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 May 2025 07:44:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-multiprocessing-in-gp-service/m-p/1617851#M74264</guid>
      <dc:creator>ModyBuchbinder</dc:creator>
      <dc:date>2025-05-23T07:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using multiprocessing in gp service</title>
      <link>https://community.esri.com/t5/python-questions/using-multiprocessing-in-gp-service/m-p/1620364#M74316</link>
      <description>&lt;P&gt;&amp;nbsp;I found the way to do it but it still in testing.&lt;/P&gt;&lt;P&gt;First you create and publish a separate script ("child") that do the part that should be executed in parallel.&lt;/P&gt;&lt;P&gt;It gets parameters just like any gp service.&lt;/P&gt;&lt;P&gt;Then you write a tool that run gp service (use this:&amp;nbsp;&lt;A href="https://enterprise.arcgis.com/en/server/10.8/publish-services/windows/using-a-service-in-python-scripts.htm#ESRI_SECTION1_76BCC792830C479298250C5C06652EE6" target="_blank"&gt;https://enterprise.arcgis.com/en/server/10.8/publish-services/windows/using-a-service-in-python-scripts.htm#ESRI_SECTION1_76BCC792830C479298250C5C06652EE6&lt;/A&gt;&amp;nbsp; ).&lt;/P&gt;&lt;P&gt;In such a script you can control the number of parallel instances, giving each one a different variable and then check that all instances are finished before continue the father script that aggregate or append the results.&lt;/P&gt;&lt;P&gt;the child script should return his private results to the caller somehow (url to the results or string).&lt;/P&gt;&lt;P&gt;After the father script was running in Pro I had not problem publishing it as gp service as a "father" service.&lt;/P&gt;&lt;P&gt;Running this father service I could see the number of running processes for the "child" service going up when&amp;nbsp;the father script run a few instances of the child in parallel.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jun 2025 10:43:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-multiprocessing-in-gp-service/m-p/1620364#M74316</guid>
      <dc:creator>ModyBuchbinder</dc:creator>
      <dc:date>2025-06-03T10:43:25Z</dc:date>
    </item>
  </channel>
</rss>

