File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -286,15 +286,27 @@ def api_job_result(job_id):
286286@app .route ('/api/job/<job_id>/traceback' )
287287@requires_auth
288288def api_job_traceback (job_id ):
289- collection = connections .mongodb_jobs .mrq_jobs
289+ collection = connections .mongodb_jobs .mrq_jobss
290+ if get_current_config ().get ("save_traceback_history" ):
291+
292+ field_sent = "traceback_history"
293+ else :
294+ field_sent = "traceback"
295+
290296 job_data = collection .find_one (
291- {"_id" : ObjectId (job_id )}, projection = ["traceback" ])
297+ {"_id" : ObjectId (job_id )}, projection = [field_sent ])
292298
293299 if not job_data :
294- job_data = {}
300+ # If a job has no traceback history, we fallback onto traceback
301+ if field_sent == "traceback_history" :
302+ field_sent = "traceback"
303+ job_data = collection .find_one (
304+ {"_id" : ObjectId (job_id )}, projection = [field_sent ])
305+ if not job_data :
306+ job_data = {}
295307
296308 return jsonify ({
297- "traceback" : job_data .get ("traceback" , "No exception raised" )
309+ field_sent : job_data .get (field_sent , "No exception raised" )
298310 })
299311
300312
You can’t perform that action at this time.
0 commit comments