def get_download_results(execution): """Download results of the exectuion""" logging.info('[ROUTER]: Download execution results of execution %s ' % (execution)) try: execution = ExecutionService.get_execution(execution) except Exception as e: logging.error('[ROUTER]: '+str(e)) return error(status=500, detail='Generic Error') return Response( json.dumps(execution.results), mimetype="text/plain", headers={"Content-Disposition": "attachment;filename=results.json"} )
def get_execution(execution): """Get an execution""" logging.info('[ROUTER]: Getting execution: '+execution) include = request.args.get('include') include = include.split(',') if include else [] try: execution = ExecutionService.get_execution(execution, current_identity) except ExecutionNotFound as e: logging.error('[ROUTER]: '+e.message) return error(status=404, detail=e.message) except Exception as e: logging.error('[ROUTER]: '+str(e)) return error(status=500, detail='Generic Error') return jsonify(data=execution.serialize(include)), 200