I would like to be able to clone items from our organisation's internal ArcGIS Portal to our external ArcGIS Online enterprise and am following the clone_items option using the ArcGIS Python API, but am receiving a connection error:
urllib.error.URLError: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it>
I haven't had any problems connecting to ArcGIS Online so am wondering what the issue might relate to?
The service I am trying to clone isn't a hosted service, it is a feature layer from our federated REST service, does this mean it may not be able to access the service if it isn't hosted?
I have looked at distributed collaboration but this entails modifying our ArcSDE data (either adding global IDs or versioning data) which we do not want to do, hence why I am now looking at the cloning option.
That's odd, our services don't seem to contain global IDs within the federated REST service layers from what I can see?
I was under the impression that global IDs had to be generated separately using the ESRI toolbox to prep layers before loading onto ArcGIS Portal?
I believe our concern is more in that we would have to version all of our data (which could increase storage on our database) and then re-publish to try and get the collaboration working; we don't want to alter existing datasets so are now looking more towards scripting options to try and update layers on ArcGIS Online, unless there is an efficient way of doing this without re-publishing / altering how our datasets are structured in SDE?
I should have been more clear in my statement. Global IDs are required for federated services that will participate in Distributed Collaboration.
You won't have to version your feature classes, but you will have to add Global IDs if you want to have the service collaborate. This won't require you to re-publish your existing services. You would just have to stop the service, add Global IDs, and then start the service back up.
Thanks for the clarification - I was under the impression that the data had to also either be versioned or archive enabled as well?
We ideally want to avoid changing the structure of the existing datasets and therefore collaboration will probably not work in this situation.
Regarding the original question, is the error a result of the service not being hosted, or something related to the connection?
Otherwise, are there alternative ways to take services from our federated server and create hosted ArcGIS Online services and update as required?
I was under the impression that the data had to also either be versioned or archive enabled as well?
No, the data will not have to be versioned or archived.
The original error you received seems to be related to the connection. However, the clone items function will not convert an arcgis server map/feature service to an AGOL hosted feature service. Even if you have the option copy_date=True for the function. It will create a new item in ArcGIS Online referencing the map/feature service from your ArcGIS Server instance.
Distributed Collaboration would be the easiest, and I would still push towards this. Adding Global IDs will only add an additional field to the feature class. The only other option would be to manually overwrite the AGOL hosted feature service whenever there's an update to the ArcGIS Server service. You could schedule a python script to do this using Windows Task Scheduler. Here is one script that you could use.