ServicesDirectory is mind bogglingly slow

106
1
Jump to solution
06-10-2022 09:56 AM
Brian_Wilson
Regular Contributor

Yesterday it was running fine in Jupyter Notebook, took 15 seconds. Today it's up to 4 minutes so far.

From this post https://community.esri.com/t5/arcgis-api-for-python-questions/folders-key-error-on-servicesdirectory...

it looks like the call was put in there only for internal use and I should not call it?? If true, I wonder if you could add that to the docs, Esri??

 

 

from arcgis.gis.server.catalog import ServicesDirectory
sd = ServicesDirectory(url="https://xxxxx/server",username="user",password="pass")
sd.list()

 

If I call sd.list(folder="My Folder") then it works like a charm.

 

0 Kudos
1 Solution

Accepted Solutions
Brian_Wilson
Regular Contributor

For anyone searching for how to use ServicesDirectory, don't, it does not work correctly. Use something like this, it's fast and it works.

from arcgis.gis import GIS
print(arcgis.__version__)
gis = GIS(url="https://xxx/portal",username="xxx",password="xxx")
myservers=gis.admin.servers.list()
services = myservers[0].services.list()
for s in services:
  print(s.iteminformation.properties)

 

View solution in original post

0 Kudos
1 Reply
Brian_Wilson
Regular Contributor

For anyone searching for how to use ServicesDirectory, don't, it does not work correctly. Use something like this, it's fast and it works.

from arcgis.gis import GIS
print(arcgis.__version__)
gis = GIS(url="https://xxx/portal",username="xxx",password="xxx")
myservers=gis.admin.servers.list()
services = myservers[0].services.list()
for s in services:
  print(s.iteminformation.properties)

 

0 Kudos