-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Description
Describe the bug
As of version 2.4.0, attempting to clone a Dashboard that references a hosted table and hosted table view fails with a TypeError, as shown below. Version 2.3.0.3 and some earlier versions successfully complete the clone. (Also confirmed it works with Online runtime standard version 10, but fails with versions 11 and the current default, 12.)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
File /opt/conda/lib/python3.11/site-packages/arcgis/_impl/common/_clone.py:3385, in _FeatureServiceDefinition.clone(self)
3381 # validate admin_layer_info
3382 if (
3383 new_service is not None
3384 and "adminLayerInfo" in layer
-> 3385 and "viewLayerDefinition" in layer["adminLayerInfo"]
3386 and "table"
3387 in layer["adminLayerInfo"]["viewLayerDefinition"]
3388 ):
3389 layer["adminLayerInfo"]["viewLayerDefinition"]["table"][
3390 "sourceServiceName"
3391 ] = os.path.basename(
3392 os.path.dirname(new_service["url"])
3393 )
TypeError: argument of type 'NoneType' is not iterable
During handling of the above exception, another exception occurred:
_ItemCreateException Traceback (most recent call last)
Cell In[18], line 2
1 # Clone the Usage Dashboard template and its related content (Feature Service and View).
----> 2 clones = gis.content.clone_items(
3 items = [template_item],
4 folder = 'Demo ArcGIS Usage Data Dashboard', # Place in a folder to help keep things organized while experimenting.
5 search_existing_items = False # Create new clones, regardless of any existing clones.
6 )
7 clones
File /opt/conda/lib/python3.11/site-packages/arcgis/gis/__init__.py:8757, in ContentManager.clone_items(self, items, folder, item_extent, use_org_basemap, copy_data, copy_global_ids, search_existing_items, item_mapping, group_mapping, owner, preserve_item_id, export_service, preserve_editing_info, **kwargs)
8736 preserve_item_id = False
8738 deep_cloner = clone._DeepCloner(
8739 self._gis,
8740 items,
(...)
8755 wab_code_attach=kwargs.pop("copy_code_attachment", True),
8756 )
-> 8757 return deep_cloner.clone()
File /opt/conda/lib/python3.11/site-packages/arcgis/_impl/common/_clone.py:1347, in _DeepCloner.clone(self)
1343 # elif len([node for node in self._graph.values() if isinstance(node, _StoryMapDefinition)]) > 0:
1344 # return self._clone_synchronous()
1345 else:
1346 with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor:
-> 1347 results = executor.submit(self._clone, executor).result()
1348 return results
File /opt/conda/lib/python3.11/concurrent/futures/_base.py:456, in Future.result(self, timeout)
454 raise CancelledError()
455 elif self._state == FINISHED:
--> 456 return self.__get_result()
457 else:
458 raise TimeoutError()
File /opt/conda/lib/python3.11/concurrent/futures/_base.py:401, in Future.__get_result(self)
399 if self._exception:
400 try:
--> 401 raise self._exception
402 finally:
403 # Break a reference cycle with the exception in self._exception
404 self = None
File /opt/conda/lib/python3.11/concurrent/futures/thread.py:58, in _WorkItem.run(self)
55 return
57 try:
---> 58 result = self.fn(*self.args, **self.kwargs)
59 except BaseException as exc:
60 self.future.set_exception(exc)
File /opt/conda/lib/python3.11/site-packages/arcgis/_impl/common/_clone.py:1321, in _DeepCloner._clone(self, excecutor)
1319 item.protected = False
1320 item.delete()
-> 1321 raise ex
1323 level += 1
1324 leaf_nodes = self._get_leaf_nodes()
File /opt/conda/lib/python3.11/concurrent/futures/thread.py:58, in _WorkItem.run(self)
55 return
57 try:
---> 58 result = self.fn(*self.args, **self.kwargs)
59 except BaseException as exc:
60 self.future.set_exception(exc)
File /opt/conda/lib/python3.11/site-packages/arcgis/_impl/common/_clone.py:4270, in _FeatureServiceDefinition.clone(self)
4268 return new_item
4269 except Exception as ex:
-> 4270 raise _ItemCreateException(
4271 "Failed to create {0} {1}: {2}".format(
4272 original_item["type"], original_item["title"], str(ex)
4273 ),
4274 new_item,
4275 )
_ItemCreateException: ("Failed to create Feature Service Demo_Usage_Data_Public_Template: argument of type 'NoneType' is not iterable", <Item title:"Demo_Usage_Data_Public_Template_e1e9e" type:Feature Layer Collection owner:knooptp_umich>)
To Reproduce
You can use this publicly available Dashboard and referenced layers to reproduce this error:
gis = GIS("home")
clones = gis.content.clone_items(
items = [gis.content.get('37f5340bad2b45649f2944023da70d1a')],
folder = 'Demo Dashboard',
search_existing_items = False
)
clones