Browse Source

Merge branch 'dev' into issue/1463

pull/2/head
kezhenxu94 4 years ago committed by GitHub
parent
commit
9d1d04106e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 1
      docker/docker-compose.yml
  3. 32
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
  4. 14
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/ZooKeeperState.java
  5. 6
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/ZookeeperMonitor.java
  6. 18
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ZookeeperRecord.java

2
README.md

@ -99,9 +99,9 @@ It is because of the shoulders of these open source projects that the birth of t
### Get Help ### Get Help
1. Submit an issue 1. Submit an issue
1. Subscribe the mail list : https://dolphinscheduler.apache.org/en-us/docs/development/subscribe.html. then send mail to dev@dolphinscheduler.apache.org 1. Subscribe the mail list : https://dolphinscheduler.apache.org/en-us/docs/development/subscribe.html. then send mail to dev@dolphinscheduler.apache.org
1. Slack channel: [![Slack Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social)](https://join.slack.com/share/zt-do3gvfhj-UUhrAX2GxkVX_~JJt1jpKA)
1. Contact WeChat(dailidong66). This is just for Mandarin(CN) discussion. 1. Contact WeChat(dailidong66). This is just for Mandarin(CN) discussion.
### License ### License
Please refer to [LICENSE](https://github.com/apache/incubator-dolphinscheduler/blob/dev/LICENSE) file. Please refer to [LICENSE](https://github.com/apache/incubator-dolphinscheduler/blob/dev/LICENSE) file.

1
docker/docker-compose.yml

@ -23,6 +23,7 @@ services:
- "2181:2181" - "2181:2181"
environment: environment:
ZOO_MY_ID: 1 ZOO_MY_ID: 1
ZOO_4LW_COMMANDS_WHITELIST: srvr,ruok,wchs,cons
db: db:
image: postgres image: postgres
container_name: postgres container_name: postgres

32
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java

@ -124,14 +124,12 @@ public class ExecutorService extends BaseService{
return result; return result;
} }
// check master server exists // check master exists
List<Server> masterServers = monitorService.getServerListFromZK(true); if (!checkMasterExists(result)) {
if (masterServers.size() == 0) {
putMsg(result, Status.MASTER_NOT_EXISTS);
return result; return result;
} }
/** /**
* create command * create command
*/ */
@ -152,6 +150,22 @@ public class ExecutorService extends BaseService{
return result; return result;
} }
/**
* check whether master exists
* @param result result
* @return master exists return true , otherwise return false
*/
private boolean checkMasterExists(Map<String, Object> result) {
// check master server exists
List<Server> masterServers = monitorService.getServerListFromZK(true);
// no master
if (masterServers.size() == 0) {
putMsg(result, Status.MASTER_NOT_EXISTS);
return false;
}
return true;
}
/** /**
@ -195,6 +209,12 @@ public class ExecutorService extends BaseService{
return checkResult; return checkResult;
} }
// check master exists
if (!checkMasterExists(result)) {
return result;
}
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId); ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId);
if (processInstance == null) { if (processInstance == null) {
putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId); putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId);

14
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/ZooKeeperState.java

@ -33,7 +33,7 @@ public class ZooKeeperState {
private final String host; private final String host;
private final int port; private final int port;
private int minLatency = -1, avgLatency = -1, maxLatency = -1; private float minLatency = -1, avgLatency = -1, maxLatency = -1;
private long received = -1; private long received = -1;
private long sent = -1; private long sent = -1;
private int outStanding = -1; private int outStanding = -1;
@ -60,9 +60,9 @@ public class ZooKeeperState {
String line = scannerForStat.nextLine(); String line = scannerForStat.nextLine();
if (line.startsWith("Latency min/avg/max:")) { if (line.startsWith("Latency min/avg/max:")) {
String[] latencys = getStringValueFromLine(line).split("/"); String[] latencys = getStringValueFromLine(line).split("/");
minLatency = Integer.parseInt(latencys[0]); minLatency = Float.parseFloat(latencys[0]);
avgLatency = Integer.parseInt(latencys[1]); avgLatency = Float.parseFloat(latencys[1]);
maxLatency = Integer.parseInt(latencys[2]); maxLatency = Float.parseFloat(latencys[2]);
} else if (line.startsWith("Received:")) { } else if (line.startsWith("Received:")) {
received = Long.parseLong(getStringValueFromLine(line)); received = Long.parseLong(getStringValueFromLine(line));
} else if (line.startsWith("Sent:")) { } else if (line.startsWith("Sent:")) {
@ -165,15 +165,15 @@ public class ZooKeeperState {
return port; return port;
} }
public int getMinLatency() { public float getMinLatency() {
return minLatency; return minLatency;
} }
public int getAvgLatency() { public float getAvgLatency() {
return avgLatency; return avgLatency;
} }
public int getMaxLatency() { public float getMaxLatency() {
return maxLatency; return maxLatency;
} }

6
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/ZookeeperMonitor.java

@ -88,9 +88,9 @@ public class ZookeeperMonitor extends AbstractZKClient {
long sent = state.getSent(); long sent = state.getSent();
long received = state.getReceived(); long received = state.getReceived();
String mode = state.getMode(); String mode = state.getMode();
int minLatency = state.getMinLatency(); float minLatency = state.getMinLatency();
int avgLatency = state.getAvgLatency(); float avgLatency = state.getAvgLatency();
int maxLatency = state.getMaxLatency(); float maxLatency = state.getMaxLatency();
int nodeCount = state.getNodeCount(); int nodeCount = state.getNodeCount();
int status = ok ? 1 : 0; int status = ok ? 1 : 0;
Date date = new Date(); Date date = new Date();

18
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ZookeeperRecord.java

@ -56,17 +56,17 @@ public class ZookeeperRecord {
/** /**
* min Latency * min Latency
*/ */
private int minLatency; private float minLatency;
/** /**
* avg Latency * avg Latency
*/ */
private int avgLatency; private float avgLatency;
/** /**
* max Latency * max Latency
*/ */
private int maxLatency; private float maxLatency;
/** /**
* node count * node count
@ -85,7 +85,7 @@ public class ZookeeperRecord {
private int state; private int state;
public ZookeeperRecord(String hostname,int connections, int watches, long sent, long received, String mode, int minLatency, int avgLatency, int maxLatency, int nodeCount, int state,Date date) { public ZookeeperRecord(String hostname,int connections, int watches, long sent, long received, String mode, float minLatency, float avgLatency, float maxLatency, int nodeCount, int state,Date date) {
this.hostname = hostname; this.hostname = hostname;
this.connections = connections; this.connections = connections;
this.watches = watches; this.watches = watches;
@ -149,23 +149,23 @@ public class ZookeeperRecord {
this.mode = mode; this.mode = mode;
} }
public int getMinLatency() { public float getMinLatency() {
return minLatency; return minLatency;
} }
public void setMinLatency(int minLatency) { public void setMinLatency(float minLatency) {
this.minLatency = minLatency; this.minLatency = minLatency;
} }
public int getAvgLatency() { public float getAvgLatency() {
return avgLatency; return avgLatency;
} }
public void setAvgLatency(int avgLatency) { public void setAvgLatency(float avgLatency) {
this.avgLatency = avgLatency; this.avgLatency = avgLatency;
} }
public int getMaxLatency() { public float getMaxLatency() {
return maxLatency; return maxLatency;
} }

Loading…
Cancel
Save