Getting error when trying to Create Buffer using Analysis Services

501
1
12-28-2021 01:15 PM
ChuckBenton
Occasional Contributor

I'm trying to create a buffer of all parcels with 100 Meters of the National Interstate systems. I'm using a national feature layer of parcels, and selecting based on the Living Atlas USA Freeway System feature layer. I'm following the workflow at https://developers.arcgis.com/rest/analysis/api-reference/find-existing-locations.htm. The key code is: 

host_url = "https://www.arcgis.com"
portal_url = "{}/sharing/rest".format(host_url)
token = get_token(portal_url, username, password)
analysis_url = get_analysis_url(portal_url, token)
task = "CreateBuffers"
output_service = "CreateBuffers_I95"
params= { "inputLayer": {"url": "https://services8.arcgis.com/2G8bTpCps4vdRut5/arcgis/rest/services/ParcelAtlas_V2_4/FeatureServer/0"},
"method": "Geodesic",
"spatialRel": "withinDistance",
"selectingLayer": "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Freeway_System_analysis/Featur...",
"distance": 100.0,
"units": "Meters",
"dissolveType": "Dissolve",
"outputName": {"serviceProperties": {"name": "LocationQueryResult"}
}
}
task_url, job_info = analysis_job(analysis_url, task, token, params)
job_info = analysis_job_status(task_url, job_info, token)
job_values = analysis_job_results(task_url, job_info, token)

When I run it I get :

importing
starting
Logging in
Getting token...
Getting Analysis URL...
Submitting analysis job...
{'jobId': 'jaf04b394ba164b9d8de5098228b2d6c3', 'jobStatus': 'esriJobSubmitted', 'results': {}, 'inputs': {}, 'messages': []}
{'jobId': 'jaf04b394ba164b9d8de5098228b2d6c3', 'jobStatus': 'esriJobFailed', 'results': {}, 'inputs': {}, 'messages': [{'type': 'esriJobMessageTypeError', 'description': '{"messageCode": "AO_100012", "message": "CreateBuffers failed."}'}, {'type': 'esriJobMessageTypeError', 'description': 'Failed to execute (CreateBuffers).'}, {'type': 'esriJobMessageTypeError', 'description': 'Failed.'}]}
 
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-34-708507b739fa> in <module>
    175         }
    176 task_url, job_info = analysis_job(analysis_url, task, token, params)
--> 177 job_info = analysis_job_status(task_url, job_info, token)
    178 job_values = analysis_job_results(task_url, job_info, token)
    179 

<ipython-input-34-708507b739fa> in analysis_job_status(task_url, job_info, token)
    112                 print(job_response)
    113                 if job_response.get("jobStatus") == "esriJobFailed":
--> 114                     raise Exception("Job failed.")
    115                 elif job_response.get("jobStatus") == "esriJobCancelled":
    116                     raise Exception("Job cancelled.")

Exception: Job failed.

There's very little here to go on for troubleshooting, any ideas to try and overcome this are most welcome!

Thanks in advance or any replies and insights!

Chuck

0 Kudos
1 Reply
MichaelVolz
Esteemed Contributor

Can you try setting this up in ModelBuilder and then export to python after successful ran and compare to your code?

0 Kudos