SD item added but publishing results in "Job Failed" - was working fine.

02-07-2023 07:52 AM
Occasional Contributor II

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
Connecting to
GIS @ version:10.3
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")

##    # Stage Service
        arcpy.StageService_server(sddraft, sd)
        warnings = arcpy.GetMessages(1)
    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)

    item = gis.content.add({"overwrite": True},sd)
    print ("added")
    published_item = item.publish(overwrite=True)
    print ("published")


0 Kudos
0 Replies