From e676775177be109db91785ad5e1ad86cfeb615ee Mon Sep 17 00:00:00 2001 From: ChengJie1053 <18033291053@163.com> Date: Fri, 11 Aug 2023 11:24:08 +0800 Subject: [PATCH] spark support yarn cluster --- .../am/manager/DefaultEngineNodeManager.java | 2 +- .../engine/DefaultEngineCreateService.java | 4 +++ .../persistence/NodeManagerPersistence.java | 2 +- .../impl/DefaultNodeManagerPersistence.java | 26 ++++++------------- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/manager/DefaultEngineNodeManager.java b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/manager/DefaultEngineNodeManager.java index 5d3fc70998..14d548ef77 100644 --- a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/manager/DefaultEngineNodeManager.java +++ b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/manager/DefaultEngineNodeManager.java @@ -129,7 +129,7 @@ public EngineNode getEngineNodeInfoByDB(EngineNode engineNode) { @Override public EngineNode getEngineNodeInfoByTicketId(String ticketId) { - EngineNode dbEngineNode = nodeManagerPersistence.getEngineNode(ticketId); + EngineNode dbEngineNode = nodeManagerPersistence.getEngineNodeByTicketId(ticketId); if (null == dbEngineNode) { throw new LinkisRetryException(AMConstant.ENGINE_ERROR_CODE, ticketId + " not exists in db"); } diff --git a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/service/engine/DefaultEngineCreateService.java b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/service/engine/DefaultEngineCreateService.java index e3fd01e2a1..6f35edc3a9 100644 --- a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/service/engine/DefaultEngineCreateService.java +++ b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/service/engine/DefaultEngineCreateService.java @@ -347,6 +347,10 @@ private boolean ensuresIdle(EngineNode engineNode, String resourceTicketId) { return false; } + if (engineNodeInfo.getServiceInstance() != null) { + engineNode.setServiceInstance(engineNodeInfo.getServiceInstance()); + } + if (NodeStatus.isCompleted(engineNodeInfo.getNodeStatus())) { NodeMetrics metrics = nodeMetricManagerPersistence.getNodeMetrics(engineNodeInfo); Pair> errorInfo = getStartErrorInfo(metrics.getHeartBeatMsg()); diff --git a/linkis-computation-governance/linkis-manager/linkis-manager-persistence/src/main/java/org/apache/linkis/manager/persistence/NodeManagerPersistence.java b/linkis-computation-governance/linkis-manager/linkis-manager-persistence/src/main/java/org/apache/linkis/manager/persistence/NodeManagerPersistence.java index e9fcab7017..b83c82fd30 100644 --- a/linkis-computation-governance/linkis-manager/linkis-manager-persistence/src/main/java/org/apache/linkis/manager/persistence/NodeManagerPersistence.java +++ b/linkis-computation-governance/linkis-manager/linkis-manager-persistence/src/main/java/org/apache/linkis/manager/persistence/NodeManagerPersistence.java @@ -105,7 +105,7 @@ void updateEngineNode(ServiceInstance serviceInstance, Node node) */ EngineNode getEngineNode(ServiceInstance serviceInstance); - EngineNode getEngineNode(String ticketId); + EngineNode getEngineNodeByTicketId(String ticketId); /** * 通过Em的ServiceInstance 获取EM下面Engine的列表 diff --git a/linkis-computation-governance/linkis-manager/linkis-manager-persistence/src/main/java/org/apache/linkis/manager/persistence/impl/DefaultNodeManagerPersistence.java b/linkis-computation-governance/linkis-manager/linkis-manager-persistence/src/main/java/org/apache/linkis/manager/persistence/impl/DefaultNodeManagerPersistence.java index 805f127ac8..14db7252fa 100644 --- a/linkis-computation-governance/linkis-manager/linkis-manager-persistence/src/main/java/org/apache/linkis/manager/persistence/impl/DefaultNodeManagerPersistence.java +++ b/linkis-computation-governance/linkis-manager/linkis-manager-persistence/src/main/java/org/apache/linkis/manager/persistence/impl/DefaultNodeManagerPersistence.java @@ -275,34 +275,24 @@ public EngineNode getEngineNode(ServiceInstance serviceInstance) { } @Override - public EngineNode getEngineNode(String ticketId) { + public EngineNode getEngineNodeByTicketId(String ticketId) { AMEngineNode amEngineNode = new AMEngineNode(); - // amEngineNode.setServiceInstance(serviceInstance); PersistenceNode engineNode = nodeManagerMapper.getNodeInstanceByTicketId(ticketId); + if (null == engineNode) { return null; } + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setInstance(engineNode.getInstance()); + serviceInstance.setApplicationName(engineNode.getName()); + amEngineNode.setServiceInstance(serviceInstance); + amEngineNode.setOwner(engineNode.getOwner()); amEngineNode.setMark(engineNode.getMark()); amEngineNode.setIdentifier(engineNode.getIdentifier()); amEngineNode.setTicketId(engineNode.getTicketId()); amEngineNode.setStartTime(engineNode.getCreateTime()); - // PersistenceNode emNode = - // - // nodeManagerMapper.getEMNodeInstanceByEngineNode(serviceInstance.getInstance()); - // if (emNode != null) { - // String emInstance = emNode.getInstance(); - // String emName = emNode.getName(); - // ServiceInstance emServiceInstance = new ServiceInstance(); - // emServiceInstance.setApplicationName(emName); - // emServiceInstance.setInstance(emInstance); - // AMEMNode amemNode = new AMEMNode(); - // amemNode.setMark(emNode.getMark()); - // amemNode.setOwner(emNode.getOwner()); - // amemNode.setServiceInstance(emServiceInstance); - // amemNode.setStartTime(emNode.getCreateTime()); - // amEngineNode.setEMNode(amemNode); - // } return amEngineNode; }