I'm migrating a Python script that starts and stops services from ArcGIS Enterprise 10.6.1 to 10.9.1. In the ArcGIS API for Python, the function gis.admin.servers.list hangs now. If you enter gis.admin.servers.__dict__, there is an attribute _server_list that is None. Through the portal admin API, I can see our one server as being federated with the portal. I did not setup the server so I don't know all the details of how it was set up. I'm just wondering if anyone knows what direction to go.
Hey Nathan,
Are you connecting to Enterprise using an administrator account? If possible could you try testing this on a copy of ArcGIS Pro installed on the Enterprise machine?
This should hopefully rule out permissions or networking from the issue.
Many thanks,
David
Hi David,
I will look into it. I need to do more testing as to what is actually hanging. I was trying to figure out what syntax to use for IWA authentication. Apparently, you just need the server URL to make a GIS object. It may have been that it was hanging when I passed in credentials to the server which is configured to use IWA. I will confirm. I did find out that when I used the correct parameters for IWA authentication, it wasn't actually hanging. Instead, it was taking about 5 minutes 50 seconds to complete the list method. I paused the code and after about 10 seconds, the IDE would eventually pause in some code that was making a connection to the server. I did figure out that the part that was hanging was when the list method was building a ServiceDirectory object for the server, which was in turn trying to connect to the server.
It definitely was very quick on the old server and it was very slow on the new one. Eventually, it does complete and gives a list of one server object.
Whether or not I include the username and password doesn't change the behavior. It still takes 5 minutes to list the servers. So, it's not hanging, it's just very slow.
When I use the Python 3 command prompt on the server to create a GIS object, I get an invalid username and password error if I just provide the url parameter. If I provide a username and password, the list method completes very quickly.
I have had this issue yesterday. In my case, our notebook server service was offline while our federated arcgis server was online. gis.admin.servers.list() didn't even return a timeout after 30 minutes. It just hanged. Restarting the nbs service helped.
I was also having slow response using gis.admin.servers.list() in Enterprise 11.3 with IWA. I got much better performance directly creating the server object per the example below, except I built the GIS object using the URL instead (For example, gis = GIS('https://portal.domain.com/webadaptor')
Hope it helps someone!
https://developers.arcgis.com/python/api-reference/arcgis.gis.server.html#server
# Usage Example 3: Get the ArcGIS Server site that is federated to an Enterprise (using ``gis``) server_base_url = "https://example.com" gis = GIS(profile="your_ent_admin_profile") gis_server = Server(url=f"{server_base_url}/web_adaptor/admin", gis = gis)