Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new LinkisManager Common module to collect all commonly used interfaces in LinkisManager. #617

Merged
merged 2 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2019 WeBank
~
~ Licensed 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>linkis</artifactId>
<groupId>com.webank.wedatasphere.linkis</groupId>
<version>dev-1.0.0</version>
<!-- <relativePath>../../pom.xml</relativePath>-->
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>linkis-manager-common</artifactId>

<dependencies>

<dependency>
<groupId>com.webank.wedatasphere.linkis</groupId>
<artifactId>linkis-computation-governance-common</artifactId>
<version>${linkis.version}</version>
</dependency>

<dependency>
<groupId>com.webank.wedatasphere.linkis</groupId>
<artifactId>linkis-common</artifactId>
<version>${linkis.version}</version>
</dependency>

<dependency>
<groupId>com.webank.wedatasphere.linkis</groupId>
<artifactId>linkis-label-common</artifactId>
<version>${linkis.version}</version>
</dependency>

<dependency>
<groupId>com.webank.wedatasphere.linkis</groupId>
<artifactId>linkis-protocol</artifactId>
<version>${linkis.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.json4s</groupId>
<artifactId>json4s-jackson_${scala.binary.version}</artifactId>
<version>${json4s.version}</version>
<exclusions>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>


</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
</plugin>

<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<!--<excludes>-->
<!--<exclude>**/*.yml</exclude>-->
<!--<exclude>**/*.properties</exclude>-->
<!--<exclude>**/*.sh</exclude>-->
<!--</excludes>-->
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
<finalName>${project.artifactId}-${project.version}</finalName>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2019 WeBank
*
* Licensed 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 com.webank.wedatasphere.linkis.manager.common.constant;

public class AMConstant {

public static final String EM_NAME = "engineManager";

public static final String ENGINE_NAME = "engine";

public static final int ENGINE_ERROR_CODE = 30001;

public static final int EM_ERROR_CODE = 30002;

public static final String PROCESS_MARK = "process";

public static final String THREAD_MARK = "thread";

public static final String START_REASON = "start_reason";

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2019 WeBank
*
* Licensed 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 com.webank.wedatasphere.linkis.manager.common.entity.enumeration;


public enum NodeHealthy {

/**
* 节点监控状态信息
* Healthy:状态正常
* UnHealthy: EM自己标识自己为UnHealthy 或者 manager把他标识为UnHealthy 处理引擎状态不正常,manager主动要求所有的engine强制退出(engine自杀)
* WARN: 引擎处于告警状态,但是可以接受任务
* StockAvailable: 存量可用状态,可以接受任务。当EM状态最近n次心跳没有上报,但是已经启动的Engine还是正常的可以接受任务
* StockUnavailable: 存量不可用状态,不可以接受任务。(超过n+1没上报心跳)或者(EM自己判断,但是服务正常的情况),但是如果往上面提交任务会出现error失败情况
* EM 处于StockUnavailable时,manager主动要求所有的engine非强制退出,manager需要将 EM标识为UnHealthy。如果StockUnavailable状态如果超过n分钟,则发送IMS告警
*/
Healthy, UnHealthy, WARN, StockAvailable, StockUnavailable;

public static Boolean isAvailable(NodeHealthy nodeHealthy) {
if (Healthy == nodeHealthy || WARN == nodeHealthy || StockAvailable == nodeHealthy) {
return true;
}
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Copyright 2019 WeBank
*
* Licensed 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 com.webank.wedatasphere.linkis.manager.common.entity.enumeration;


public enum NodeStatus {

/**
* em 中管理的engineConn状态: Starting running Failed, Success
* <p>
* manager中管理的engineConn状态:Starting ShuttingDown Unlock Idle Busy
*/
Starting, ShuttingDown, Failed, Success,
Idle, Busy,
Locked, Unlock,
Running;

public static Boolean isAvailable(NodeStatus status) {
if (Idle == status || Busy == status || Locked == status || Unlock == status || Running == status) {
return true;
}
return false;
}

public static Boolean isLocked(NodeStatus status) {
if (Busy == status || Locked == status || Idle == status) {
return true;
}
return false;
}

public static Boolean isIdle(NodeStatus status) {
if (Idle == status || Unlock == status) {
return true;
}
return false;
}

public static Boolean isCompleted(NodeStatus status) {
if (Success == status || Failed == status || ShuttingDown == status) {
return true;
}
return false;
}

public static NodeStatus toNodeStatus(String status) throws IllegalArgumentException {
if (null == status || "".equals(status)) {
throw new IllegalArgumentException("Invalid status : " + status + " cannot be matched in NodeStatus");
}
switch (status) {
case "Starting": return NodeStatus.Starting;
case "ShuttingDown": return NodeStatus.ShuttingDown;
case "Failed": return NodeStatus.Failed;
case "Success": return NodeStatus.Success;
case "Idle": return NodeStatus.Idle;
case "Busy": return NodeStatus.Busy;
case "Locked": return NodeStatus.Locked;
case "Unlock": return NodeStatus.Unlock;
case "Running": return NodeStatus.Running;
default:
throw new IllegalArgumentException("Invalid status : " + status + " in all values in NodeStatus");
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2019 WeBank
*
* Licensed 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 com.webank.wedatasphere.linkis.manager.common.entity.label;


public class LabelKeyValue {

private String key;

private String value;

public LabelKeyValue() {

}

public LabelKeyValue(String key, String value) {
this.key = key;
this.value = value;
}

public String getKey() {
return key;
}

public void setKey(String key) {
this.key = key;
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}
}
Loading