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.
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
To stop the services I need to get an admin token from the server it is running on.
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.
https://myaddress.com/arcgisONE/rest/services/gpService/stopMaps/GPServer
https://myaddress.com/arcgis/rest/services/gpService/stopMaps/GPServer
I'm thinking something like
arcpy.env.server.hostname == myaddress.com
arcpy.env.server.instance == arcgisONE
so it could construct https://myaddress.com/arcgisONE/tokens to request the required token
Cheers,
Steven