Created
August 31, 2015 11:54
-
-
Save kyogesh/c1d96c621414d99436f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [3]: req_dict = { | |
'institution_id': '9990', | |
'course_cd': ['ENGL1101'], | |
'request_type': 'grades', | |
'chart_type': 'grad_rate_by_grade' | |
} | |
In [4]: _request_pdapi_data(**req_dict) | |
************** request ************** | |
Sending request to http://asheablapp-p01.advisory.com/prod/models/pdapi/ | |
{"taken_in_major": false, "course_cd": ["ENGL1101"], "institution_id": "9990", "request_type": "grades", "grad_in_major": false, "chart_type": "grad_rate_by_grade"} | |
[2015-08-31 09:53:30,234] ERROR [/Users/yogeshkumar/Agiliq/Work/workbooks/ds_bridge/services/api.py:130] PDAPI Request Payload: {"taken_in_major": false, "course_cd": ["ENGL1101"], "institution_id": "9990", "request_type": "grades", "grad_in_major": false, "chart_type": "grad_rate_by_grade"} | |
[2015-08-31 09:53:30,282] ERROR [/Users/yogeshkumar/Agiliq/Work/workbooks/ds_bridge/services/api.py:131] PDAPI Error Message: Error in model.predict function | |
Error in value[[3L]](cond): [ERROR] Service failed: Error in postgresqlExecStatement(conn, statement, ...): RS-DBI driver: (could not Retrieve the result : ERROR: relation "pdapi_mv_std_course_term" does not exist | |
LINE 1: SELECT * FROM (SELECT * FROM pdapi_mv_std_course_term) AS "_... | |
^ | |
) | |
model.predict <- function (params) | |
{ | |
flog.info("Executing request: %s, %s", params$request_type, | |
params$institution_id) | |
con <- max_con_src_postgres(host = cf$dbhost, user = cf$dbuser, | |
password = cf$dbpassword, dbname = cf$dbname) | |
dbGetQuery(con$con, sprintf("SET search_path TO %s", params$institution_id)) | |
tryCatch(switch(params$request_type, grades = serv_grades(params, | |
con), credit_buckets = serv_credit_buckets(params, con), | |
student_groups = serv_stu_groups(params, con), courses = serv_courses(params, | |
con), majors = serv_major(params, con), term_list = serv_term_list(params, | |
con), majors_list = serv_majors_list(params, con), | |
course_list = serv_course_list(params, con), grade_map = stop(flog.error("request type *grade_map* not implemented")), | |
major_map = stop(flog.error("request type *major_map* not implemented")), | |
stop(flog.error("unknown request type not implemented"))), | |
error = function(e) { | |
dbDisconnect(con$con) | |
stop(flog.error("Service failed: %s", as.character(e))) | |
}, finally = { | |
dbDisconnect(con$con) | |
flog.info("Completed request: %s, %s", params$request_type, | |
params$institution_id) | |
}) | |
} | |
--------------------------------------------------------------------------- | |
PDAPIException Traceback (most recent call last) | |
<ipython-input-4-0ae9d494ff0e> in <module>() | |
----> 1 _request_pdapi_data(**req_dict) | |
/Users/yogeshkumar/Agiliq/Work/workbooks/ds_bridge/services/api.py in _request_pdapi_data(**params) | |
114 PDAPI_EXCEPTION_ERROR_LOADING_REPORT_CODE, | |
115 PDAPI_EXCEPTION_ERROR_LOADING_REPORT_REQUEST_ISSUE_REPORT, | |
--> 116 response_payload['error']) | |
117 else: | |
118 _log_request_pdapi_data_and_raise_exc(request_data, PDAPI_EXCEPTION_NO_RECORDS_MESSAGE) | |
/Users/yogeshkumar/Agiliq/Work/workbooks/ds_bridge/services/api.py in _log_request_pdapi_data_and_raise_exc(request_data, user_friendly_msg, error_code, request_issue_report, pdapi_exception) | |
133 'custom_error': user_friendly_msg, | |
134 'custom_code': error_code, | |
--> 135 'custom_request_issue_report': request_issue_report | |
136 }) | |
137 | |
PDAPIException: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment