This is an automated email from the ASF dual-hosted git repository.

peacewong pushed a commit to branch dev-1.3.2
in repository https://gitbox.apache.org/repos/asf/linkis.git


The following commit(s) were added to refs/heads/dev-1.3.2 by this push:
     new 2f1faccf6 Optimization of error log information in RMErrorCode (#4275)
2f1faccf6 is described below

commit 2f1faccf6fa13e30a3cb1c0499b63aa3fa0d0f57
Author: binbincheng <[email protected]>
AuthorDate: Sat Mar 4 19:20:34 2023 +0800

    Optimization of error log information in RMErrorCode (#4275)
    
    * Optimization of error log information in RMErrorCode
---
 .../linkis/manager/rm/exception/RMErrorCode.java      | 19 ++++++++++++-------
 .../rm/service/impl/DefaultResourceManager.scala      | 14 ++++++++++++--
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git 
a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/rm/exception/RMErrorCode.java
 
b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/rm/exception/RMErrorCode.java
index 0a759e843..b51393141 100644
--- 
a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/rm/exception/RMErrorCode.java
+++ 
b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/rm/exception/RMErrorCode.java
@@ -22,11 +22,15 @@ import org.apache.linkis.common.errorcode.LinkisErrorCode;
 public enum RMErrorCode implements LinkisErrorCode {
 
   /** */
-  LABEL_RESOURCE_NOT_FOUND(110021, "label resource not found, please check!"),
+  LABEL_RESOURCE_NOT_FOUND(110021, "label resource not found, please 
check!(未找到标签资源,请检查!)"),
 
-  LOCK_LABEL_FAILED(110022, "lock label failed!"),
+  LOCK_LABEL_FAILED(
+      110022,
+      "lock label failed! {0} over {1} ms,please wait a moment and try 
again!(锁定标签失败! {0} 超过 {1} 毫秒,请稍等片刻,然后重试!)"),
 
-  LABEL_DUPLICATED(110019, "label has exist"),
+  LABEL_DUPLICATED(
+      110019,
+      "Label has exist! {0} has been registered in {1}, cannot be updated to 
{2}(标签已存在! {0} 已在 {1} 注册,无法更新到 {2})"),
 
   DRIVER_MEMORY_INSUFFICIENT(
       12004,
@@ -40,7 +44,8 @@ public enum RMErrorCode implements LinkisErrorCode {
       12006, "Insufficient number of instances, idle engines can be 
killed(实例数不足,可以kill空闲的引擎)"),
 
   QUEUE_MEMORY_INSUFFICIENT(
-      12002, "Insufficient queue memory resources, reduce the executor 
memory"),
+      12002,
+      "Insufficient queue memory resources, reduce the executor 
memory(queue内存资源不足,减少executor内存)"),
 
   QUEUE_CPU_INSUFFICIENT(
       12001,
@@ -50,11 +55,11 @@ public enum RMErrorCode implements LinkisErrorCode {
       12003,
       "Insufficient number of queue instances, idle engines can be 
killed(队列实例数不足,可以kill空闲的引擎)"),
 
-  CLUSTER_QUEUE_MEMORY_INSUFFICIENT(12010, "Insufficient cluster queue 
memory"),
+  CLUSTER_QUEUE_MEMORY_INSUFFICIENT(12010, "Insufficient cluster queue 
memory(集群队列内存不足)"),
 
-  CLUSTER_QUEUE_CPU_INSUFFICIENT(12011, "Insufficient cluster queue cpu"),
+  CLUSTER_QUEUE_CPU_INSUFFICIENT(12011, "Insufficient cluster queue 
cpu(集群队列cpu不足)"),
 
-  CLUSTER_QUEUE_INSTANCES_INSUFFICIENT(12012, "Insufficient cluster queue 
instance"),
+  CLUSTER_QUEUE_INSTANCES_INSUFFICIENT(12012, "Insufficient cluster queue 
instance(集群队列实例不足)"),
 
   ECM_RESOURCE_INSUFFICIENT(11000, "ECM resources are insufficient(ECM 资源不足)"),
 
diff --git 
a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/scala/org/apache/linkis/manager/rm/service/impl/DefaultResourceManager.scala
 
b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/scala/org/apache/linkis/manager/rm/service/impl/DefaultResourceManager.scala
index daf90f957..3f89fa209 100644
--- 
a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/scala/org/apache/linkis/manager/rm/service/impl/DefaultResourceManager.scala
+++ 
b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/scala/org/apache/linkis/manager/rm/service/impl/DefaultResourceManager.scala
@@ -67,6 +67,7 @@ import org.springframework.beans.factory.InitializingBean
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.stereotype.Component
 
+import java.text.MessageFormat
 import java.util
 import java.util.{Date, UUID}
 import java.util.concurrent.TimeUnit
@@ -153,7 +154,12 @@ class DefaultResourceManager extends ResourceManager with 
Logging with Initializ
       if (!emResource.getResourceType.equals(resource.getResourceType)) {
         throw new RMErrorException(
           RMErrorCode.LABEL_DUPLICATED.getErrorCode,
-          s"${serviceInstance} has been registered in 
${emResource.getResourceType}, cannot be updated to ${resource.getResourceType}"
+          MessageFormat.format(
+            RMErrorCode.LABEL_DUPLICATED.getErrorDesc,
+            serviceInstance,
+            emResource.getResourceType,
+            resource.getResourceType
+          )
         )
       }
     }
@@ -599,7 +605,11 @@ class DefaultResourceManager extends ResourceManager with 
Logging with Initializ
     if (!locked) {
       throw new RMLockFailedRetryException(
         RMErrorCode.LOCK_LABEL_FAILED.getErrorCode,
-        s"${RMErrorCode.LOCK_LABEL_FAILED.getErrorDesc} + 
${label.getStringValue} over $timeOut ms, please wait a moment and try again!"
+        MessageFormat.format(
+          RMErrorCode.LOCK_LABEL_FAILED.getErrorDesc,
+          label.getStringValue,
+          timeOut.toString
+        )
       )
     }
     persistenceLock


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to