I am using the getWebLayerSharingDraft --> exportToSDDraft --> StageService_server --> content.add --> item.publish method of updating a hosted feature layer with new data. This has been working perfectly. Now, for no reason so far as I can tell, my SD file will upload to AGOL but the next publishing step fails with "Job Failed".
One note - after a successful publish, the code goes on to delete the Service Definition item. The service definition file appears to be delete protected now. I see both the hosted feature layer and the service definition file in my AGOL content. In ArcGIS Online, the Feature Layer (hosted) item says it was updated Feb 7, yet in the Details section on the right panel, it says "Data updated: Jan 28.
Log result for below:
Creating SD file
exportToSDDraft
Connecting to https://arcgis.com/
GIS @ https://pottcounty.maps.arcgis.com version:10.3
added
Job failed.
sharing_draft = mp.getWebLayerSharingDraft("HOSTING_SERVER", "FEATURE", sd_fs_name)
sharing_draft.summary = ""
sharing_draft.tags = ""
sharing_draft.description = ""
sharing_draft.credits = ""
sharing_draft.useLimitations = ""
sharing_draft.offline = True
sharing_draft.overwriteExistingService = True
## # Create Service Definition Draft file
print ("exportToSDDraft")
sharing_draft.exportToSDDraft(sddraft)
## # Stage Service
try:
arcpy.StageService_server(sddraft, sd)
warnings = arcpy.GetMessages(1)
print(warnings)
except Exception as stage_exception:
print("Sddraft not staged. Analyzer errors encountered - {}".format(str(stage_exception)))
print("Connecting to {}".format(portal))
gis = GIS(portal, user, password)
print(gis)
#######
item = gis.content.add({"overwrite": True},sd)
print ("added")
published_item = item.publish(overwrite=True)
print ("published")