Skip to content

Commit

Permalink
github issue 1806
Browse files Browse the repository at this point in the history
  • Loading branch information
chncaesar committed Aug 10, 2022
1 parent 783d1f8 commit 98c3a2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 3 additions & 0 deletions conf/err-msg-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
{ "regexp": "MLSQL Parser error in .*?", "msg": "MLSQL Parser error"}
]
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ class RestController extends ApplicationController with WowLog with Logging {
paramAsLong("timeout", -1L)
)
val context = createScriptSQLExecListener(sparkSession, jobInfo.groupId)
// Save to context, so that plugins can use it.
context.addEnv("show_stack", param("show_stack", "false"))

def query = {
if (paramAsBoolean("async", false)) {
Expand Down Expand Up @@ -178,23 +180,19 @@ class RestController extends ApplicationController with WowLog with Logging {
} catch {
case e: Exception =>
e.printStackTrace()
val msgBuffer = ArrayBuffer[String]()
if (paramAsBoolean("show_stack", false)) {
format_full_exception(msgBuffer, e)
}

val msg = ExceptionRenderManager.call(e).str.getOrElse( e.getMessage )

executeWithRetrying[HttpResponse](maxTries)(
RestUtils.httpClientPost(urlString,
Map("stat" -> s"""failed""",
"msg" -> (e.getMessage + "\n" + msgBuffer.mkString("\n")),
"msg" -> msg ,
"jobInfo" -> JSONTool.toJsonStr(jobInfo)),
callbackHeader),
HttpStatus.SC_OK == _.getStatusLine.getStatusCode,
response => logger.error(s"Fail SQL callback request failed after ${maxTries} attempts, " +
s"the last response status is: ${response.getStatusLine.getStatusCode}.")
)


}
})
} else {
Expand Down Expand Up @@ -239,8 +237,8 @@ class RestController extends ApplicationController with WowLog with Logging {
} catch {
case e: Exception =>
logError("An error occurred while the job manager was executing the task, ", e)
val msg = ExceptionRenderManager.call(e)
render(500, msg.str.get)
val msg = ExceptionRenderManager.call(e).str.getOrElse(e.getMessage)
render(500, msg)
} finally {
RequestCleanerManager.call()
cleanActiveSessionInSpark
Expand Down

0 comments on commit 98c3a2d

Please sign in to comment.