Cloning attempt on Feature Collection adds characters to title string

227
0
03-27-2023 08:00 AM
Labels (1)
HarrisonWitt41
New Contributor

I'm trying to clone a Feature Layer Collection from one portal environment to another, and for some reason the dataset isn't being found because of the title property have random letters added. As you can see on the last line 116, the title of the item has been changed to "MP_PDS_Region_CJRM_32bc0"

 

cjrm_results = prdgis.content.get('9413b1cdbab8407f8239c3666824d560')
cloned_items = prdgis.content.clone_items(items=[cjrm_results], copy_data=True)
print(cloned_items)
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
File ~\.conda\envs\poppin\lib\site-packages\arcgis\_impl\common\_clone.py:3262, in _FeatureServiceDefinition.clone(self)
   3258         definition = '{{"layers" : {0}, "tables" : {1}}}'.format(
   3259             json.dumps(o["layers"]),
   3260             json.dumps(o["tables"]),
   3261         )
-> 3262         _add_to_definition(feature_service_admin, definition)
   3264 # Create a lookup between the new and old layer ids

File ~\.conda\envs\poppin\lib\site-packages\arcgis\_impl\common\_clone.py:6341, in _add_to_definition(feature_layer_manager, definition)
   6339 u_url = feature_layer_manager._url + "/addToDefinition"
-> 6341 res = feature_layer_manager._con.post(u_url, params)
   6342 feature_layer_manager.refresh()

File ~\.conda\envs\poppin\lib\site-packages\arcgis\gis\_impl\_con\_connection.py:1557, in Connection.post(self, path, params, files, **kwargs)
   1556     return resp
-> 1557 return self._handle_response(
   1558     resp=resp,
   1559     out_path=out_path,
   1560     file_name=file_name,
   1561     try_json=try_json,
   1562     force_bytes=kwargs.pop("force_bytes", False),
   1563 )

File ~\.conda\envs\poppin\lib\site-packages\arcgis\gis\_impl\_con\_connection.py:1027, in Connection._handle_response(self, resp, file_name, out_path, try_json, force_bytes, ignore_error_key)
   1024     errorcode = (
   1025         data["error"]["code"] if "code" in data["error"] else 0
   1026     )
-> 1027     self._handle_json_error(data["error"], errorcode)
   1028 return data

File ~\.conda\envs\poppin\lib\site-packages\arcgis\gis\_impl\_con\_connection.py:1052, in Connection._handle_json_error(self, error, errorcode)
   1049 errormessage = (
   1050     errormessage + "\n(Error Code: " + str(errorcode) + ")"
   1051 )
-> 1052 raise Exception(errormessage)

Exception: ERROR: Dataset not found.
(Error Code: 500)

During handling of the above exception, another exception occurred:

_ItemCreateException                      Traceback (most recent call last)
Input In [53], in <cell line: 1>()
----> 1 cloned_items = prdgis.content.clone_items(items=[cjrm_results], copy_data=True)
      2 print(cloned_items)

File ~\.conda\envs\poppin\lib\site-packages\arcgis\gis\__init__.py:7909, 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, **kwargs)
   7891     preserve_item_id = False
   7893 deep_cloner = clone._DeepCloner(
   7894     self._gis,
   7895     items,
   (...)
   7907     from_dash=kwargs.pop("from_dash", False),
   7908 )
-> 7909 return deep_cloner.clone()

File ~\.conda\envs\poppin\lib\site-packages\arcgis\_impl\common\_clone.py:1272, in _DeepCloner.clone(self)
   1268 # elif len([node for node in self._graph.values() if isinstance(node, _StoryMapDefinition)]) > 0:
   1269 #    return self._clone_synchronous()
   1270 else:
   1271     with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor:
-> 1272         results = executor.submit(self._clone, executor).result()
   1273         return results

File ~\.conda\envs\poppin\lib\concurrent\futures\_base.py:446, in Future.result(self, timeout)
    444     raise CancelledError()
    445 elif self._state == FINISHED:
--> 446     return self.__get_result()
    447 else:
    448     raise TimeoutError()

File ~\.conda\envs\poppin\lib\concurrent\futures\_base.py:391, in Future.__get_result(self)
    389 if self._exception:
    390     try:
--> 391         raise self._exception
    392     finally:
    393         # Break a reference cycle with the exception in self._exception
    394         self = None

File ~\.conda\envs\poppin\lib\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 ~\.conda\envs\poppin\lib\site-packages\arcgis\_impl\common\_clone.py:1246, in _DeepCloner._clone(self, excecutor)
   1244             if item:
   1245                 item.delete()
-> 1246         raise ex
   1248 level += 1
   1249 leaf_nodes = self._get_leaf_nodes()

File ~\.conda\envs\poppin\lib\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 ~\.conda\envs\poppin\lib\site-packages\arcgis\_impl\common\_clone.py:3922, in _FeatureServiceDefinition.clone(self)
   3920     return new_item
   3921 except Exception as ex:
-> 3922     raise _ItemCreateException(
   3923         "Failed to create {0} {1}: {2}".format(
   3924             original_item["type"], original_item["title"], str(ex)
   3925         ),
   3926         new_item,
   3927     )

_ItemCreateException: ('Failed to create Feature Service MP PDS Region CJRM: ERROR: Dataset not found.\n(Error Code: 500)', <Item title:"MP_PDS_Region_CJRM_32bc0" type:Feature Layer Collection owner:Planning-Moderator>)

It's recognizing the item prior to this:

HarrisonWitt41_1-1679929205356.png

 

Anybody know whatsa goin on here? Thanks.

 

 

0 Kudos
0 Replies