<?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: Get request address within server geoprocessing job in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/get-request-address-within-server-geoprocessing/m-p/319468#M12225</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the &lt;A href="https://docs.python.org/2/library/socket.html" rel="nofollow noopener noreferrer" target="_blank"&gt;socket&lt;/A&gt; module to get the hostname:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import socket
...
hostname = socket.gethostname()&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure about the server instance. Does each instance have a different &lt;EM&gt;arcpy.env.scratchWorkspace&lt;/EM&gt; that could be used to differentiate them?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 15:11:17 GMT</pubDate>
    <dc:creator>OwenEarley</dc:creator>
    <dc:date>2021-12-11T15:11:17Z</dc:date>
    <item>
      <title>Get request address within server geoprocessing job</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/get-request-address-within-server-geoprocessing/m-p/319467#M12224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm wanting to know if a server arcpy geoprocessing job has any awareness of the url it was requested by, or what web adapter instance it is running on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let say I want a geoprocessing script that will stop all running mapserver instances on its server, and I want to deploy this same script across multiple servers, each with different web adaptors&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To stop the services I need to get an admin token from the server it is running on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So given the two servers below, is it possible to have the same gp task published on each of them, know what server to request the token from? Without explicitly passing it in as parameter of the job.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="https://myaddress.com/arcgisONE/rest/services/gpService/stopMaps/GPServer" rel="nofollow" target="_blank"&gt;https://myaddress.com/arcgisONE/rest/services/gpService/stopMaps/GPServer&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="https://myaddress.com/arcgis/rest/services/gpService/stopMaps/GPServer" rel="nofollow" target="_blank"&gt;https://myaddress.com/arcgis/rest/services/gpService/stopMaps/GPServer&lt;/A&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm thinking something like &lt;/P&gt;&lt;P&gt;arcpy.env.server.hostname == myaddress.com&lt;/P&gt;&lt;P&gt;arcpy.env.server.instance == arcgisONE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;so it could construct&amp;nbsp; &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://myaddress.com/arcgisONE/tokens" rel="nofollow" target="_blank"&gt;https://myaddress.com/arcgisONE/tokens&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; to request the required token&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Steven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 04:43:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/get-request-address-within-server-geoprocessing/m-p/319467#M12224</guid>
      <dc:creator>StevenHaslemore</dc:creator>
      <dc:date>2015-05-14T04:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get request address within server geoprocessing job</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/get-request-address-within-server-geoprocessing/m-p/319468#M12225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the &lt;A href="https://docs.python.org/2/library/socket.html" rel="nofollow noopener noreferrer" target="_blank"&gt;socket&lt;/A&gt; module to get the hostname:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import socket
...
hostname = socket.gethostname()&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure about the server instance. Does each instance have a different &lt;EM&gt;arcpy.env.scratchWorkspace&lt;/EM&gt; that could be used to differentiate them?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:11:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/get-request-address-within-server-geoprocessing/m-p/319468#M12225</guid>
      <dc:creator>OwenEarley</dc:creator>
      <dc:date>2021-12-11T15:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: Get request address within server geoprocessing job</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/get-request-address-within-server-geoprocessing/m-p/319469#M12226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah, so this will give us the server name, from here we can assume the standard port to hit the arcgis server directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not quite what I was fishing for but could solve my example case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Different example&lt;/P&gt;&lt;P&gt;If it was a clustered server scenario, running different services on each server, accessed through the same web adapter, and we had to request a service back from the cluster, we'd need to hit the web adapter to find our service. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 15:32:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/get-request-address-within-server-geoprocessing/m-p/319469#M12226</guid>
      <dc:creator>StevenHaslemore</dc:creator>
      <dc:date>2015-05-14T15:32:34Z</dc:date>
    </item>
  </channel>
</rss>

