You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2022/04/11 11:14:36 UTC
[incubator-linkis] branch dev-1.1.2 updated: Deliever original jobId in linkis-entrance module to EngineConn and LinkisManager (#1941)
This is an automated email from the ASF dual-hosted git repository.
peacewong pushed a commit to branch dev-1.1.2
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git
The following commit(s) were added to refs/heads/dev-1.1.2 by this push:
new 3627057e0 Deliever original jobId in linkis-entrance module to EngineConn and LinkisManager (#1941)
3627057e0 is described below
commit 3627057e0330936689b8c18fddabdcc4706e3c89
Author: Alexyang <xu...@qq.com>
AuthorDate: Mon Apr 11 19:14:28 2022 +0800
Deliever original jobId in linkis-entrance module to EngineConn and LinkisManager (#1941)
* #1938
1. put original jobId to both startup map and runtime map in linkis-entrance.
2. get original jobId in linkis-computation-engineconn.
* 1. format code
---
.../linkis/governance/common/utils/JobUtils.scala | 37 ++++++++++++++++++++++
.../service/TaskExecutionServiceImpl.scala | 3 ++
.../linkis/entrance/job/EntranceExecutionJob.java | 11 +++++++
3 files changed, 51 insertions(+)
diff --git a/linkis-computation-governance/linkis-computation-governance-common/src/main/scala/org/apache/linkis/governance/common/utils/JobUtils.scala b/linkis-computation-governance/linkis-computation-governance-common/src/main/scala/org/apache/linkis/governance/common/utils/JobUtils.scala
new file mode 100644
index 000000000..1b0638d69
--- /dev/null
+++ b/linkis-computation-governance/linkis-computation-governance-common/src/main/scala/org/apache/linkis/governance/common/utils/JobUtils.scala
@@ -0,0 +1,37 @@
+/*
+ * 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.governance.common.utils
+
+import org.apache.linkis.governance.common.constant.job.JobRequestConstants
+import org.apache.linkis.protocol.utils.TaskUtils
+
+import java.util;
+
+object JobUtils {
+
+ def getJobIdFromMap(map: util.Map[String, Object]): String = {
+ if (null != map && map.containsKey(JobRequestConstants.JOB_ID)) {
+ val value = map.get(JobRequestConstants.JOB_ID)
+ if (null != value) {
+ return value.toString
+ }
+ }
+ null
+ }
+
+}
diff --git a/linkis-computation-governance/linkis-engineconn/linkis-computation-engineconn/src/main/scala/org/apache/linkis/engineconn/computation/executor/service/TaskExecutionServiceImpl.scala b/linkis-computation-governance/linkis-engineconn/linkis-computation-engineconn/src/main/scala/org/apache/linkis/engineconn/computation/executor/service/TaskExecutionServiceImpl.scala
index 407892e9f..6d5ddb4c5 100644
--- a/linkis-computation-governance/linkis-engineconn/linkis-computation-engineconn/src/main/scala/org/apache/linkis/engineconn/computation/executor/service/TaskExecutionServiceImpl.scala
+++ b/linkis-computation-governance/linkis-engineconn/linkis-computation-engineconn/src/main/scala/org/apache/linkis/engineconn/computation/executor/service/TaskExecutionServiceImpl.scala
@@ -42,6 +42,7 @@ import org.apache.linkis.engineconn.executor.listener.event.EngineConnSyncEvent
import org.apache.linkis.governance.common.entity.ExecutionNodeStatus
import org.apache.linkis.governance.common.exception.engineconn.{EngineConnExecutorErrorCode, EngineConnExecutorErrorException}
import org.apache.linkis.governance.common.protocol.task._
+import org.apache.linkis.governance.common.utils.JobUtils
import org.apache.linkis.manager.common.entity.enumeration.NodeStatus
import org.apache.linkis.manager.common.protocol.resource.ResponseTaskYarnResource
import org.apache.linkis.manager.label.entity.Label
@@ -130,6 +131,8 @@ class TaskExecutionServiceImpl extends TaskExecutionService with Logging with Re
if (null != retry) retry.asInstanceOf[Boolean]
else false
}
+ val jobId = JobUtils.getJobIdFromMap(requestTask.getProperties)
+ logger.info(s"Received job with id ${jobId}.")
val task = new CommonEngineConnTask(String.valueOf(taskId), retryAble)
task.setCode(requestTask.getCode)
task.setProperties(requestTask.getProperties)
diff --git a/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/job/EntranceExecutionJob.java b/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/job/EntranceExecutionJob.java
index 6e0f70c64..3133f6280 100644
--- a/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/job/EntranceExecutionJob.java
+++ b/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/job/EntranceExecutionJob.java
@@ -25,6 +25,7 @@ import org.apache.linkis.entrance.execute.EntranceJob;
import org.apache.linkis.entrance.log.*;
import org.apache.linkis.entrance.persistence.PersistenceManager;
import org.apache.linkis.governance.common.conf.GovernanceCommonConf;
+import org.apache.linkis.governance.common.constant.job.JobRequestConstants;
import org.apache.linkis.governance.common.entity.job.SubJobDetail;
import org.apache.linkis.governance.common.entity.job.SubJobInfo;
import org.apache.linkis.governance.common.protocol.task.RequestTask$;
@@ -169,6 +170,12 @@ public class EntranceExecutionJob extends EntranceJob implements LogHandler {
// add resultSet path root
Map<String, String> starupMapTmp = new HashMap<String, String>();
Map<String, Object> starupMapOri = TaskUtils.getStartupMap(getParams());
+ if (starupMapOri.isEmpty()) {
+ TaskUtils.addStartupMap(getParams(), starupMapOri);
+ }
+ if (!starupMapOri.containsKey(JobRequestConstants.JOB_REQUEST_LIST())) {
+ starupMapOri.put(JobRequestConstants.JOB_ID(), String.valueOf(getJobRequest().getId()));
+ }
for (Map.Entry<String, Object> entry : starupMapOri.entrySet()) {
if (null != entry.getKey() && null != entry.getValue()) {
starupMapTmp.put(entry.getKey(), entry.getValue().toString());
@@ -179,6 +186,10 @@ public class EntranceExecutionJob extends EntranceJob implements LogHandler {
TaskUtils.addRuntimeMap(getParams(), new HashMap<>());
runtimeMapOri = TaskUtils.getRuntimeMap(getParams());
}
+ if (!runtimeMapOri.containsKey(JobRequestConstants.JOB_ID())) {
+ runtimeMapOri.put(
+ JobRequestConstants.JOB_ID(), String.valueOf(getJobRequest().getId()));
+ }
Map<String, String> runtimeMapTmp = new HashMap<>();
for (Map.Entry<String, Object> entry : runtimeMapOri.entrySet()) {
if (null != entry.getKey() && null != entry.getValue()) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org