You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@linkis.apache.org by GitBox <gi...@apache.org> on 2022/04/26 13:06:48 UTC

[GitHub] [incubator-linkis] peacewong commented on a diff in pull request #2039: Fix the issue that the keys of put and remove in Map used in CliHeartbeatMonitor are not the same

peacewong commented on code in PR #2039:
URL: https://github.com/apache/incubator-linkis/pull/2039#discussion_r858690618


##########
linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/cli/heartbeat/CliHeartbeatMonitor.scala:
##########
@@ -38,38 +35,41 @@ class CliHeartbeatMonitor(handler: HeartbeatLossHandler) extends Logging {
 
   def panicIfNull(obj: Any, msg: String): Unit = {
     if (obj == null) {
-          throw new EntranceErrorException(EntranceErrorCode.VARIABLE_NULL_EXCEPTION.getErrCode, msg)
+      throw new EntranceErrorException(EntranceErrorCode.VARIABLE_NULL_EXCEPTION.getErrCode, msg)
     }
   }
 
   /*
   register for scan
    */
   def registerIfCliJob(job: Job): Unit = {
-    if (job.isInstanceOf[EntranceJob]) {
-      val entranceJob = job.asInstanceOf[EntranceJob]
-      if (isCliJob(entranceJob)) {
-        val id = job.getJobInfo.getId
-        if (infoMap.containsKey(id)) {
-          error("registered duplicate job!! job-id: " + id)
-        } else {
-          infoMap.put(id, entranceJob)
-          info("registered cli job: " + id)
+    job match {
+      case entranceJob: EntranceJob =>
+        if (isCliJob(entranceJob)) {
+          val id = entranceJob.getJobRequest.getId.toString
+          if (infoMap.containsKey(id)) {
+            error("registered duplicate job!! job-id: " + id)

Review Comment:
   > Using `job id:` in log printing is cleaner and should be consistent 日志打印中使用 job id 更清晰,而且应该保持统一
   
   Thanks. I will fix it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For additional commands, e-mail: notifications-help@linkis.apache.org