break60 5 years ago
parent
commit
1964d47bdb
  1. 14
      .github/workflows/ci_e2e.yml
  2. 7
      .github/workflows/ci_ut.yml
  3. 10
      dockerfile/hooks/check
  4. 6
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
  5. 3
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java
  6. 2
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.java
  7. 4
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java

14
.github/workflows/ci_e2e.yml

@ -49,7 +49,8 @@ jobs:
- name: Docker Run - name: Docker Run
run: | run: |
VERSION=`cat $(pwd)/pom.xml| grep "SNAPSHOT</version>" | awk -F "-SNAPSHOT" '{print $1}' | awk -F ">" '{print $2}'` VERSION=`cat $(pwd)/pom.xml| grep "SNAPSHOT</version>" | awk -F "-SNAPSHOT" '{print $1}' | awk -F ">" '{print $2}'`
docker run -dit -e POSTGRESQL_USERNAME=test -e POSTGRESQL_PASSWORD=test -p 8888:8888 dolphinscheduler:$VERSION all mkdir -p /tmp/logs
docker run -dit -e POSTGRESQL_USERNAME=test -e POSTGRESQL_PASSWORD=test -v /tmp/logs:/opt/dolphinscheduler/logs -p 8888:8888 dolphinscheduler:$VERSION all
- name: Check Server Status - name: Check Server Status
run: sh ./dockerfile/hooks/check run: sh ./dockerfile/hooks/check
- name: Prepare e2e env - name: Prepare e2e env
@ -65,7 +66,10 @@ jobs:
- name: Run e2e Test - name: Run e2e Test
run: cd ./e2e && mvn -B clean test run: cd ./e2e && mvn -B clean test
- name: Collect logs - name: Collect logs
run: | if: failure()
mkdir -p ${LOG_DIR} uses: actions/upload-artifact@v1
docker logs dolphinscheduler > ${LOG_DIR}/dolphinscheduler.txt with:
continue-on-error: true name: dslogs
path: /tmp/logs

7
.github/workflows/ci_ut.yml

