FeatureLayerCollectionManager references a missing function in overwrite()

2660
18
06-05-2018 04:45 AM
HåkonDreyer
Esri Contributor

After publishing a hosted service based on a gdb we would like to regulerly update the service using the overwrite functionality in Python API 1.4.1.

This works fine if the service resides in AGOL, but when trying the same in Portal the API throws an error. Apparently the FeatureLayerCollectionManager calls an unimplemented method: _overwrite_portal.

Traceback (most recent call last):
  File "c:\test\overwrite.py", line 19, in <module>
    _fcoll.manager.overwrite(_data)
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\managers.py", line 1030, in overwrite
    return self._overwrite_portal(data=data_file)
AttributeError: 'FeatureLayerCollectionManager' object has no attribute '_overwrite_portal

In managers.py this is implemented as this, which also explains the difference between AGOL and Enterprise:

0 Kudos
18 Replies
by Anonymous User
Not applicable

Håkon Dreyer‌, thanks for pointing out, I have fixed this bug and will be available in v1.4.2.

Meanwhile, you can safely comment out those two lines (1029, 1030) and overwrite functionality should work for all supported cases.

HåkonDreyer
Esri Contributor

Hi Atma Mani‌ , I see you fixed the issue in 1.4.2, but I'm afraid there still might be some unsolved issues when posting to a Portal.

A traceback

My testscript runs fine when posting to Online, but fails like this on Enterprise 10.5.1 and 10.6 portals.

0 Kudos
HåkonDreyer
Esri Contributor

Hi - Atma Mani, just tested the aforementioned update bug with the new 1.5 API, but except for the line numbers nothing seems to have changed.

Still works fine with ArcGIS Online.

0 Kudos
HåkonDreyer
Esri Contributor

Ping Atma Mani, seems the bug lives on, just tested with 1.5 on a 10.6.1 portal.

0 Kudos
SeanRedar
New Contributor III

Same problem, 10.6 portal.  Does the commenting out lines 1029 and 1030 in managers.py circumnavigate the bug on 10.6 portal?

0 Kudos
HåkonDreyer
Esri Contributor

Hi, and no. Removing those lines only fixed the missing function problem, but update of items in portal still fails.

0 Kudos
SeanRedar
New Contributor III

I found the same thing, commenting out that function results in error further down

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\managers.py in overwrite(self, data_file)   1094         #if related_data_item.update(data=data_file):   1095         if related_data_item.update(data=data_file):-> 1096             published_item = related_data_item.publish(publish_parameters, overwrite=True)   1097             if published_item is not None:   1098                 return {'success': True}C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py in publish(self, publish_parameters, address_fields, output_type, overwrite, file_type, build_initial_cache)   6375             return Item(self._gis, ret[0]['serviceItemId'])   6376         else:-> 6377             serviceitem_id = self._check_publish_status(ret, folder)   6378         return Item(self._gis, serviceitem_id)   6379  C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py in _check_publish_status(self, ret, folder)   6609                     #print(str(job_response))   6610                     if job_response.get("status") in ("esriJobFailed","failed"):-> 6611                         raise Exception("Job failed.")   6612                     elif job_response.get("status") == "esriJobCancelled":   6613                         raise Exception("Job cancelled.")Exception: Job failed.
0 Kudos
HåkonDreyer
Esri Contributor

Finally fixed with 1.5.1. and 10.6.1 portal

deleted-user-Qrnw90viByMg
New Contributor III

Hi Håkon,

I'm getting the same error: 'FeatureLayerCollectionManager' object has no attribute '_overwrite_portal'

I'm not sure if our portal install captured the fix. 

Was it in a patch? 

Thanks!

0 Kudos