This is an automated email from the ASF dual-hosted git repository.
casion pushed a commit to branch dev-1.3.1
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git
The following commit(s) were added to refs/heads/dev-1.3.1 by this push:
new 8cc742207 [linkis-entrance]module errorcode optimization and
documentation (#3600)
8cc742207 is described below
commit 8cc7422072aca1cdff6ed73aa39fd5e1eeb4df2d
Author: 成彬彬 <[email protected]>
AuthorDate: Fri Oct 14 16:06:44 2022 +0800
[linkis-entrance]module errorcode optimization and documentation (#3600)
---
docs/errorcode/linkis-entrance-errorcode.md | 34 +++++
.../errorcode/EntranceErrorCodeSummary.java | 162 +++++++++++++++++++++
.../entrance/parser/AbstractEntranceParser.java | 9 +-
.../persistence/QueryPersistenceEngine.java | 22 ++-
.../apache/linkis/entrance/EntranceServer.scala | 21 ++-
.../exception/JobHistoryFailedException.scala | 4 +-
.../exception/SensitiveTablesCheckException.scala | 4 +-
.../entrance/execute/EntranceExecutorManager.scala | 9 +-
.../linkis/entrance/execute/EntranceJob.scala | 7 +-
.../impl/ShellDangerousGrammerInterceptor.scala | 3 +-
.../linkis/entrance/log/HDFSCacheLogWriter.scala | 3 +-
.../org/apache/linkis/entrance/log/LogReader.scala | 2 +-
.../org/apache/linkis/entrance/log/LogWriter.scala | 3 +-
.../entrance/parser/CommonEntranceParser.scala | 20 ++-
.../entrance/scheduler/EntranceGroupFactory.scala | 3 +-
.../scheduler/cache/ReadCacheConsumer.scala | 11 +-
.../linkis/entrance/utils/JobHistoryHelper.scala | 11 +-
17 files changed, 282 insertions(+), 46 deletions(-)
diff --git a/docs/errorcode/linkis-entrance-errorcode.md
b/docs/errorcode/linkis-entrance-errorcode.md
new file mode 100644
index 000000000..581ad8e3c
--- /dev/null
+++ b/docs/errorcode/linkis-entrance-errorcode.md
@@ -0,0 +1,34 @@
+## linkis-entrance errorcode
+
+| module name(模块名) | error code(错误码) | describe(描述) |enumeration name(枚举)|
Exception Class(类名)|
+| -------- | -------- | ----- |-----|-----|
+|linkis-entrance |10000|Unsupported
operation(不支持的操作)|UNSUPPORTED_OPERATION|EntranceErrorCodeSummary|
+|linkis-entrance |20001|JobReq can't be
null(JobReq不能为空)|JOBREQ_NOT_NULL|EntranceErrorCodeSummary|
+|linkis-entrance |20001|The label of userCreator or engineType cannot be
null(标签 userCreator 或 engineType 不能为空)|LABEL_NOT_NULL|EntranceErrorCodeSummary|
+|linkis-entrance |20001|Task is not requestPersistTask, cannot to create
Executor(Task不是requestPersistTask,不能创建Executor)|NOT_CREATE_EXECUTOR|EntranceErrorCodeSummary|
+|linkis-entrance |20001|Task is not EntranceJob, cannot to create
Executor(Task 不是 EntranceJob,不能创建
Executor)|ENTRA_NOT_CREATE_EXECUTOR|EntranceErrorCodeSummary|
+|linkis-entrance |20004|JobRequest cannot be null, unable to do persist
operation(JobRequest
不能为空,无法进行持久化操作)|JOBREQUEST_NOT_NULL|EntranceErrorCodeSummary|
+|linkis-entrance |20004|The instance can't be
null(实例不能为空)|INSTANCE_NOT_NULL|EntranceErrorCodeSummary|
+|linkis-entrance |20005|The execute user can't be
null(执行用户不能为空)|EXECUTEUSER_NOT_NULL|EntranceErrorCodeSummary|
+|linkis-entrance |20007|The param executionCode can not be empty (参数
executionCode 不能为空)|PARAM_NOT_NULL|EntranceErrorCodeSummary|
+|linkis-entrance |20007|The param executionCode and scriptPath can not be
empty at the same time(参数 executionCode 和 scriptPath
不能同时为空)|EXEC_SCRIP_NOT_NULL|EntranceErrorCodeSummary|
+|linkis-entrance |20010|Only code with runtype supported
(仅支持运行类型的代码)|ONLY_CODE_SUPPORTED|EntranceErrorCodeSummary|
+|linkis-entrance |20011|Request jobHistory failed, reason
(请求jobHistory失败,原因):|REQUEST_JOBHISTORY_FAILED|EntranceErrorCodeSummary|
+|linkis-entrance |20011|Request jobHistory failed, reason: jobRespProtocol is
null
(请求jobHistory失败,原因:jobRespProtocol为null)|JOBRESP_PROTOCOL_NULL|EntranceErrorCodeSummary|
+|linkis-entrance |20011|The read all tasks failed, reason
(读取所有任务失败,原因):|READ_TASKS_FAILED|EntranceErrorCodeSummary|
+|linkis-entrance |20020|Sender rpc failed(发件人 RPC
失败)|SENDER_RPC_FAILED|EntranceErrorCodeSummary|
+|linkis-entrance |20039|Failed to analysis task ! the reason
is(分析任务失败!原因是):|FAILED_ANALYSIS_TASK|EntranceErrorCodeSummary|
+|linkis-entrance |20052|Invalid engineType null, cannot use
cache(无效的engineType
null,不能使用缓存)|INVALID_ENGINETYPE_NULL|EntranceErrorCodeSummary|
+|linkis-entrance |20052|Persist jobRequest error, please submit again
later(存储Job异常,请稍后重新提交任务)|PERSIST_JOBREQUEST_ERROR|EntranceErrorCodeSummary|
+|linkis-entrance |20053|Invalid resultsets, cannot use
cache(结果集无效,无法使用缓存)|INVALID_RESULTSETS|EntranceErrorCodeSummary|
+|linkis-entrance |30009|Submitting the query
failed!(提交查询失败!)|SUBMITTING_QUERY_FAILED|EntranceErrorCodeSummary|
+|linkis-entrance |50081|Query from jobHistory status failed(从 jobHistory
状态查询失败)|QUERY_STATUS_FAILED|EntranceErrorCodeSummary|
+|linkis-entrance |50081|Get query response
incorrectly(错误地获取查询响应)|GET_QUERY_RESPONSE|EntranceErrorCodeSummary|
+|linkis-entrance |50081|Query taskId error,taskId(查询 taskId
错误,taskId):|QUERY_TASKID_ERROR|EntranceErrorCodeSummary|
+|linkis-entrance |50081|Query from jobhistory with incorrect list type of
taskId, the taskId is ( 从jobhistory
中查询的参数类型不正确,taskId为):|CORRECT_LIST_TYPR|EntranceErrorCodeSummary|
+|linkis-entrance |50081|Shell code contains blacklisted
code(shell中包含黑名单代码)|SHELL_BLACKLISTED_CODE|EntranceErrorCodeSummary|
+|linkis-entrance |20301|The logPath cannot be
empty(日志路径不能为空)|LOGPATH_NOT_NULL|EntranceErrorCodeSummary|
+
+
+
+
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/errorcode/EntranceErrorCodeSummary.java
b/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/errorcode/EntranceErrorCodeSummary.java
new file mode 100644
index 000000000..05f3041a9
--- /dev/null
+++
b/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/errorcode/EntranceErrorCodeSummary.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.entrance.errorcode;
+
+public enum EntranceErrorCodeSummary {
+ UNSUPPORTED_OPERATION(10000, "Unsupported operation(不支持的操作)", "Unsupported
operation(不支持的操作)"),
+ JOBREQ_NOT_NULL(20001, "JobReq can't be null(JobReq不能为空)", "JobReq can't be
null(JobReq不能为空)"),
+ LABEL_NOT_NULL(
+ 20001,
+ "The label of userCreator or engineType cannot be null(标签 userCreator 或
engineType 不能为空)",
+ "The label of userCreator or engineType cannot be null(标签 userCreator 或
engineType 不能为空)"),
+ NOT_CREATE_EXECUTOR(
+ 20001,
+ "Task is not requestPersistTask, cannot to create
Executor(Task不是requestPersistTask,不能创建Executor)",
+ "Task is not requestPersistTask, cannot to create
Executor(Task不是requestPersistTask,不能创建Executor)"),
+ ENTRA_NOT_CREATE_EXECUTOR(
+ 20001,
+ "Task is not EntranceJob, cannot to create Executor(Task 不是
EntranceJob,不能创建 Executor)",
+ "Task is not EntranceJob, cannot to create Executor(Task 不是
EntranceJob,不能创建 Executor)"),
+
+ JOB_NOT_NULL(20002, "job can't be null(job不能为空)", "job can't be
null(job不能为空)"),
+ JOBREQUEST_NOT_NULL(
+ 20004,
+ "JobRequest cannot be null, unable to do persist operation(JobRequest
不能为空,无法进行持久化操作)",
+ "JobRequest cannot be null, unable to do persist operation(JobRequest
不能为空,无法进行持久化操作)"),
+ INSTANCE_NOT_NULL(
+ 20004, "The instance can't be null(实例不能为空)", "The instance can't be
null(实例不能为空)"),
+ EXECUTEUSER_NOT_NULL(
+ 20005,
+ "The execute user can't be null(执行用户不能为空)",
+ "The execute user can't be null(执行用户不能为空)"),
+
+ PARAM_NOT_NULL(
+ 20007,
+ "The param executionCode can not be empty (参数 executionCode 不能为空)",
+ "The param executionCode can not be empty (参数 executionCode 不能为空)"),
+ EXEC_SCRIP_NOT_NULL(
+ 20007,
+ "The param executionCode and scriptPath can not be empty at the same
time(参数 executionCode 和 scriptPath 不能同时为空)",
+ "The param executionCode and scriptPath can not be empty at the same
time(参数 executionCode 和 scriptPath 不能同时为空)"),
+
+ ONLY_CODE_SUPPORTED(
+ 20010,
+ "Only code with runtype supported (仅支持运行类型的代码)",
+ "Only code with runtype supported (仅支持运行类型的代码)"),
+ REQUEST_JOBHISTORY_FAILED(
+ 20011,
+ "Request jobHistory failed, reason (请求jobHistory失败,原因):",
+ "Request jobHistory failed, reason (请求jobHistory失败,原因):"),
+ JOBRESP_PROTOCOL_NULL(
+ 20011,
+ "Request jobHistory failed, reason: jobRespProtocol is null
(请求jobHistory失败,原因:jobRespProtocol为null)",
+ "Request jobHistory failed, reason: jobRespProtocol is null
(请求jobHistory失败,原因:jobRespProtocol为null)"),
+ READ_TASKS_FAILED(
+ 20011,
+ "Read all tasks failed, reason (读取所有任务失败,原因):",
+ "Read all tasks failed, reason (读取所有任务失败,原因):"),
+
+ SENDER_RPC_FAILED(20020, "Sender rpc failed(发件人 RPC 失败)", "Sender rpc
failed(发件人 RPC 失败)"),
+
+ FAILED_ANALYSIS_TASK(
+ 20039,
+ "Failed to analysis task ! the reason is(分析任务失败!原因是):",
+ "Failed to analysis task ! the reason is(分析任务失败!原因是):"),
+
+ INVALID_ENGINETYPE_NULL(
+ 20052,
+ "Invalid engineType null, cannot use cache(无效的engineType null,不能使用缓存)",
+ "Invalid engineType null, cannot use cache(无效的engineType null,不能使用缓存)"),
+ PERSIST_JOBREQUEST_ERROR(
+ 20052,
+ "Persist jobRequest error, please submit again later(存储Job异常,请稍后重新提交任务)",
+ "Persist jobRequest error, please submit again
later(存储Job异常,请稍后重新提交任务)"),
+
+ INVALID_RESULTSETS(
+ 20053,
+ "Invalid resultsets, cannot use cache(结果集无效,无法使用缓存)",
+ "Invalid resultsets, cannot use cache(结果集无效,无法使用缓存)"),
+ SUBMITTING_QUERY_FAILED(
+ 30009, "Submitting the query failed!(提交查询失败!)", "Submitting the query
failed!(提交查询失败!)"),
+ QUERY_STATUS_FAILED(
+ 50081,
+ "Query from jobHistory status failed(从 jobHistory 状态查询失败)",
+ "Query from jobHistory status failed(从 jobHistory 状态查询失败)"),
+ GET_QUERY_RESPONSE(
+ 50081,
+ "Get query response incorrectly(错误地获取查询响应)",
+ "Get query response incorrectly(错误地获取查询响应)"),
+ QUERY_TASKID_ERROR(
+ 50081,
+ "Query taskId error,taskId(查询 taskId 错误,taskId):",
+ "Query taskId error,taskId(查询 taskId 错误,taskId):"),
+ CORRECT_LIST_TYPR(
+ 50081,
+ "Query from jobhistory with incorrect list type of taskId, the taskId is
( 从jobhistory 中查询的参数类型不正确,taskId为):",
+ "Query from jobhistory with incorrect list type of taskId, the taskId is
( 从jobhistory 中查询的参数类型不正确,taskId为):"),
+ SHELL_BLACKLISTED_CODE(
+ 50081,
+ "Shell code contains blacklisted code(shell中包含黑名单代码)",
+ "Shell code contains blacklisted code(shell中包含黑名单代码)"),
+ JOB_HISTORY_FAILED_ID(50081, "", ""),
+
+ LOGPATH_NOT_NULL(
+ 20301, "The logPath cannot be empty(日志路径不能为空)", "The logPath cannot be
empty(日志路径不能为空)");
+
+ /** (errorCode)错误码 */
+ private int errorCode;
+ /** (errorDesc)错误描述 */
+ private String errorDesc;
+ /** Possible reasons for the error(错误可能出现的原因) */
+ private String comment;
+
+ EntranceErrorCodeSummary(int errorCode, String errorDesc, String comment) {
+ this.errorCode = errorCode;
+ this.errorDesc = errorDesc;
+ this.comment = comment;
+ }
+
+ public int getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(int errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public String getErrorDesc() {
+ return errorDesc;
+ }
+
+ public void setErrorDesc(String errorDesc) {
+ this.errorDesc = errorDesc;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ @Override
+ public String toString() {
+ return "errorCode: " + this.errorCode + ", errorDesc:" + this.errorDesc;
+ }
+}
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/parser/AbstractEntranceParser.java
b/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/parser/AbstractEntranceParser.java
index 5c789e06e..aa337a0c5 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/parser/AbstractEntranceParser.java
+++
b/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/parser/AbstractEntranceParser.java
@@ -45,6 +45,9 @@ import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static
org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary.JOBREQ_NOT_NULL;
+import static
org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary.JOB_NOT_NULL;
+
public abstract class AbstractEntranceParser extends EntranceParser {
private EntranceContext entranceContext;
@@ -80,7 +83,8 @@ public abstract class AbstractEntranceParser extends
EntranceParser {
@Override
public JobRequest parseToJobRequest(Job job) throws
EntranceIllegalParamException {
if (job == null) {
- throw new EntranceIllegalParamException(20002, "job can't be null");
+ throw new EntranceIllegalParamException(
+ JOB_NOT_NULL.getErrorCode(), JOB_NOT_NULL.getErrorDesc());
}
JobRequest jobRequest = ((EntranceJob) job).getJobRequest();
if (StringUtils.isEmpty(jobRequest.getReqId())) {
@@ -109,7 +113,8 @@ public abstract class AbstractEntranceParser extends
EntranceParser {
@Override
public Job parseToJob(JobRequest jobReq) throws
EntranceIllegalParamException {
if (jobReq == null) {
- throw new EntranceIllegalParamException(20001, "JobReq can't be null");
+ throw new EntranceIllegalParamException(
+ JOBREQ_NOT_NULL.getErrorCode(), JOBREQ_NOT_NULL.getErrorDesc());
}
EntranceJob job = createEntranceJob();
job.setId(String.valueOf(jobReq.getId()));
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/persistence/QueryPersistenceEngine.java
b/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/persistence/QueryPersistenceEngine.java
index 2705f4f31..188c2ab0d 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/persistence/QueryPersistenceEngine.java
+++
b/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/persistence/QueryPersistenceEngine.java
@@ -48,6 +48,8 @@ import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary.*;
+
public class QueryPersistenceEngine extends AbstractPersistenceEngine {
private Sender sender;
@@ -104,11 +106,13 @@ public class QueryPersistenceEngine extends
AbstractPersistenceEngine {
int status = jobRespProtocol.getStatus();
String message = jobRespProtocol.getMsg();
if (status != 0) {
- throw new QueryFailedException(20011, "Request jobHistory failed,
reason: " + message);
+ throw new QueryFailedException(
+ REQUEST_JOBHISTORY_FAILED.getErrorCode(),
+ REQUEST_JOBHISTORY_FAILED.getErrorDesc() + message);
}
} else {
throw new QueryFailedException(
- 20011, "Request jobHistory failed, reason: jobRespProtocol is null
");
+ JOBRESP_PROTOCOL_NULL.getErrorCode(),
JOBRESP_PROTOCOL_NULL.getErrorDesc());
}
return jobRespProtocol;
}
@@ -116,7 +120,8 @@ public class QueryPersistenceEngine extends
AbstractPersistenceEngine {
@Override
public void updateIfNeeded(JobRequest jobReq) throws ErrorException,
QueryFailedException {
if (null == jobReq) {
- throw new EntranceIllegalParamException(20004, "JobReq cannot be null.");
+ throw new EntranceIllegalParamException(
+ JOBREQ_NOT_NULL.getErrorCode(), JOBREQ_NOT_NULL.getErrorDesc());
}
JobRequest jobReqForUpdate = new JobRequest();
BeanUtils.copyProperties(jobReq, jobReqForUpdate);
@@ -138,7 +143,7 @@ public class QueryPersistenceEngine extends
AbstractPersistenceEngine {
public void persist(JobRequest jobReq) throws ErrorException {
if (null == jobReq) {
throw new EntranceIllegalParamException(
- 20004, "JobRequest cannot be null, unable to do persist operation");
+ JOBREQUEST_NOT_NULL.getErrorCode(),
JOBREQUEST_NOT_NULL.getErrorDesc());
}
JobReqInsert jobReqInsert = new JobReqInsert(jobReq);
JobRespProtocol jobRespProtocol = sendToJobHistoryAndRetry(jobReqInsert,
"Insert job");
@@ -162,7 +167,8 @@ public class QueryPersistenceEngine extends
AbstractPersistenceEngine {
List<Task> retList = new ArrayList<>();
if (instance == null || "".equals(instance)) {
- throw new EntranceIllegalParamException(20004, "instance can not be
null");
+ throw new EntranceIllegalParamException(
+ INSTANCE_NOT_NULL.getErrorCode(), INSTANCE_NOT_NULL.getErrorDesc());
}
RequestReadAllTask requestReadAllTask = new RequestReadAllTask(instance);
@@ -170,13 +176,15 @@ public class QueryPersistenceEngine extends
AbstractPersistenceEngine {
try {
responsePersist = (ResponsePersist) sender.ask(requestReadAllTask);
} catch (Exception e) {
- throw new EntranceRPCException(20020, "sender rpc failed ", e);
+ throw new EntranceRPCException(
+ SENDER_RPC_FAILED.getErrorCode(), SENDER_RPC_FAILED.getErrorDesc(),
e);
}
if (responsePersist != null) {
int status = responsePersist.getStatus();
String message = responsePersist.getMsg();
if (status != 0) {
- throw new QueryFailedException(20011, "read all tasks failed, reason:
" + message);
+ throw new QueryFailedException(
+ READ_TASKS_FAILED.getErrorCode(), READ_TASKS_FAILED.getErrorDesc()
+ message);
}
Map<String, Object> data = responsePersist.getData();
Object object = data.get(TaskConstant.TASK);
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/EntranceServer.scala
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/EntranceServer.scala
index 6a43cb6a1..1aa2097d6 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/EntranceServer.scala
+++
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/EntranceServer.scala
@@ -20,6 +20,7 @@ package org.apache.linkis.entrance
import org.apache.linkis.common.exception.{ErrorException, LinkisException,
LinkisRuntimeException}
import org.apache.linkis.common.utils.{Logging, Utils}
import org.apache.linkis.entrance.cs.CSEntranceHelper
+import org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary._
import org.apache.linkis.entrance.exception.{EntranceErrorException,
SubmitFailedException}
import org.apache.linkis.entrance.execute.EntranceJob
import org.apache.linkis.entrance.log.LogReader
@@ -69,8 +70,8 @@ abstract class EntranceServer extends Logging {
.persist(jobRequest)
if (null == jobRequest.getId || jobRequest.getId <= 0) {
throw new EntranceErrorException(
- 20052,
- "Persist jobRequest error, please submit again
later(存储Job异常,请稍后重新提交任务)"
+ PERSIST_JOBREQUEST_ERROR.getErrorCode,
+ PERSIST_JOBREQUEST_ERROR.getErrorDesc
)
}
logger.info(s"received a request,convert $jobRequest")
@@ -85,19 +86,15 @@ abstract class EntranceServer extends Logging {
case error: ErrorException => error
case t1: Throwable =>
val exception = new EntranceErrorException(
- 20039,
- "failed to analysis task ! the reason is :" +
ExceptionUtils.getRootCauseMessage(
- t
- ) + "(解析task失败!原因:" + ExceptionUtils.getRootCauseMessage(t)
+ FAILED_ANALYSIS_TASK.getErrorCode,
+ FAILED_ANALYSIS_TASK.getErrorDesc +
ExceptionUtils.getRootCauseMessage(t)
)
exception.initCause(t1)
exception
case _ =>
new EntranceErrorException(
- 20039,
- "failed to analysis task ! the reason is :" +
ExceptionUtils.getRootCauseMessage(
- t
- ) + "(解析task失败!原因:" + ExceptionUtils.getRootCauseMessage(t)
+ FAILED_ANALYSIS_TASK.getErrorCode,
+ FAILED_ANALYSIS_TASK.getErrorDesc +
ExceptionUtils.getRootCauseMessage(t)
)
}
jobRequest match {
@@ -171,8 +168,8 @@ abstract class EntranceServer extends Logging {
case e: LinkisRuntimeException => e
case t: Throwable =>
new SubmitFailedException(
- 30009,
- "Submitting the query failed!(提交查询失败!)" +
ExceptionUtils.getRootCauseMessage(t),
+ SUBMITTING_QUERY_FAILED.getErrorCode,
+ SUBMITTING_QUERY_FAILED.getErrorDesc +
ExceptionUtils.getRootCauseMessage(t),
t
)
}
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/exception/JobHistoryFailedException.scala
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/exception/JobHistoryFailedException.scala
index c4b4b2a47..6794a39b5 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/exception/JobHistoryFailedException.scala
+++
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/exception/JobHistoryFailedException.scala
@@ -18,5 +18,7 @@
package org.apache.linkis.entrance.exception
import org.apache.linkis.common.exception.ErrorException
+import org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary._
-case class JobHistoryFailedException(errorMsg: String) extends
ErrorException(50081, errorMsg)
+case class JobHistoryFailedException(errorMsg: String)
+ extends ErrorException(JOB_HISTORY_FAILED_ID.getErrorCode, errorMsg)
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/exception/SensitiveTablesCheckException.scala
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/exception/SensitiveTablesCheckException.scala
index 90ae00d3a..44e7e47cf 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/exception/SensitiveTablesCheckException.scala
+++
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/exception/SensitiveTablesCheckException.scala
@@ -18,7 +18,9 @@
package org.apache.linkis.entrance.exception
import org.apache.linkis.common.exception.ErrorException
+import org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary._
case class SensitiveTablesCheckException(errorMsg: String) extends
ErrorException(50079, errorMsg)
-case class DangerousGramsCheckException(errorMsg: String) extends
ErrorException(50081, errorMsg)
+case class DangerousGramsCheckException(errorMsg: String)
+ extends ErrorException(JOB_HISTORY_FAILED_ID.getErrorCode, errorMsg)
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/execute/EntranceExecutorManager.scala
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/execute/EntranceExecutorManager.scala
index ed1ff4a45..ff79a12c6 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/execute/EntranceExecutorManager.scala
+++
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/execute/EntranceExecutorManager.scala
@@ -20,6 +20,7 @@ package org.apache.linkis.entrance.execute
import org.apache.linkis.common.exception.WarnException
import org.apache.linkis.common.utils.{Logging, Utils}
import org.apache.linkis.entrance.conf.EntranceConfiguration
+import org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary._
import org.apache.linkis.entrance.exception.EntranceErrorException
import org.apache.linkis.entrance.job.EntranceExecutionJob
import org.apache.linkis.governance.common.entity.job.JobRequest
@@ -115,14 +116,14 @@ abstract class EntranceExecutorManager(groupFactory:
GroupFactory)
entranceEntranceExecutor
case _ =>
throw new EntranceErrorException(
- 20001,
- "Task is not requestPersistTask, cannot to create Executor"
+ NOT_CREATE_EXECUTOR.getErrorCode,
+ NOT_CREATE_EXECUTOR.getErrorDesc
)
}
case _ =>
throw new EntranceErrorException(
- 20001,
- "Task is not EntranceJob, cannot to create Executor"
+ ENTRA_NOT_CREATE_EXECUTOR.getErrorCode,
+ ENTRA_NOT_CREATE_EXECUTOR.getErrorDesc
)
}
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/execute/EntranceJob.scala
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/execute/EntranceJob.scala
index 5e9088f7a..88b035416 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/execute/EntranceJob.scala
+++
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/execute/EntranceJob.scala
@@ -21,6 +21,7 @@ import org.apache.linkis.common.log.LogUtils
import org.apache.linkis.common.utils.Utils
import org.apache.linkis.entrance.EntranceContext
import org.apache.linkis.entrance.conf.EntranceConfiguration
+import org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary._
import org.apache.linkis.entrance.event._
import org.apache.linkis.entrance.exception.EntranceErrorException
import org.apache.linkis.governance.common.entity.job.JobRequest
@@ -284,7 +285,11 @@ abstract class EntranceJob extends Job {
this.getExecutor match {
case entranceExecutor: EntranceExecutor =>
operate(entranceExecutor)
- case _ => throw new EntranceErrorException(10000, "Unsupported
operation")
+ case _ =>
+ throw new EntranceErrorException(
+ UNSUPPORTED_OPERATION.getErrorCode,
+ UNSUPPORTED_OPERATION.getErrorDesc
+ )
}
}
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/ShellDangerousGrammerInterceptor.scala
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/ShellDangerousGrammerInterceptor.scala
index cabbe84b6..c2b668039 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/ShellDangerousGrammerInterceptor.scala
+++
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/ShellDangerousGrammerInterceptor.scala
@@ -19,6 +19,7 @@ package org.apache.linkis.entrance.interceptor.impl
import org.apache.linkis.common.utils.Logging
import org.apache.linkis.entrance.conf.EntranceConfiguration
+import org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary._
import org.apache.linkis.entrance.exception.DangerousGramsCheckException
import org.apache.linkis.entrance.interceptor.EntranceInterceptor
import org.apache.linkis.governance.common.entity.job.JobRequest
@@ -106,7 +107,7 @@ class ShellDangerousGrammerInterceptor extends
EntranceInterceptor with Logging
) {
logger.info(s"GET REQUEST CODE_TYPE ${codeType} and ENGINE_TYPE
${EngineType}")
if (shellContainDangerUsage(jobRequest.getExecutionCode)) {
- throw DangerousGramsCheckException("Shell code contains blacklisted
code(shell中包含黑名单代码)")
+ throw DangerousGramsCheckException(SHELL_BLACKLISTED_CODE.getErrorDesc)
}
jobRequest
} else {
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/HDFSCacheLogWriter.scala
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/HDFSCacheLogWriter.scala
index c0cb7ced3..c3e04b665 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/HDFSCacheLogWriter.scala
+++
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/HDFSCacheLogWriter.scala
@@ -20,6 +20,7 @@ package org.apache.linkis.entrance.log
import org.apache.linkis.common.io.FsPath
import org.apache.linkis.common.utils.Utils
import org.apache.linkis.entrance.conf.EntranceConfiguration
+import org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary._
import org.apache.linkis.entrance.exception.EntranceErrorException
import org.apache.linkis.storage.FSFactory
import org.apache.linkis.storage.fs.FileSystem
@@ -37,7 +38,7 @@ class HDFSCacheLogWriter(logPath: String, charset: String,
sharedCache: Cache, u
extends LogWriter(charset) {
if (StringUtils.isBlank(logPath))
- throw new EntranceErrorException(20301, "logPath cannot be empty.")
+ throw new EntranceErrorException(LOGPATH_NOT_NULL.getErrorCode,
LOGPATH_NOT_NULL.getErrorDesc)
protected var fileSystem =
FSFactory.getFsByProxyUser(new FsPath(logPath),
user).asInstanceOf[FileSystem]
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/LogReader.scala
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/LogReader.scala
index faee75936..1d5f0cbda 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/LogReader.scala
+++
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/LogReader.scala
@@ -48,7 +48,7 @@ abstract class LogReader(charset: String) extends Closeable
with Logging {
*/
def readArray(logs: Array[String], fromLine: Int, size: Int = 100): Int = {
if (logs.length != 4) {
- throw new LogReadFailedException(" logs的长度必须为4!")
+ throw new LogReadFailedException(" The length of the log must be
4(logs的长度必须为4)")
}
val error = new StringBuilder
val warning = new StringBuilder
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/LogWriter.scala
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/LogWriter.scala
index f730abe50..2850c2053 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/LogWriter.scala
+++
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/LogWriter.scala
@@ -19,6 +19,7 @@ package org.apache.linkis.entrance.log
import org.apache.linkis.common.io.FsPath
import org.apache.linkis.common.utils.{Logging, Utils}
+import
org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary.LOGPATH_NOT_NULL
import org.apache.linkis.entrance.exception.EntranceErrorException
import org.apache.linkis.storage.FSFactory
import org.apache.linkis.storage.fs.FileSystem
@@ -75,7 +76,7 @@ abstract class AbstractLogWriter(logPath: String, user:
String, charset: String)
extends LogWriter(charset) {
if (StringUtils.isBlank(logPath)) {
- throw new EntranceErrorException(20301, "logPath cannot be empty.")
+ throw new EntranceErrorException(LOGPATH_NOT_NULL.getErrorCode,
LOGPATH_NOT_NULL.getErrorDesc)
}
protected var fileSystem =
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/parser/CommonEntranceParser.scala
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/parser/CommonEntranceParser.scala
index f62cb2b83..e2881a9c7 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/parser/CommonEntranceParser.scala
+++
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/parser/CommonEntranceParser.scala
@@ -19,6 +19,7 @@ package org.apache.linkis.entrance.parser
import org.apache.linkis.common.utils.Logging
import org.apache.linkis.entrance.conf.EntranceConfiguration
+import org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary._
import org.apache.linkis.entrance.exception.{EntranceErrorCode,
EntranceIllegalParamException}
import org.apache.linkis.entrance.persistence.PersistenceManager
import org.apache.linkis.entrance.timeout.JobTimeoutManager
@@ -95,11 +96,17 @@ class CommonEntranceParser(val persistenceManager:
PersistenceManager)
code = executionContent.get(TaskConstant.CODE).asInstanceOf[String]
runType = executionContent.get(TaskConstant.RUNTYPE).asInstanceOf[String]
if (StringUtils.isBlank(code)) {
- throw new EntranceIllegalParamException(20007, "param executionCode
can not be empty ")
+ throw new EntranceIllegalParamException(
+ PARAM_NOT_NULL.getErrorCode,
+ PARAM_NOT_NULL.getErrorDesc
+ )
}
} else {
// todo check
- throw new EntranceIllegalParamException(20010, "Only code with runtype
supported !")
+ throw new EntranceIllegalParamException(
+ ONLY_CODE_SUPPORTED.getErrorCode,
+ PARAM_NOT_NULL.getErrorDesc
+ )
}
val formatCode = params.get(TaskConstant.FORMATCODE).asInstanceOf[Boolean]
if (formatCode) code = format(code)
@@ -194,7 +201,10 @@ class CommonEntranceParser(val persistenceManager:
PersistenceManager)
jobReq.setSubmitUser(umUser)
}
if (umUser == null) {
- throw new EntranceIllegalParamException(20005, "execute user can not be
null")
+ throw new EntranceIllegalParamException(
+ EXECUTEUSER_NOT_NULL.getErrorCode,
+ EXECUTEUSER_NOT_NULL.getErrorDesc
+ )
}
jobReq.setExecuteUser(umUser)
var executionCode =
params.get(TaskConstant.EXECUTIONCODE).asInstanceOf[String]
@@ -221,8 +231,8 @@ class CommonEntranceParser(val persistenceManager:
PersistenceManager)
StringUtils.isEmpty(executionCode)
) {
throw new EntranceIllegalParamException(
- 20007,
- "param executionCode and scriptPath can not be empty at the same time"
+ EXEC_SCRIP_NOT_NULL.getErrorCode,
+ EXEC_SCRIP_NOT_NULL.getErrorDesc
)
}
var runType: String = null
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/scheduler/EntranceGroupFactory.scala
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/scheduler/EntranceGroupFactory.scala
index 1ffb3ffa2..650ef230b 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/scheduler/EntranceGroupFactory.scala
+++
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/scheduler/EntranceGroupFactory.scala
@@ -20,6 +20,7 @@ package org.apache.linkis.entrance.scheduler
import org.apache.linkis.common.conf.{CommonVars, Configuration}
import org.apache.linkis.common.utils.{Logging, Utils}
import org.apache.linkis.entrance.conf.EntranceConfiguration
+import org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary._
import org.apache.linkis.entrance.exception.{EntranceErrorCode,
EntranceErrorException}
import org.apache.linkis.entrance.execute.EntranceJob
import org.apache.linkis.governance.common.protocol.conf.{
@@ -204,7 +205,7 @@ object EntranceGroupFactory {
val engineType = labels.asScala.find(_.isInstanceOf[EngineTypeLabel])
val concurrent =
labels.asScala.find(_.isInstanceOf[ConcurrentEngineConnLabel])
if (userCreator.isEmpty || engineType.isEmpty) {
- throw new EntranceErrorException(20001, "userCreator label or engineType
label cannot null")
+ throw new EntranceErrorException(LABEL_NOT_NULL.getErrorCode,
LABEL_NOT_NULL.getErrorDesc)
}
if (concurrent.isDefined) {
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/scheduler/cache/ReadCacheConsumer.scala
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/scheduler/cache/ReadCacheConsumer.scala
index 6c1ec4fc2..50318e563 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/scheduler/cache/ReadCacheConsumer.scala
+++
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/scheduler/cache/ReadCacheConsumer.scala
@@ -19,6 +19,7 @@ package org.apache.linkis.entrance.scheduler.cache
import org.apache.linkis.common.io.FsPath
import org.apache.linkis.common.utils.Utils
+import org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary._
import org.apache.linkis.entrance.exception.CacheNotReadyException
import org.apache.linkis.entrance.execute.EntranceJob
import org.apache.linkis.entrance.persistence.PersistenceManager
@@ -71,7 +72,10 @@ class ReadCacheConsumer(
"Invalid engineType null, cannot process. jobReq : " +
BDPJettyServerHelper.gson
.toJson(jobRequest)
)
- throw CacheNotReadyException(20052, "Invalid engineType null,
cannot use cache.")
+ throw CacheNotReadyException(
+ INVALID_ENGINETYPE_NULL.getErrorCode,
+ INVALID_ENGINETYPE_NULL.getErrorDesc
+ )
}
val readCacheBefore = TaskUtils
.getRuntimeMap(job.getParams)
@@ -95,7 +99,10 @@ class ReadCacheConsumer(
)
.getSchemaPath
// persistenceManager.onResultSetCreated(job, new
CacheOutputExecuteResponse(alias, output))
- throw CacheNotReadyException(20053, "Invalid resultsets,
cannot use cache.")
+ throw CacheNotReadyException(
+ INVALID_RESULTSETS.getErrorCode,
+ INVALID_RESULTSETS.getErrorDesc
+ )
// todo check
}
// persistenceManager.onResultSizeCreated(job,
resultSets.size())
diff --git
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/utils/JobHistoryHelper.scala
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/utils/JobHistoryHelper.scala
index d912e7110..e60a5e218 100644
---
a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/utils/JobHistoryHelper.scala
+++
b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/utils/JobHistoryHelper.scala
@@ -20,6 +20,7 @@ package org.apache.linkis.entrance.utils
import org.apache.linkis.common.exception.ErrorException
import org.apache.linkis.common.utils.{Logging, Utils}
import org.apache.linkis.entrance.conf.EntranceConfiguration
+import org.apache.linkis.entrance.errorcode.EntranceErrorCodeSummary._
import org.apache.linkis.entrance.exception.JobHistoryFailedException
import org.apache.linkis.entrance.execute.EntranceJob
import org.apache.linkis.governance.common.constant.job.JobRequestConstants
@@ -136,7 +137,7 @@ object JobHistoryHelper extends Logging {
val status = responsePersist.getStatus
if (status != SUCCESS_FLAG) {
logger.error(s"query from jobHistory status failed, status is
$status")
- throw JobHistoryFailedException("query from jobHistory status
failed")
+ throw JobHistoryFailedException(QUERY_STATUS_FAILED.getErrorDesc)
} else {
val data = responsePersist.getData
data.get(JobRequestConstants.JOB_HISTORY_LIST) match {
@@ -144,19 +145,17 @@ object JobHistoryHelper extends Logging {
if (tasks.size() > 0) tasks.get(0)
else null
case _ =>
- throw JobHistoryFailedException(
- s"query from jobhistory not a correct List type taskId is
$taskID"
- )
+ throw JobHistoryFailedException(CORRECT_LIST_TYPR.getErrorDesc
+ s"$taskID")
}
}
case _ =>
logger.error("get query response incorrectly")
- throw JobHistoryFailedException("get query response incorrectly")
+ throw JobHistoryFailedException(GET_QUERY_RESPONSE.getErrorDesc)
}
} {
case errorException: ErrorException => throw errorException
case e: Exception =>
- val e1 = JobHistoryFailedException(s"query taskId $taskID error")
+ val e1 = JobHistoryFailedException(QUERY_TASKID_ERROR.getErrorDesc +
s"$taskID")
e1.initCause(e)
throw e
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]