@ -15,7 +15,11 @@
# limitations under the License. # limitations under the License.
# #
on: ["pull_request", "push"] on:
pull_request:
push:
branches:
- dev
env: env:
DOCKER_DIR: ./docker DOCKER_DIR: ./docker
LOG_DIR: /tmp/dolphinscheduler LOG_DIR: /tmp/dolphinscheduler
@ -58,7 +62,6 @@ jobs:
export MAVEN_OPTS='-Dmaven.repo.local=.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx3g' export MAVEN_OPTS='-Dmaven.repo.local=.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx3g'
mvn test -B -Dmaven.test.skip=false mvn test -B -Dmaven.test.skip=false
- name: Upload coverage report to codecov - name: Upload coverage report to codecov
if: github.event_name == 'pull_request'
run: | run: |
CODECOV_TOKEN="09c2663f-b091-4258-8a47-c981827eb29a" bash <(curl -s https://codecov.io/bash) CODECOV_TOKEN="09c2663f-b091-4258-8a47-c981827eb29a" bash <(curl -s https://codecov.io/bash)
- name: Run SonarCloud Analysis - name: Run SonarCloud Analysis

10
dockerfile/hooks/check

@ -16,7 +16,7 @@
# limitations under the License. # limitations under the License.
# #
echo "------ dolphinscheduler check - server - status -------" echo "------ dolphinscheduler check - server - status -------"
sleep 20 sleep 60
server_num=$(docker top `docker container list | grep '/sbin/tini' | awk '{print $1}'`| grep java | grep "dolphinscheduler" | awk -F 'classpath ' '{print $2}' | awk '{print $2}' | sort | uniq -c | wc -l) server_num=$(docker top `docker container list | grep '/sbin/tini' | awk '{print $1}'`| grep java | grep "dolphinscheduler" | awk -F 'classpath ' '{print $2}' | awk '{print $2}' | sort | uniq -c | wc -l)
if [ $server_num -eq 5 ] if [ $server_num -eq 5 ]
then then
@ -25,3 +25,11 @@ else
echo "Server start failed "$server_num echo "Server start failed "$server_num
exit 1 exit 1
fi fi
ready=`curl http://127.0.0.1:8888/dolphinscheduler/login -d 'userName=admin&userPassword=dolphinscheduler123' -v | grep "login success" | wc -l`
if [ $ready -eq 1 ]
then
echo "Servers is ready"
else
echo "Servers is not ready"
exit 1
fi

6
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java

@ -425,13 +425,13 @@ public class OSUtils {
* @return check memory and cpu usage * @return check memory and cpu usage
*/ */
public static Boolean checkResource(double systemCpuLoad, double systemReservedMemory){ public static Boolean checkResource(double systemCpuLoad, double systemReservedMemory){
// judging usage // system load average
double loadAverage = OSUtils.loadAverage(); double loadAverage = OSUtils.loadAverage();
// // system available physical memory
double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize(); double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize();
if(loadAverage > systemCpuLoad || availablePhysicalMemorySize < systemReservedMemory){ if(loadAverage > systemCpuLoad || availablePhysicalMemorySize < systemReservedMemory){
logger.warn("load or availablePhysicalMemorySize(G) is too high, it's availablePhysicalMemorySize(G):{},loadAvg:{}", availablePhysicalMemorySize , loadAverage); logger.warn("load is too high or availablePhysicalMemorySize(G) is too low, it's availablePhysicalMemorySize(G):{},loadAvg:{}", availablePhysicalMemorySize , loadAverage);
return false; return false;
}else{ }else{
return true; return true;

3
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/process/ProcessImplForWin32.java

@ -32,6 +32,7 @@ import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static com.sun.jna.platform.win32.WinBase.INVALID_HANDLE_VALUE;
import static com.sun.jna.platform.win32.WinBase.STILL_ACTIVE; import static com.sun.jna.platform.win32.WinBase.STILL_ACTIVE;
import static java.util.Objects.requireNonNull; import static java.util.Objects.requireNonNull;
@ -742,8 +743,10 @@ public class ProcessImplForWin32 extends Process {
} }
private static void closeHandle(WinNT.HANDLE handle) { private static void closeHandle(WinNT.HANDLE handle) {
if (!handle.equals(INVALID_HANDLE_VALUE)) {
Kernel32Util.closeHandle(handle); Kernel32Util.closeHandle(handle);
} }
}
/** /**
* Opens a file for atomic append. The file is created if it doesn't * Opens a file for atomic append. The file is created if it doesn't

2
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.java

@ -34,7 +34,7 @@ public class WorkerConfig {
@Value("${worker.max.cpuload.avg}") @Value("${worker.max.cpuload.avg}")
private int workerMaxCpuloadAvg; private int workerMaxCpuloadAvg;
@Value("${master.reserved.memory}") @Value("${worker.reserved.memory}")
private double workerReservedMemory; private double workerReservedMemory;
public int getWorkerExecThreads() { public int getWorkerExecThreads() {

4
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java

@ -363,7 +363,8 @@ public class SqlTask extends AbstractTask {
// is the timeout set // is the timeout set
boolean timeoutFlag = taskProps.getTaskTimeoutStrategy() == TaskTimeoutStrategy.FAILED || boolean timeoutFlag = taskProps.getTaskTimeoutStrategy() == TaskTimeoutStrategy.FAILED ||
taskProps.getTaskTimeoutStrategy() == TaskTimeoutStrategy.WARNFAILED; taskProps.getTaskTimeoutStrategy() == TaskTimeoutStrategy.WARNFAILED;
try (PreparedStatement stmt = connection.prepareStatement(sqlBinds.getSql())) { // prepare statement
PreparedStatement stmt = connection.prepareStatement(sqlBinds.getSql());
if(timeoutFlag){ if(timeoutFlag){
stmt.setQueryTimeout(taskProps.getTaskTimeout()); stmt.setQueryTimeout(taskProps.getTaskTimeout());
} }
@ -377,7 +378,6 @@ public class SqlTask extends AbstractTask {
logger.info("prepare statement replace sql : {} ", stmt); logger.info("prepare statement replace sql : {} ", stmt);
return stmt; return stmt;
} }
}
/** /**
* send mail as an attachment * send mail as an attachment

Loading…
Cancel
Save