arcgis.gis.server.ServerManager.get versus .list

267
2
01-26-2021 07:04 PM
NathanHeickLACSD
Occasional Contributor III

I am migrating from my own Python 2.7 package for performing administrative tasks against the various ArcGIS REST API endpoints to the ArcGIS API for Python.  The biggest question for day one is why do I get different results when I use the arcgis.gis.server.ServerManager.get method versus the arcgis.gis.server.ServerManager.list method.  For example, list gives me a list of one server that references the web adaptor URL while get returns a similar list with the direct administrative URL on the server.

Snippet.png

From here, I tested some code to find and start or stop a service.  The problem is that the list method server works and the get method server doesn't.  Now I can think hard about why one works and the other doesn't from an ArcGIS Server standpoint, but I don't see why the two different methods in the ArcGIS API for Python yield different results.

Second, the list method is very slow (about 1 minute), while the get method is very fast.  That is why I tried the get approach in the first place, namely to speed up the process.  If I were to make the REST requests directly, I wouldn't have to wait this minute for no apparent reason.

0 Kudos
2 Replies
MinbinJiang
Esri Contributor

I guess this might regard to your setting in Portal, namely, when you federate the server, server name with port provided. 

I can confirm the results are consistent from my end while federating without the port. 

Untitled picture.png

0 Kudos
NathanHeickLACSD
Occasional Contributor III

That's interesting.  I went to the Portal settings page and found the following:

  • Federated Server - https://servername:6443/arcgis
  • Hosted Server - https://servername/server

Here are the results when I make different method calls:

  • get("HOSTED_SERVER") - https://servername/server
  • get("FEDERATED_SERVER") - []
  • list() - https://servername:6443/arcgis

You can see how that is kind of strange behavior.  It's almost as if list really means list the federated servers.

Also, I really don't understand why list takes one minute and get takes one second.

0 Kudos