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 637d61cff [Bug] add cut mark in error desc message (#3954)
637d61cff is described below

commit 637d61cff7516094651ec5cd99f117eb96837e0a
Author: GuoPhilipse <[email protected]>
AuthorDate: Mon Dec 5 20:20:44 2022 +0800

    [Bug] add cut mark in error desc message (#3954)
---
 .../service/impl/JobHistoryQueryServiceImpl.scala  | 24 ++++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git 
a/linkis-public-enhancements/linkis-jobhistory/src/main/scala/org/apache/linkis/jobhistory/service/impl/JobHistoryQueryServiceImpl.scala
 
b/linkis-public-enhancements/linkis-jobhistory/src/main/scala/org/apache/linkis/jobhistory/service/impl/JobHistoryQueryServiceImpl.scala
index 464d65b2b..989fac567 100644
--- 
a/linkis-public-enhancements/linkis-jobhistory/src/main/scala/org/apache/linkis/jobhistory/service/impl/JobHistoryQueryServiceImpl.scala
+++ 
b/linkis-public-enhancements/linkis-jobhistory/src/main/scala/org/apache/linkis/jobhistory/service/impl/JobHistoryQueryServiceImpl.scala
@@ -27,9 +27,8 @@ import org.apache.linkis.governance.common.entity.job.{
   SubJobDetail
 }
 import org.apache.linkis.governance.common.protocol.job._
-import org.apache.linkis.jobhistory.conf.JobhistoryConfiguration
 import org.apache.linkis.jobhistory.conversions.TaskConversions._
-import org.apache.linkis.jobhistory.dao.{JobDetailMapper, JobHistoryMapper}
+import org.apache.linkis.jobhistory.dao.JobHistoryMapper
 import org.apache.linkis.jobhistory.entity.{JobHistory, QueryJobHistory}
 import org.apache.linkis.jobhistory.service.JobHistoryQueryService
 import org.apache.linkis.jobhistory.transitional.TaskStatus
@@ -105,7 +104,7 @@ class JobHistoryQueryServiceImpl extends 
JobHistoryQueryService with Logging {
         if (jobReq.getErrorDesc.length > 
GovernanceCommonConf.ERROR_CODE_DESC_LEN) {
           logger.info(s"errorDesc is too long,we will cut some message")
           jobReq.setErrorDesc(
-            jobReq.getErrorDesc.substring(0, 
GovernanceCommonConf.ERROR_CODE_DESC_LEN)
+            jobReq.getErrorDesc.substring(0, 
GovernanceCommonConf.ERROR_CODE_DESC_LEN - 3) + "..."
           )
           logger.info(s"${jobReq.getErrorDesc}")
         }
@@ -115,16 +114,21 @@ class JobHistoryQueryServiceImpl extends 
JobHistoryQueryService with Logging {
         if (oldStatus != null && !shouldUpdate(oldStatus, jobReq.getStatus)) {
           throw new QueryException(
             120001,
-            
s"jobId:${jobReq.getId},在数据库中的task状态为:${oldStatus},更新的task状态为:${jobReq.getStatus},更新失败!"
+            s"jobId:${jobReq.getId},oldStatus(在数据库中的task状态为):${oldStatus}," +
+              s" newStatus(更新的task状态为):${jobReq.getStatus},update 
failed(更新失败)!"
           )
         }
       }
       val jobUpdate = jobRequest2JobHistory(jobReq)
       if (jobUpdate.getUpdatedTime == null) {
-        throw new QueryException(120001, 
s"jobId:${jobReq.getId},更新job相关信息失败,请指定该请求的更新时间!")
+        throw new QueryException(
+          120001,
+          s"jobId:${jobReq.getId},update job failed, updatetime 
needed(更新job相关信息失败,请指定该请求的更新时间)!"
+        )
       }
       logger.info(
-        s"Update data to the database(往数据库中更新数据):task ${jobReq.getId} + status 
${jobReq.getStatus}, updateTime: ${jobUpdate.getUpdateTimeMills}, progress : 
${jobUpdate.getProgress}"
+        s"Update data to the database(往数据库中更新数据):task ${jobReq.getId} ,status 
${jobReq.getStatus}," +
+          s" updateTime: ${jobUpdate.getUpdateTimeMills}, progress : 
${jobUpdate.getProgress}"
       )
       jobHistoryMapper.updateJobHistory(jobUpdate)
       val map = new util.HashMap[String, Object]
@@ -164,7 +168,8 @@ class JobHistoryQueryServiceImpl extends 
JobHistoryQueryService with Logging {
             if (jobReq.getErrorDesc.length > 
GovernanceCommonConf.ERROR_CODE_DESC_LEN) {
               logger.info(s"errorDesc is too long,we will cut some message")
               jobReq.setErrorDesc(
-                jobReq.getErrorDesc.substring(0, 
GovernanceCommonConf.ERROR_CODE_DESC_LEN)
+                jobReq.getErrorDesc
+                  .substring(0, GovernanceCommonConf.ERROR_CODE_DESC_LEN - 3) 
+ "..."
               )
               logger.info(s"${jobReq.getErrorDesc}")
             }
@@ -174,7 +179,8 @@ class JobHistoryQueryServiceImpl extends 
JobHistoryQueryService with Logging {
             if (oldStatus != null && !shouldUpdate(oldStatus, 
jobReq.getStatus)) {
               throw new QueryException(
                 120001,
-                
s"jobId:${jobReq.getId},在数据库中的task状态为:${oldStatus},更新的task状态为:${jobReq.getStatus},更新失败!"
+                
s"jobId:${jobReq.getId},oldStatus(在数据库中的task状态为):${oldStatus}," +
+                  s"newStatus(更新的task状态为):${jobReq.getStatus},update 
failed(更新失败)!"
               )
             }
           }
@@ -210,7 +216,7 @@ class JobHistoryQueryServiceImpl extends 
JobHistoryQueryService with Logging {
 
   @Receiver
   override def query(jobReqQuery: JobReqQuery): JobRespProtocol = {
-    logger.info("查询历史task:" + jobReqQuery.toString)
+    logger.info("query history task:" + jobReqQuery.toString)
     val jobResp = new JobRespProtocol
     Utils.tryCatch {
       val jobHistory = jobRequest2JobHistory(jobReqQuery.jobReq)


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

Reply via email to