Closed chadcooper closed 9 years ago
i will take a look. thank you.
Set wait=True.
Try this:
import arcrest
username = ""
password = ""
itemId = ""
zip_name = ""
savePath = r""
agolSH = arcrest.AGOLTokenSecurityHandler(username=username,
password=password)
portalAdmin = arcrest.manageorg.Administration(securityHandler=agolSH)
content = portalAdmin.content
item = content.getItem(itemId)
user = content.users.user(username=item.owner)
res = user.exportItem(title=zip_name,
itemId=itemId,
exportFormat="File Geodatabase",
wait=True)
exportItemId = res.id
exportItem = content.getItem(exportItemId)
itemDataPath = exportItem.itemData(f=None, savePath=savePath)
exportItem.userItem.deleteItem()
Regarding using wait=True
: looks like that is v3 item, I'm using v2 right now. Can you explain what wait=True
does exactly?
Regarding the issue I'm having with deploying this: I can actually get this to work fine in my local dev env, but when trying to deploy to my client's env (with very high security), it is bombing, but only on large downloads. A colleauge suggested it could be the firewall filtering content based on size, since I can pull down a zip created by this process that is say 125MB, but not one that is almost 1GB in size. Will update here on what I find. Thanks.
ExportItem is a async gp task, setting wait to true just loops until the process finishes or fails.
Hmm, thanks, Mike. So exportItem really only handles the export of the AGOL item (a feature service in my case) out to a export format (FGDB in my case), correct? If so, that part is working fine, even though it returns a result of failed
on the larger items. I'm really starting to think my real problem is on my client's env with some sort of security setting that is prohibiting my process from downloading the nearly 1GB zipped up FGDB.
Export Item - http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r30000008s000000
This returns a job id, that job is run in the portal/online. You have to monitor that job for a status update. That is what the Wait parameter does in ArcRest. When the job is done, a new item is created, which you can download.
@chadcooper, @MikeMillerGIS
When wait is set to false, the job id is not returning, I corrected for this issue. This means if you specify wait=False and want to check status yourself, you now can.
If wait is set to True, then the function will return the useritem object as expected.
See the doctstring for the complete changes in the function.
Andrew
Following this sample, if I attempt to export a feature service to FGDB from AGOL that results in a large (900+ MB) FGDB,
exportItem
always fails with a400 - Error updating file item
. BUT, the FGDB gets created just fine and I can manually download it from My Content on AGOL.If I run same code on really small feature service, all works well and the job completes just fine.
As a hack I tried putting a
time.sleep(300)
in before callingexportItem.itemData()
, but that isn't working in my client environment and nowitemDataPath
is returningFalse
.