Select to view content in your preferred language

How to get the status of an export job?

07-17-2020 02:22 PM
Occasional Contributor III

I'm writing a script to export some feature services in AGOL to FGDB and then download them.

The export process takes a while but my code doesn't pause execution despite using wait='True'. This results in a corrupted zip file as my code downloads it before the export has finished.

Since gis.item.export returns a jobid I would think I could poll the job status until it is success however I don't see a rest endpoint to do this. I've tried things like<jobid> but I don't see any status messages.

As of right now I am putting in an arbitrary 3 minute wait timer but I would like something a little less hacky.

    mygis = GIS(username="myuser",password="*****")

    service = mygis.content.get(itemID)
    itemDes = service.export(title="DamageReports", export_format= 'File Geodatabase', parameters=None, wait='True')
    fgdb = mygis.content.get(itemDes['exportItemId'])

    <wait time goes here>"D:\temp")

0 Kudos
1 Reply
Esri Contributor

Hey Drew Dowling‌,

Have you seen this support article for downloading services as a FDGB? It was initially written to loop through items located services through However, if you have a list of specific items you could use gis.content.get() to loop through the item IDs instead.

I'm not certain about the checking on the status of an export job and will have to look into it, but I know the following should work without any corruption issues:

  • itemDes = service.export(service.title + "_" + version, "File Geodatabase")
  • path for backup_location)

I believe the problem is that the code above will run once itemDes has finished being created, while  fgdb = mygis.content.get(itemDes['exportItemId']) instead creates a new variable and exports it regardless of whether the FGDB for itemDes has been fully created.

Hope this helps,


0 Kudos