Select to view content in your preferred language

Item Graph Module: Create Dependency Graph Failing when creating graph for whole organization

3489
10
Jump to solution
07-31-2025 02:29 PM
Labels (1)
ClaytonBurns2
Occasional Contributor

I am having issues with the Item Graph module failing when running the create_dependency_graph function on my organization's ArcGIS Online in Notebook. I'm the main administrator for the organization and yet it fails with an "(Error Code: 403) Exception: You do not have permissions to access this resource or perform this operation."

When running the script on other organizations that I have administrator access to the graph gets created just fine. I have tried running the script with "outside_org=False, include_reverse=False" thinking that maybe permissions from outside organization layers were causing the create_dependency_graph function to fail. I have been following along with the following ESRI Documentation Working with an Organization-Wide Dependency Graph  Are there exceptions that I'm unaware of that could be included in the script to skip over, but list potential items that are causing issues for the create_dependency_graph function?

Below is an example of the script, with the added inputs of "outside_org=False, include_reverse=False" from the Item Graph documentation, however it continues to fail. The script always fails at graph = create_dependency_graph...., but it will work if I limit the max items to a small amount. This leads me to think there are some items that corrupt or not able to work with the graph?

Any suggestions would be very welcome. Thank you! 

from arcgis.gis import GIS
from arcgis.apps.itemgraph import create_dependency_graph, load_from_file
import datetime
import networkx as nx
gis = GIS("home")

# only run this cell the very first time you index over your org and grab all the dependencies
# this will take a long time if the org has a ton of items

import datetime
items = gis.content.search("", max_items = 1000)
timestamp = int(datetime.datetime.now().timestamp()) * 1000
graph = create_dependency_graph(gis, items, outside_org=False, include_reverse=False)
graph.write_to_file("/arcgis/home/graph_data/updating_graph.gml")
with open("/arcgis/home/graph_data/updating_timestamp.txt", "w") as file:
file.write(str(timestamp))

 

0 Kudos
10 Replies
ODWC_GIS
Frequent Contributor

Just wanted to say that that worked.  Only in the ArcGIS Online Notebook Environment, but it worked!

0 Kudos