status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
369
body
stringlengths
0
254k
issue_url
stringlengths
37
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
unknown
language
stringclasses
5 values
commit_datetime
unknown
updated_file
stringlengths
4
188
file_content
stringlengths
0
5.12M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,886
[Bug][Docker] Cannot create container for service dolphinscheduler-worker: invalid volume specification in Windows
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Run `docker-compose` on Windows 2. See error: `Cannot create container for service dolphinscheduler-worker: invalid volume specification` **Expected behavior** Bug fixed. **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/4902714/109300088-0e362880-7871-11eb-9132-f716462a26eb.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4886
https://github.com/apache/dolphinscheduler/pull/4887
a75793d875a9a7c3394dc8768c014e1d4efa6e7f
b8788f007b1617605e05d70c0ff33c4aa7318c4b
"2021-02-26T12:27:50Z"
java
"2021-02-27T01:45:23Z"
docker/docker-swarm/docker-stack.yml
# 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. version: "3.4" services: dolphinscheduler-postgresql: image: bitnami/postgresql:latest ports: - 5432:5432 environment: TZ: Asia/Shanghai POSTGRESQL_USERNAME: root POSTGRESQL_PASSWORD: root POSTGRESQL_DATABASE: dolphinscheduler volumes: - dolphinscheduler-postgresql:/bitnami/postgresql networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-zookeeper: image: bitnami/zookeeper:latest ports: - 2181:2181 environment: TZ: Asia/Shanghai ALLOW_ANONYMOUS_LOGIN: "yes" ZOO_4LW_COMMANDS_WHITELIST: srvr,ruok,wchs,cons volumes: - dolphinscheduler-zookeeper:/bitnami/zookeeper networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-api: image: apache/dolphinscheduler:latest command: api-server ports: - 12345:12345 environment: TZ: Asia/Shanghai DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 RESOURCE_STORAGE_TYPE: HDFS RESOURCE_UPLOAD_PATH: /dolphinscheduler FS_DEFAULT_FS: file:/// healthcheck: test: ["CMD", "/root/checkpoint.sh", "ApiApplicationServer"] interval: 30s timeout: 5s retries: 3 start_period: 30s volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-alert: image: apache/dolphinscheduler:latest command: alert-server ports: - 50052:50052 environment: TZ: Asia/Shanghai ALERT_PLUGIN_DIR: lib/plugin/alert DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler healthcheck: test: ["CMD", "/root/checkpoint.sh", "AlertServer"] interval: 30s timeout: 5s retries: 3 start_period: 30s volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-master: image: apache/dolphinscheduler:latest command: master-server ports: - 5678:5678 environment: TZ: Asia/Shanghai MASTER_EXEC_THREADS: "100" MASTER_EXEC_TASK_NUM: "20" MASTER_HEARTBEAT_INTERVAL: "10" MASTER_TASK_COMMIT_RETRYTIMES: "5" MASTER_TASK_COMMIT_INTERVAL: "1000" MASTER_MAX_CPULOAD_AVG: "100" MASTER_RESERVED_MEMORY: "0.1" DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 healthcheck: test: ["CMD", "/root/checkpoint.sh", "MasterServer"] interval: 30s timeout: 5s retries: 3 start_period: 30s volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-worker: image: apache/dolphinscheduler:latest command: worker-server ports: - 1234:1234 - 50051:50051 environment: TZ: Asia/Shanghai WORKER_EXEC_THREADS: "100" WORKER_HEARTBEAT_INTERVAL: "10" WORKER_MAX_CPULOAD_AVG: "100" WORKER_RESERVED_MEMORY: "0.1" WORKER_GROUPS: "default" WORKER_WEIGHT: "100" DOLPHINSCHEDULER_DATA_BASEDIR_PATH: /tmp/dolphinscheduler ALERT_LISTEN_HOST: dolphinscheduler-alert DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 RESOURCE_STORAGE_TYPE: HDFS RESOURCE_UPLOAD_PATH: /dolphinscheduler FS_DEFAULT_FS: file:/// healthcheck: test: ["CMD", "/root/checkpoint.sh", "WorkerServer"] interval: 30s timeout: 5s retries: 3 start_period: 30s configs: - source: dolphinscheduler-worker-task-env target: /opt/dolphinscheduler/conf/env/dolphinscheduler_env.sh volumes: - dolphinscheduler-worker-data:/tmp/dolphinscheduler - dolphinscheduler-logs:/opt/dolphinscheduler/logs networks: - dolphinscheduler deploy: mode: replicated replicas: 1 networks: dolphinscheduler: driver: overlay volumes: dolphinscheduler-postgresql: dolphinscheduler-zookeeper: dolphinscheduler-worker-data: dolphinscheduler-logs: configs: dolphinscheduler-worker-task-env: file: ./dolphinscheduler_env.sh
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,886
[Bug][Docker] Cannot create container for service dolphinscheduler-worker: invalid volume specification in Windows
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Run `docker-compose` on Windows 2. See error: `Cannot create container for service dolphinscheduler-worker: invalid volume specification` **Expected behavior** Bug fixed. **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/4902714/109300088-0e362880-7871-11eb-9132-f716462a26eb.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4886
https://github.com/apache/dolphinscheduler/pull/4887
a75793d875a9a7c3394dc8768c014e1d4efa6e7f
b8788f007b1617605e05d70c0ff33c4aa7318c4b
"2021-02-26T12:27:50Z"
java
"2021-02-27T01:45:23Z"
docker/docker-swarm/dolphinscheduler_env.sh
# # 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. # export HADOOP_HOME=/opt/soft/hadoop export HADOOP_CONF_DIR=/opt/soft/hadoop/etc/hadoop export SPARK_HOME1=/opt/soft/spark1 export SPARK_HOME2=/opt/soft/spark2 export PYTHON_HOME=/usr/bin/python export JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk export HIVE_HOME=/opt/soft/hive export FLINK_HOME=/opt/soft/flink export DATAX_HOME=/opt/soft/datax/bin/datax.py export PATH=$HADOOP_HOME/bin:$SPARK_HOME1/bin:$SPARK_HOME2/bin:$PYTHON_HOME:$JAVA_HOME/bin:$HIVE_HOME/bin:$PATH:$FLINK_HOME/bin:$DATAX_HOME:$PATH
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,893
[Improvement][READM.md] update the latest url for `QuickStart in Docker`
please update the following url ``` Please referer the official website document:[[QuickStart in Docker](https://dolphinscheduler.apache.org/en-us/docs/1.3.4/user_doc/docker-deployment.html)] ```` with new 1.3.5 version : https://dolphinscheduler.apache.org/en-us/docs/1.3.5/user_doc/docker-deployment.html
https://github.com/apache/dolphinscheduler/issues/4893
https://github.com/apache/dolphinscheduler/pull/4895
b8788f007b1617605e05d70c0ff33c4aa7318c4b
d170b92dc6ab5deda8ab88d5eede1e8d642ee158
"2021-02-27T01:36:39Z"
java
"2021-02-27T06:46:18Z"
README.md
Dolphin Scheduler Official Website [dolphinscheduler.apache.org](https://dolphinscheduler.apache.org) ============ [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) [![Total Lines](https://tokei.rs/b1/github/apache/Incubator-DolphinScheduler?category=lines)](https://github.com/apache/Incubator-DolphinScheduler) [![codecov](https://codecov.io/gh/apache/incubator-dolphinscheduler/branch/dev/graph/badge.svg)](https://codecov.io/gh/apache/incubator-dolphinscheduler/branch/dev) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apache-dolphinscheduler&metric=alert_status)](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler) [![Stargazers over time](https://starchart.cc/apache/incubator-dolphinscheduler.svg)](https://starchart.cc/apache/incubator-dolphinscheduler) [![EN doc](https://img.shields.io/badge/document-English-blue.svg)](README.md) [![CN doc](https://img.shields.io/badge/文档-中文版-blue.svg)](README_zh_CN.md) ### Design Features: DolphinScheduler is a distributed and extensible workflow scheduler platform with powerful DAG visual interfaces, dedicated to solving complex job dependencies in the data pipeline and providing various types of jobs available `out of the box`. Its main objectives are as follows: - Associate the tasks according to the dependencies of the tasks in a DAG graph, which can visualize the running state of the task in real-time. - Support various task types: Shell, MR, Spark, SQL (MySQL, PostgreSQL, hive, spark SQL), Python, Sub_Process, Procedure, etc. - Support scheduling of workflows and dependencies, manual scheduling to pause/stop/recover task, support failure task retry/alarm, recover specified nodes from failure, kill task, etc. - Support the priority of workflows & tasks, task failover, and task timeout alarm or failure. - Support workflow global parameters and node customized parameter settings. - Support online upload/download/management of resource files, etc. Support online file creation and editing. - Support task log online viewing and scrolling and downloading, etc. - Have implemented cluster HA, decentralize Master cluster and Worker cluster through Zookeeper. - Support the viewing of Master/Worker CPU load, memory, and CPU usage metrics. - Support displaying workflow history in tree/Gantt chart, as well as statistical analysis on the task status & process status in each workflow. - Support back-filling data. - Support multi-tenant. - Support internationalization. - More features waiting for partners to explore... ### What's in DolphinScheduler Stability | Accessibility | Features | Scalability | -- | -- | -- | -- Decentralized multi-master and multi-worker | Visualization of workflow key information, such as task status, task type, retry times, task operation machine information, visual variables, and so on at a glance.  |  Support pause, recover operation | Support customized task types support HA | Visualization of all workflow operations, dragging tasks to draw DAGs, configuring data sources and resources. At the same time, for third-party systems, provide API mode operations. | Users on DolphinScheduler can achieve many-to-one or one-to-one mapping relationship through tenants and Hadoop users, which is very important for scheduling large data jobs. | The scheduler supports distributed scheduling, and the overall scheduling capability will increase linearly with the scale of the cluster. Master and Worker support dynamic adjustment. Overload processing: By using the task queue mechanism, the number of schedulable tasks on a single machine can be flexibly configured. Machine jam can be avoided with high tolerance to numbers of tasks cached in task queue. | One-click deployment | Support traditional shell tasks, and big data platform task scheduling: MR, Spark, SQL (MySQL, PostgreSQL, hive, spark SQL), Python, Procedure, Sub_Process | | ### User Interface Screenshots ![home page](https://user-images.githubusercontent.com/15833811/75218288-bf286400-57d4-11ea-8263-d639c6511d5f.jpg) ![dag](https://user-images.githubusercontent.com/15833811/75236750-3374fe80-57f9-11ea-857d-62a66a5a559d.png) ![process definition list page](https://user-images.githubusercontent.com/15833811/75216886-6f479e00-57d0-11ea-92dd-66e7640a186f.png) ![view task log online](https://user-images.githubusercontent.com/15833811/75216924-9900c500-57d0-11ea-91dc-3522a76bdbbe.png) ![resource management](https://user-images.githubusercontent.com/15833811/75216984-be8dce80-57d0-11ea-840d-58546edc8788.png) ![monitor](https://user-images.githubusercontent.com/59273635/75625839-c698a480-5bfc-11ea-8bbe-895b561b337f.png) ![security](https://user-images.githubusercontent.com/15833811/75236441-bfd2f180-57f8-11ea-88bd-f24311e01b7e.png) ![treeview](https://user-images.githubusercontent.com/15833811/75217191-3fe56100-57d1-11ea-8856-f19180d9a879.png) ### QuickStart in Docker Please referer the official website document:[[QuickStart in Docker](https://dolphinscheduler.apache.org/en-us/docs/1.3.4/user_doc/docker-deployment.html)] ### How to Build ```bash ./mvnw clean install -Prelease ``` Artifact: ``` dolphinscheduler-dist/target/apache-dolphinscheduler-incubating-${latest.release.version}-dolphinscheduler-bin.tar.gz: Binary package of DolphinScheduler dolphinscheduler-dist/target/apache-dolphinscheduler-incubating-${latest.release.version}-src.zip: Source code package of DolphinScheduler ``` ### Thanks DolphinScheduler is based on a lot of excellent open-source projects, such as google guava, guice, grpc, netty, ali bonecp, quartz, and many open-source projects of Apache and so on. We would like to express our deep gratitude to all the open-source projects used in Dolphin Scheduler. We hope that we are not only the beneficiaries of open-source, but also give back to the community. Besides, we hope everyone who have the same enthusiasm and passion for open source could join in and contribute to the open-source community! ### Get Help 1. Submit an [[issue](https://github.com/apache/incubator-dolphinscheduler/issues/new/choose)] 1. Subscribe to this mail list: https://dolphinscheduler.apache.org/en-us/community/development/subscribe.html, then email dev@dolphinscheduler.apache.org ### Community You are so much welcomed to communicate with the developers and users of Dolphin Scheduler freely. There are two ways to find them: 1. Join the slack channel by [this invitation link](https://join.slack.com/t/asf-dolphinscheduler/shared_invite/zt-mzqu52gi-rCggPkSHQ0DZYkwbTxO1Gw). 2. Follow the [twitter account of Dolphin Scheduler](https://twitter.com/dolphinschedule) and get the latest news just on time. ### How to Contribute The community welcomes everyone to participate in contributing, please refer to this website to find out more: [[How to contribute](https://dolphinscheduler.apache.org/en-us/community/development/contribute.html)] ### License Please refer to the [LICENSE](https://github.com/apache/incubator-dolphinscheduler/blob/dev/LICENSE) file.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,584
[Feature] 建议k8s部署的时候默认数据库是MySQL,降低使用门槛
建议k8s部署的时候默认数据库是MySQL,降低使用门槛。 目前随着Tidb等NewSQL数据库的流行,NewSQL会成为技术中台的首选数据库,而Tidb作为一个非常火的项目是搭建技术中台的首选数据库,Tidb兼容MySQL协议而非pg协议,所以incubator-dolphinscheduler的数据直接建在Tidb上是非常合适的
https://github.com/apache/dolphinscheduler/issues/2584
https://github.com/apache/dolphinscheduler/pull/4875
139211f3ddf9e30fb058c659fd467b18a95d0dbe
bfc5d1e4ba08cc19059bb40293bb0777b3d42377
"2020-04-30T02:53:24Z"
java
"2021-02-27T14:44:55Z"
docker/build/README.md
## What is Dolphin Scheduler? Dolphin Scheduler is a distributed and easy-to-expand visual DAG workflow scheduling system, dedicated to solving the complex dependencies in data processing, making the scheduling system out of the box for data processing. GitHub URL: https://github.com/apache/incubator-dolphinscheduler Official Website: https://dolphinscheduler.apache.org ![Dolphin Scheduler](https://dolphinscheduler.apache.org/img/hlogo_colorful.svg) [![EN doc](https://img.shields.io/badge/document-English-blue.svg)](README.md) [![CN doc](https://img.shields.io/badge/文档-中文版-blue.svg)](README_zh_CN.md) ## How to use this docker image #### You can start a dolphinscheduler by docker-compose (recommended) ``` $ docker-compose -f ./docker/docker-swarm/docker-compose.yml up -d ``` The default **postgres** user `root`, postgres password `root` and database `dolphinscheduler` are created in the `docker-compose.yml`. The default **zookeeper** is created in the `docker-compose.yml`. Access the Web UI:http://192.168.xx.xx:12345/dolphinscheduler The default username is `admin` and the default password is `dolphinscheduler123` #### Or via Environment Variables **`DATABASE_HOST`** **`DATABASE_PORT`** **`DATABASE_DATABASE`** **`ZOOKEEPER_QUORUM`** You can specify **existing postgres and zookeeper service**. Example: ``` $ docker run -d --name dolphinscheduler \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ -p 12345:12345 \ apache/dolphinscheduler:latest all ``` Access the Web UI:http://192.168.xx.xx:12345/dolphinscheduler #### Or start a standalone dolphinscheduler server You can start a standalone dolphinscheduler server. * Create a **local volume** for resource storage, For example: ``` docker volume create dolphinscheduler-resource-local ``` * Start a **master server**, For example: ``` $ docker run -d --name dolphinscheduler-master \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ apache/dolphinscheduler:latest master-server ``` * Start a **worker server**, For example: ``` $ docker run -d --name dolphinscheduler-worker \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ -e ALERT_LISTEN_HOST="dolphinscheduler-alert" \ -v dolphinscheduler-resource-local:/dolphinscheduler \ apache/dolphinscheduler:latest worker-server ``` * Start a **api server**, For example: ``` $ docker run -d --name dolphinscheduler-api \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ -v dolphinscheduler-resource-local:/dolphinscheduler \ -p 12345:12345 \ apache/dolphinscheduler:latest api-server ``` * Start a **alert server**, For example: ``` $ docker run -d --name dolphinscheduler-alert \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ apache/dolphinscheduler:latest alert-server ``` **Note**: You must be specify `DATABASE_HOST` `DATABASE_PORT` `DATABASE_DATABASE` `DATABASE_USERNAME` `DATABASE_PASSWORD` `ZOOKEEPER_QUORUM` when start a standalone dolphinscheduler server. ## How to build a docker image You can build a docker image in A Unix-like operating system, You can also build it in Windows operating system. In Unix-Like, Example: ```bash $ cd path/incubator-dolphinscheduler $ sh ./docker/build/hooks/build ``` In Windows, Example: ```bat C:\incubator-dolphinscheduler>.\docker\build\hooks\build.bat ``` Please read `./docker/build/hooks/build` `./docker/build/hooks/build.bat` script files if you don't understand ## Environment Variables The Dolphin Scheduler image uses several environment variables which are easy to miss. While none of the variables are required, they may significantly aid you in using the image. **`DATABASE_TYPE`** This environment variable sets the type for database. The default value is `postgresql`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DATABASE_DRIVER`** This environment variable sets the type for database. The default value is `org.postgresql.Driver`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DATABASE_HOST`** This environment variable sets the host for database. The default value is `127.0.0.1`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DATABASE_PORT`** This environment variable sets the port for database. The default value is `5432`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DATABASE_USERNAME`** This environment variable sets the username for database. The default value is `root`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DATABASE_PASSWORD`** This environment variable sets the password for database. The default value is `root`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DATABASE_DATABASE`** This environment variable sets the database for database. The default value is `dolphinscheduler`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DATABASE_PARAMS`** This environment variable sets the database for database. The default value is `characterEncoding=utf8`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DOLPHINSCHEDULER_ENV_PATH`** This environment variable sets the runtime environment for task. The default value is `/opt/dolphinscheduler/conf/env/dolphinscheduler_env.sh`. **`DOLPHINSCHEDULER_DATA_BASEDIR_PATH`** User data directory path, self configuration, please make sure the directory exists and have read write permissions. The default value is `/tmp/dolphinscheduler` **`DOLPHINSCHEDULER_OPTS`** This environment variable sets java options. The default value is empty. **`RESOURCE_STORAGE_TYPE`** This environment variable sets resource storage type for dolphinscheduler like `HDFS`, `S3`, `NONE`. The default value is `HDFS`. **`RESOURCE_UPLOAD_PATH`** This environment variable sets resource store path on HDFS/S3 for resource storage. The default value is `/dolphinscheduler`. **`FS_DEFAULT_FS`** This environment variable sets fs.defaultFS for resource storage like `file:///`, `hdfs://mycluster:8020` or `s3a://dolphinscheduler`. The default value is `file:///`. **`FS_S3A_ENDPOINT`** This environment variable sets s3 endpoint for resource storage. The default value is `s3.xxx.amazonaws.com`. **`FS_S3A_ACCESS_KEY`** This environment variable sets s3 access key for resource storage. The default value is `xxxxxxx`. **`FS_S3A_SECRET_KEY`** This environment variable sets s3 secret key for resource storage. The default value is `xxxxxxx`. **`ZOOKEEPER_QUORUM`** This environment variable sets zookeeper quorum for `master-server` and `worker-serverr`. The default value is `127.0.0.1:2181`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`. **`ZOOKEEPER_ROOT`** This environment variable sets zookeeper root directory for dolphinscheduler. The default value is `/dolphinscheduler`. **`MASTER_EXEC_THREADS`** This environment variable sets exec thread num for `master-server`. The default value is `100`. **`MASTER_EXEC_TASK_NUM`** This environment variable sets exec task num for `master-server`. The default value is `20`. **`MASTER_HEARTBEAT_INTERVAL`** This environment variable sets heartbeat interval for `master-server`. The default value is `10`. **`MASTER_TASK_COMMIT_RETRYTIMES`** This environment variable sets task commit retry times for `master-server`. The default value is `5`. **`MASTER_TASK_COMMIT_INTERVAL`** This environment variable sets task commit interval for `master-server`. The default value is `1000`. **`MASTER_MAX_CPULOAD_AVG`** This environment variable sets max cpu load avg for `master-server`. The default value is `100`. **`MASTER_RESERVED_MEMORY`** This environment variable sets reserved memory for `master-server`. The default value is `0.1`. **`MASTER_LISTEN_PORT`** This environment variable sets port for `master-server`. The default value is `5678`. **`WORKER_EXEC_THREADS`** This environment variable sets exec thread num for `worker-server`. The default value is `100`. **`WORKER_HEARTBEAT_INTERVAL`** This environment variable sets heartbeat interval for `worker-server`. The default value is `10`. **`WORKER_MAX_CPULOAD_AVG`** This environment variable sets max cpu load avg for `worker-server`. The default value is `100`. **`WORKER_RESERVED_MEMORY`** This environment variable sets reserved memory for `worker-server`. The default value is `0.1`. **`WORKER_LISTEN_PORT`** This environment variable sets port for `worker-server`. The default value is `1234`. **`WORKER_GROUPS`** This environment variable sets group for `worker-server`. The default value is `default`. **`WORKER_WEIGHT`** This environment variable sets weight for `worker-server`. The default value is `100`. **`ALERT_LISTEN_HOST`** This environment variable sets the host of `alert-server` for `worker-server`. The default value is `127.0.0.1`. **`ALERT_PLUGIN_DIR`** This environment variable sets the alert plugin directory for `alert-server`. The default value is `lib/plugin/alert`. ## Initialization scripts If you would like to do additional initialization in an image derived from this one, add one or more environment variable under `/root/start-init-conf.sh`, and modify template files in `/opt/dolphinscheduler/conf/*.tpl`. For example, to add an environment variable `API_SERVER_PORT` in `/root/start-init-conf.sh`: ``` export API_SERVER_PORT=5555 ``` and to modify `/opt/dolphinscheduler/conf/application-api.properties.tpl` template file, add server port: ``` server.port=${API_SERVER_PORT} ``` `/root/start-init-conf.sh` will dynamically generate config file: ```sh echo "generate app config" ls ${DOLPHINSCHEDULER_HOME}/conf/ | grep ".tpl" | while read line; do eval "cat << EOF $(cat ${DOLPHINSCHEDULER_HOME}/conf/${line}) EOF " > ${DOLPHINSCHEDULER_HOME}/conf/${line%.*} done ```
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,584
[Feature] 建议k8s部署的时候默认数据库是MySQL,降低使用门槛
建议k8s部署的时候默认数据库是MySQL,降低使用门槛。 目前随着Tidb等NewSQL数据库的流行,NewSQL会成为技术中台的首选数据库,而Tidb作为一个非常火的项目是搭建技术中台的首选数据库,Tidb兼容MySQL协议而非pg协议,所以incubator-dolphinscheduler的数据直接建在Tidb上是非常合适的
https://github.com/apache/dolphinscheduler/issues/2584
https://github.com/apache/dolphinscheduler/pull/4875
139211f3ddf9e30fb058c659fd467b18a95d0dbe
bfc5d1e4ba08cc19059bb40293bb0777b3d42377
"2020-04-30T02:53:24Z"
java
"2021-02-27T14:44:55Z"
docker/build/README_zh_CN.md
## Dolphin Scheduler是什么? 一个分布式易扩展的可视化DAG工作流任务调度系统。致力于解决数据处理流程中错综复杂的依赖关系,使调度系统在数据处理流程中`开箱即用`。 GitHub URL: https://github.com/apache/incubator-dolphinscheduler Official Website: https://dolphinscheduler.apache.org ![Dolphin Scheduler](https://dolphinscheduler.apache.org/img/hlogo_colorful.svg) [![EN doc](https://img.shields.io/badge/document-English-blue.svg)](README.md) [![CN doc](https://img.shields.io/badge/文档-中文版-blue.svg)](README_zh_CN.md) ## 如何使用docker镜像 #### 以 docker-compose 的方式启动dolphinscheduler(推荐) ``` $ docker-compose -f ./docker/docker-swarm/docker-compose.yml up -d ``` 在`docker-compose.yml`文件中,默认的创建`Postgres`的用户、密码和数据库,默认值分别为:`root`、`root`、`dolphinscheduler`。 同时,默认的`Zookeeper`也会在`docker-compose.yml`文件中被创建。 访问前端界面:http://192.168.xx.xx:12345/dolphinscheduler #### 或者通过环境变量 **`DATABASE_HOST`** **`DATABASE_PORT`** **`ZOOKEEPER_QUORUM`** 使用已存在的服务 你可以指定已经存在的 **`Postgres`** 和 **`Zookeeper`** 服务. 如下: ``` $ docker run -d --name dolphinscheduler \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ -p 12345:12345 \ apache/dolphinscheduler:latest all ``` 访问前端界面:http://192.168.xx.xx:12345/dolphinscheduler #### 或者运行dolphinscheduler中的部分服务 你能够运行dolphinscheduler中的部分服务。 * 创建一个 **本地卷** 用于资源存储,如下: ``` docker volume create dolphinscheduler-resource-local ``` * 启动一个 **master server**, 如下: ``` $ docker run -d --name dolphinscheduler-master \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ apache/dolphinscheduler:latest master-server ``` * 启动一个 **worker server**, 如下: ``` $ docker run -d --name dolphinscheduler-worker \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ -e ALERT_LISTEN_HOST="dolphinscheduler-alert" \ -v dolphinscheduler-resource-local:/dolphinscheduler \ apache/dolphinscheduler:latest worker-server ``` * 启动一个 **api server**, 如下: ``` $ docker run -d --name dolphinscheduler-api \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ -v dolphinscheduler-resource-local:/dolphinscheduler \ -p 12345:12345 \ apache/dolphinscheduler:latest api-server ``` * 启动一个 **alert server**, 如下: ``` $ docker run -d --name dolphinscheduler-alert \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ apache/dolphinscheduler:latest alert-server ``` **注意**: 当你运行dolphinscheduler中的部分服务时,你必须指定这些环境变量 `DATABASE_HOST` `DATABASE_PORT` `DATABASE_DATABASE` `DATABASE_USERNAME` `DATABASE_PASSWORD` `ZOOKEEPER_QUORUM`。 ## 如何构建一个docker镜像 你能够在类Unix系统和Windows系统中构建一个docker镜像。 类Unix系统, 如下: ```bash $ cd path/incubator-dolphinscheduler $ sh ./docker/build/hooks/build ``` Windows系统, 如下: ```bat C:\incubator-dolphinscheduler>.\docker\build\hooks\build.bat ``` 如果你不理解这些脚本 `./docker/build/hooks/build` `./docker/build/hooks/build.bat`,请阅读里面的内容。 ## 环境变量 Dolphin Scheduler映像使用了几个容易遗漏的环境变量。虽然这些变量不是必须的,但是可以帮助你更容易配置镜像并根据你的需求定义相应的服务配置。 **`DATABASE_TYPE`** 配置`database`的`TYPE`, 默认值 `postgresql`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DATABASE_DRIVER`** 配置`database`的`DRIVER`, 默认值 `org.postgresql.Driver`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DATABASE_HOST`** 配置`database`的`HOST`, 默认值 `127.0.0.1`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DATABASE_PORT`** 配置`database`的`PORT`, 默认值 `5432`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DATABASE_USERNAME`** 配置`database`的`USERNAME`, 默认值 `root`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DATABASE_PASSWORD`** 配置`database`的`PASSWORD`, 默认值 `root`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DATABASE_DATABASE`** 配置`database`的`DATABASE`, 默认值 `dolphinscheduler`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DATABASE_PARAMS`** 配置`database`的`PARAMS`, 默认值 `characterEncoding=utf8`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DOLPHINSCHEDULER_ENV_PATH`** 任务执行时的环境变量配置文件, 默认值 `/opt/dolphinscheduler/conf/env/dolphinscheduler_env.sh`。 **`DOLPHINSCHEDULER_DATA_BASEDIR_PATH`** 用户数据目录, 用户自己配置, 请确保这个目录存在并且用户读写权限, 默认值 `/tmp/dolphinscheduler`。 **`DOLPHINSCHEDULER_OPTS`** 配置`dolphinscheduler`的`java options`,默认值 `""`、 **`RESOURCE_STORAGE_TYPE`** 配置`dolphinscheduler`的资源存储类型,可选项为 `HDFS`、`S3`、`NONE`,默认值 `HDFS`。 **`RESOURCE_UPLOAD_PATH`** 配置`HDFS/S3`上的资源存储路径,默认值 `/dolphinscheduler`。 **`FS_DEFAULT_FS`** 配置资源存储的文件系统协议,如 `file:///`, `hdfs://mycluster:8020` or `s3a://dolphinscheduler`,默认值 `file:///`。 **`FS_S3A_ENDPOINT`** 当`RESOURCE_STORAGE_TYPE=S3`时,需要配置`S3`的访问路径,默认值 `s3.xxx.amazonaws.com`。 **`FS_S3A_ACCESS_KEY`** 当`RESOURCE_STORAGE_TYPE=S3`时,需要配置`S3`的`s3 access key`,默认值 `xxxxxxx`。 **`FS_S3A_SECRET_KEY`** 当`RESOURCE_STORAGE_TYPE=S3`时,需要配置`S3`的`s3 secret key`,默认值 `xxxxxxx`。 **`ZOOKEEPER_QUORUM`** 配置`master-server`和`worker-serverr`的`Zookeeper`地址, 默认值 `127.0.0.1:2181`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`ZOOKEEPER_ROOT`** 配置`dolphinscheduler`在`zookeeper`中数据存储的根目录,默认值 `/dolphinscheduler`。 **`MASTER_EXEC_THREADS`** 配置`master-server`中的执行线程数量,默认值 `100`。 **`MASTER_EXEC_TASK_NUM`** 配置`master-server`中的执行任务数量,默认值 `20`。 **`MASTER_HEARTBEAT_INTERVAL`** 配置`master-server`中的心跳交互时间,默认值 `10`。 **`MASTER_TASK_COMMIT_RETRYTIMES`** 配置`master-server`中的任务提交重试次数,默认值 `5`。 **`MASTER_TASK_COMMIT_INTERVAL`** 配置`master-server`中的任务提交交互时间,默认值 `1000`。 **`MASTER_MAX_CPULOAD_AVG`** 配置`master-server`中的CPU中的`load average`值,默认值 `100`。 **`MASTER_RESERVED_MEMORY`** 配置`master-server`的保留内存,默认值 `0.1`。 **`MASTER_LISTEN_PORT`** 配置`master-server`的端口,默认值 `5678`。 **`WORKER_EXEC_THREADS`** 配置`worker-server`中的执行线程数量,默认值 `100`。 **`WORKER_HEARTBEAT_INTERVAL`** 配置`worker-server`中的心跳交互时间,默认值 `10`。 **`WORKER_MAX_CPULOAD_AVG`** 配置`worker-server`中的CPU中的最大`load average`值,默认值 `100`。 **`WORKER_RESERVED_MEMORY`** 配置`worker-server`的保留内存,默认值 `0.1`。 **`WORKER_LISTEN_PORT`** 配置`worker-server`的端口,默认值 `1234`。 **`WORKER_GROUPS`** 配置`worker-server`的分组,默认值 `default`。 **`WORKER_WEIGHT`** 配置`worker-server`的权重,默认之`100`。 **`ALERT_LISTEN_HOST`** 配置`worker-server`的告警主机,即`alert-server`的主机名,默认值 `127.0.0.1`。 **`ALERT_PLUGIN_DIR`** 配置`alert-server`的告警插件目录,默认值 `lib/plugin/alert`。 ## 初始化脚本 如果你想在编译的时候或者运行的时候附加一些其它的操作及新增一些环境变量,你可以在`/root/start-init-conf.sh`文件中进行修改,同时如果涉及到配置文件的修改,请在`/opt/dolphinscheduler/conf/*.tpl`中修改相应的配置文件 例如,在`/root/start-init-conf.sh`添加一个环境变量`API_SERVER_PORT`: ``` export API_SERVER_PORT=5555 ``` 当添加以上环境变量后,你应该在相应的模板文件`/opt/dolphinscheduler/conf/application-api.properties.tpl`中添加这个环境变量配置: ``` server.port=${API_SERVER_PORT} ``` `/root/start-init-conf.sh`将根据模板文件动态的生成配置文件: ```sh echo "generate app config" ls ${DOLPHINSCHEDULER_HOME}/conf/ | grep ".tpl" | while read line; do eval "cat << EOF $(cat ${DOLPHINSCHEDULER_HOME}/conf/${line}) EOF " > ${DOLPHINSCHEDULER_HOME}/conf/${line%.*} done ```
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,584
[Feature] 建议k8s部署的时候默认数据库是MySQL,降低使用门槛
建议k8s部署的时候默认数据库是MySQL,降低使用门槛。 目前随着Tidb等NewSQL数据库的流行,NewSQL会成为技术中台的首选数据库,而Tidb作为一个非常火的项目是搭建技术中台的首选数据库,Tidb兼容MySQL协议而非pg协议,所以incubator-dolphinscheduler的数据直接建在Tidb上是非常合适的
https://github.com/apache/dolphinscheduler/issues/2584
https://github.com/apache/dolphinscheduler/pull/4875
139211f3ddf9e30fb058c659fd467b18a95d0dbe
bfc5d1e4ba08cc19059bb40293bb0777b3d42377
"2020-04-30T02:53:24Z"
java
"2021-02-27T14:44:55Z"
docker/build/conf/dolphinscheduler/worker.properties.tpl
# # 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. # # worker execute thread num worker.exec.threads=${WORKER_EXEC_THREADS} # worker heartbeat interval worker.heartbeat.interval=${WORKER_HEARTBEAT_INTERVAL} # only less than cpu avg load, worker server can work. default value -1: the number of cpu cores * 2 worker.max.cpuload.avg=${WORKER_MAX_CPULOAD_AVG} # only larger than reserved memory, worker server can work. default value : physical memory * 1/6, unit is G. worker.reserved.memory=${WORKER_RESERVED_MEMORY} # worker listener port worker.listen.port=${WORKER_LISTEN_PORT} # default worker group worker.groups=${WORKER_GROUPS} # default worker weight worker.weight=${WORKER_WEIGHT} # alert server listener host alert.listen.host=${ALERT_LISTEN_HOST}
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,584
[Feature] 建议k8s部署的时候默认数据库是MySQL,降低使用门槛
建议k8s部署的时候默认数据库是MySQL,降低使用门槛。 目前随着Tidb等NewSQL数据库的流行,NewSQL会成为技术中台的首选数据库,而Tidb作为一个非常火的项目是搭建技术中台的首选数据库,Tidb兼容MySQL协议而非pg协议,所以incubator-dolphinscheduler的数据直接建在Tidb上是非常合适的
https://github.com/apache/dolphinscheduler/issues/2584
https://github.com/apache/dolphinscheduler/pull/4875
139211f3ddf9e30fb058c659fd467b18a95d0dbe
bfc5d1e4ba08cc19059bb40293bb0777b3d42377
"2020-04-30T02:53:24Z"
java
"2021-02-27T14:44:55Z"
docker/docker-swarm/docker-compose.yml
# 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. version: "3.4" services: dolphinscheduler-postgresql: image: bitnami/postgresql:latest container_name: dolphinscheduler-postgresql ports: - 5432:5432 environment: TZ: Asia/Shanghai POSTGRESQL_USERNAME: root POSTGRESQL_PASSWORD: root POSTGRESQL_DATABASE: dolphinscheduler volumes: - dolphinscheduler-postgresql:/bitnami/postgresql - dolphinscheduler-postgresql-initdb:/docker-entrypoint-initdb.d restart: unless-stopped networks: - dolphinscheduler dolphinscheduler-zookeeper: image: bitnami/zookeeper:latest container_name: dolphinscheduler-zookeeper ports: - 2181:2181 environment: TZ: Asia/Shanghai ALLOW_ANONYMOUS_LOGIN: "yes" ZOO_4LW_COMMANDS_WHITELIST: srvr,ruok,wchs,cons volumes: - dolphinscheduler-zookeeper:/bitnami/zookeeper restart: unless-stopped networks: - dolphinscheduler dolphinscheduler-api: image: apache/dolphinscheduler:latest container_name: dolphinscheduler-api command: api-server ports: - 12345:12345 environment: TZ: Asia/Shanghai DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 RESOURCE_STORAGE_TYPE: HDFS RESOURCE_UPLOAD_PATH: /dolphinscheduler FS_DEFAULT_FS: file:/// healthcheck: test: ["CMD", "/root/checkpoint.sh", "ApiApplicationServer"] interval: 30s timeout: 5s retries: 3 start_period: 30s depends_on: - dolphinscheduler-postgresql - dolphinscheduler-zookeeper volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs - dolphinscheduler-resource-local:/dolphinscheduler restart: unless-stopped networks: - dolphinscheduler dolphinscheduler-alert: image: apache/dolphinscheduler:latest container_name: dolphinscheduler-alert command: alert-server ports: - 50052:50052 environment: TZ: Asia/Shanghai ALERT_PLUGIN_DIR: lib/plugin/alert DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler healthcheck: test: ["CMD", "/root/checkpoint.sh", "AlertServer"] interval: 30s timeout: 5s retries: 3 start_period: 30s depends_on: - dolphinscheduler-postgresql volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs restart: unless-stopped networks: - dolphinscheduler dolphinscheduler-master: image: apache/dolphinscheduler:latest container_name: dolphinscheduler-master command: master-server ports: - 5678:5678 environment: TZ: Asia/Shanghai MASTER_EXEC_THREADS: "100" MASTER_EXEC_TASK_NUM: "20" MASTER_HEARTBEAT_INTERVAL: "10" MASTER_TASK_COMMIT_RETRYTIMES: "5" MASTER_TASK_COMMIT_INTERVAL: "1000" MASTER_MAX_CPULOAD_AVG: "100" MASTER_RESERVED_MEMORY: "0.1" DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 healthcheck: test: ["CMD", "/root/checkpoint.sh", "MasterServer"] interval: 30s timeout: 5s retries: 3 start_period: 30s depends_on: - dolphinscheduler-postgresql - dolphinscheduler-zookeeper volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs restart: unless-stopped networks: - dolphinscheduler dolphinscheduler-worker: image: apache/dolphinscheduler:latest container_name: dolphinscheduler-worker command: worker-server ports: - 1234:1234 - 50051:50051 environment: TZ: Asia/Shanghai WORKER_EXEC_THREADS: "100" WORKER_HEARTBEAT_INTERVAL: "10" WORKER_MAX_CPULOAD_AVG: "100" WORKER_RESERVED_MEMORY: "0.1" WORKER_GROUPS: "default" WORKER_WEIGHT: "100" HADOOP_HOME: "/opt/soft/hadoop" HADOOP_CONF_DIR: "/opt/soft/hadoop/etc/hadoop" SPARK_HOME1: "/opt/soft/spark1" SPARK_HOME2: "/opt/soft/spark2" PYTHON_HOME: "/usr/bin/python" JAVA_HOME: "/usr/lib/jvm/java-1.8-openjdk" HIVE_HOME: "/opt/soft/hive" FLINK_HOME: "/opt/soft/flink" DATAX_HOME: "/opt/soft/datax/bin/datax.py" DOLPHINSCHEDULER_DATA_BASEDIR_PATH: /tmp/dolphinscheduler ALERT_LISTEN_HOST: dolphinscheduler-alert DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 RESOURCE_STORAGE_TYPE: HDFS RESOURCE_UPLOAD_PATH: /dolphinscheduler FS_DEFAULT_FS: file:/// healthcheck: test: ["CMD", "/root/checkpoint.sh", "WorkerServer"] interval: 30s timeout: 5s retries: 3 start_period: 30s depends_on: - dolphinscheduler-postgresql - dolphinscheduler-zookeeper volumes: - dolphinscheduler-worker-data:/tmp/dolphinscheduler - dolphinscheduler-logs:/opt/dolphinscheduler/logs - dolphinscheduler-resource-local:/dolphinscheduler restart: unless-stopped networks: - dolphinscheduler networks: dolphinscheduler: driver: bridge volumes: dolphinscheduler-postgresql: dolphinscheduler-postgresql-initdb: dolphinscheduler-zookeeper: dolphinscheduler-worker-data: dolphinscheduler-logs: dolphinscheduler-resource-local:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,584
[Feature] 建议k8s部署的时候默认数据库是MySQL,降低使用门槛
建议k8s部署的时候默认数据库是MySQL,降低使用门槛。 目前随着Tidb等NewSQL数据库的流行,NewSQL会成为技术中台的首选数据库,而Tidb作为一个非常火的项目是搭建技术中台的首选数据库,Tidb兼容MySQL协议而非pg协议,所以incubator-dolphinscheduler的数据直接建在Tidb上是非常合适的
https://github.com/apache/dolphinscheduler/issues/2584
https://github.com/apache/dolphinscheduler/pull/4875
139211f3ddf9e30fb058c659fd467b18a95d0dbe
bfc5d1e4ba08cc19059bb40293bb0777b3d42377
"2020-04-30T02:53:24Z"
java
"2021-02-27T14:44:55Z"
docker/docker-swarm/docker-stack.yml
# 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. version: "3.4" services: dolphinscheduler-postgresql: image: bitnami/postgresql:latest ports: - 5432:5432 environment: TZ: Asia/Shanghai POSTGRESQL_USERNAME: root POSTGRESQL_PASSWORD: root POSTGRESQL_DATABASE: dolphinscheduler volumes: - dolphinscheduler-postgresql:/bitnami/postgresql networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-zookeeper: image: bitnami/zookeeper:latest ports: - 2181:2181 environment: TZ: Asia/Shanghai ALLOW_ANONYMOUS_LOGIN: "yes" ZOO_4LW_COMMANDS_WHITELIST: srvr,ruok,wchs,cons volumes: - dolphinscheduler-zookeeper:/bitnami/zookeeper networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-api: image: apache/dolphinscheduler:latest command: api-server ports: - 12345:12345 environment: TZ: Asia/Shanghai DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 RESOURCE_STORAGE_TYPE: HDFS RESOURCE_UPLOAD_PATH: /dolphinscheduler FS_DEFAULT_FS: file:/// healthcheck: test: ["CMD", "/root/checkpoint.sh", "ApiApplicationServer"] interval: 30s timeout: 5s retries: 3 start_period: 30s volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-alert: image: apache/dolphinscheduler:latest command: alert-server ports: - 50052:50052 environment: TZ: Asia/Shanghai ALERT_PLUGIN_DIR: lib/plugin/alert DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler healthcheck: test: ["CMD", "/root/checkpoint.sh", "AlertServer"] interval: 30s timeout: 5s retries: 3 start_period: 30s volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-master: image: apache/dolphinscheduler:latest command: master-server ports: - 5678:5678 environment: TZ: Asia/Shanghai MASTER_EXEC_THREADS: "100" MASTER_EXEC_TASK_NUM: "20" MASTER_HEARTBEAT_INTERVAL: "10" MASTER_TASK_COMMIT_RETRYTIMES: "5" MASTER_TASK_COMMIT_INTERVAL: "1000" MASTER_MAX_CPULOAD_AVG: "100" MASTER_RESERVED_MEMORY: "0.1" DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 healthcheck: test: ["CMD", "/root/checkpoint.sh", "MasterServer"] interval: 30s timeout: 5s retries: 3 start_period: 30s volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-worker: image: apache/dolphinscheduler:latest command: worker-server ports: - 1234:1234 - 50051:50051 environment: TZ: Asia/Shanghai WORKER_EXEC_THREADS: "100" WORKER_HEARTBEAT_INTERVAL: "10" WORKER_MAX_CPULOAD_AVG: "100" WORKER_RESERVED_MEMORY: "0.1" WORKER_GROUPS: "default" WORKER_WEIGHT: "100" HADOOP_HOME: "/opt/soft/hadoop" HADOOP_CONF_DIR: "/opt/soft/hadoop/etc/hadoop" SPARK_HOME1: "/opt/soft/spark1" SPARK_HOME2: "/opt/soft/spark2" PYTHON_HOME: "/usr/bin/python" JAVA_HOME: "/usr/lib/jvm/java-1.8-openjdk" HIVE_HOME: "/opt/soft/hive" FLINK_HOME: "/opt/soft/flink" DATAX_HOME: "/opt/soft/datax/bin/datax.py" DOLPHINSCHEDULER_DATA_BASEDIR_PATH: /tmp/dolphinscheduler ALERT_LISTEN_HOST: dolphinscheduler-alert DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 RESOURCE_STORAGE_TYPE: HDFS RESOURCE_UPLOAD_PATH: /dolphinscheduler FS_DEFAULT_FS: file:/// healthcheck: test: ["CMD", "/root/checkpoint.sh", "WorkerServer"] interval: 30s timeout: 5s retries: 3 start_period: 30s volumes: - dolphinscheduler-worker-data:/tmp/dolphinscheduler - dolphinscheduler-logs:/opt/dolphinscheduler/logs networks: - dolphinscheduler deploy: mode: replicated replicas: 1 networks: dolphinscheduler: driver: overlay volumes: dolphinscheduler-postgresql: dolphinscheduler-zookeeper: dolphinscheduler-worker-data: dolphinscheduler-logs:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,584
[Feature] 建议k8s部署的时候默认数据库是MySQL,降低使用门槛
建议k8s部署的时候默认数据库是MySQL,降低使用门槛。 目前随着Tidb等NewSQL数据库的流行,NewSQL会成为技术中台的首选数据库,而Tidb作为一个非常火的项目是搭建技术中台的首选数据库,Tidb兼容MySQL协议而非pg协议,所以incubator-dolphinscheduler的数据直接建在Tidb上是非常合适的
https://github.com/apache/dolphinscheduler/issues/2584
https://github.com/apache/dolphinscheduler/pull/4875
139211f3ddf9e30fb058c659fd467b18a95d0dbe
bfc5d1e4ba08cc19059bb40293bb0777b3d42377
"2020-04-30T02:53:24Z"
java
"2021-02-27T14:44:55Z"
docker/kubernetes/dolphinscheduler/README.md
# Dolphin Scheduler [Dolphin Scheduler](https://dolphinscheduler.apache.org) is a distributed and easy-to-expand visual DAG workflow scheduling system, dedicated to solving the complex dependencies in data processing, making the scheduling system out of the box for data processing. ## Introduction This chart bootstraps a [Dolphin Scheduler](https://dolphinscheduler.apache.org) distributed deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. ## Prerequisites - Helm 3.1.0+ - Kubernetes 1.12+ - PV provisioner support in the underlying infrastructure ## Installing the Chart To install the chart with the release name `dolphinscheduler`: ```bash $ git clone https://github.com/apache/incubator-dolphinscheduler.git $ cd incubator-dolphinscheduler/docker/kubernetes/dolphinscheduler $ helm repo add bitnami https://charts.bitnami.com/bitnami $ helm dependency update . $ helm install dolphinscheduler . ``` These commands deploy Dolphin Scheduler on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. > **Tip**: List all releases using `helm list` ## Uninstalling the Chart To uninstall/delete the `dolphinscheduler` deployment: ```bash $ helm uninstall dolphinscheduler ``` The command removes all the Kubernetes components associated with the chart and deletes the release. ## Configuration The following tables lists the configurable parameters of the Dolphins Scheduler chart and their default values. | Parameter | Description | Default | | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------- | | `timezone` | World time and date for cities in all time zones | `Asia/Shanghai` | | `image.registry` | Docker image registry for the Dolphins Scheduler | `docker.io` | | `image.repository` | Docker image repository for the Dolphins Scheduler | `dolphinscheduler` | | `image.tag` | Docker image version for the Dolphins Scheduler | `1.2.1` | | `image.imagePullPolicy` | Image pull policy. One of Always, Never, IfNotPresent | `IfNotPresent` | | `image.pullSecres` | PullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images | `[]` | | | | | | `postgresql.enabled` | If not exists external PostgreSQL, by default, the Dolphins Scheduler will use a internal PostgreSQL | `true` | | `postgresql.postgresqlUsername` | The username for internal PostgreSQL | `root` | | `postgresql.postgresqlPassword` | The password for internal PostgreSQL | `root` | | `postgresql.postgresqlDatabase` | The database for internal PostgreSQL | `dolphinscheduler` | | `postgresql.persistence.enabled` | Set `postgresql.persistence.enabled` to `true` to mount a new volume for internal PostgreSQL | `false` | | `postgresql.persistence.size` | `PersistentVolumeClaim` Size | `20Gi` | | `postgresql.persistence.storageClass` | PostgreSQL data Persistent Volume Storage Class. If set to "-", storageClassName: "", which disables dynamic provisioning | `-` | | `externalDatabase.type` | If exists external PostgreSQL, and set `postgresql.enable` value to false. Dolphins Scheduler's database type will use it. | `postgresql` | | `externalDatabase.driver` | If exists external PostgreSQL, and set `postgresql.enable` value to false. Dolphins Scheduler's database driver will use it. | `org.postgresql.Driver` | | `externalDatabase.host` | If exists external PostgreSQL, and set `postgresql.enable` value to false. Dolphins Scheduler's database host will use it. | `localhost` | | `externalDatabase.port` | If exists external PostgreSQL, and set `postgresql.enable` value to false. Dolphins Scheduler's database port will use it. | `5432` | | `externalDatabase.username` | If exists external PostgreSQL, and set `postgresql.enable` value to false. Dolphins Scheduler's database username will use it. | `root` | | `externalDatabase.password` | If exists external PostgreSQL, and set `postgresql.enable` value to false. Dolphins Scheduler's database password will use it. | `root` | | `externalDatabase.database` | If exists external PostgreSQL, and set `postgresql.enable` value to false. Dolphins Scheduler's database database will use it. | `dolphinscheduler` | | `externalDatabase.params` | If exists external PostgreSQL, and set `postgresql.enable` value to false. Dolphins Scheduler's database params will use it. | `characterEncoding=utf8` | | | | | | `zookeeper.enabled` | If not exists external Zookeeper, by default, the Dolphin Scheduler will use a internal Zookeeper | `true` | | `zookeeper.taskQueue` | Specify task queue for `master` and `worker` | `zookeeper` | | `zookeeper.persistence.enabled` | Set `zookeeper.persistence.enabled` to `true` to mount a new volume for internal Zookeeper | `false` | | `zookeeper.persistence.size` | `PersistentVolumeClaim` Size | `20Gi` | | `zookeeper.persistence.storageClass` | Zookeeper data Persistent Volume Storage Class. If set to "-", storageClassName: "", which disables dynamic provisioning | `-` | | `externalZookeeper.taskQueue` | If exists external Zookeeper, and set `zookeeper.enable` value to false. Specify task queue for `master` and `worker` | `zookeeper` | | `externalZookeeper.zookeeperQuorum` | If exists external Zookeeper, and set `zookeeper.enable` value to false. Specify Zookeeper quorum | `127.0.0.1:2181` | | `externalZookeeper.zookeeperRoot` | If exists external Zookeeper, and set `zookeeper.enable` value to false. Specify Zookeeper root path for `master` and `worker` | `dolphinscheduler` | | | | | | `common.configmap.DOLPHINSCHEDULER_ENV_PATH` | Extra env file path. | `/tmp/dolphinscheduler/env` | | `common.configmap.DOLPHINSCHEDULER_DATA_BASEDIR_PATH` | File uploaded path of DS. | `/tmp/dolphinscheduler/files` | | `common.configmap.RESOURCE_STORAGE_TYPE` | Resource Storate type, support type are: S3、HDFS、NONE. | `NONE` | | `common.configmap.RESOURCE_UPLOAD_PATH` | The base path of resource. | `/ds` | | `common.configmap.FS_DEFAULT_FS` | The default fs of resource, for s3 is the `s3a` prefix and bucket name. | `s3a://xxxx` | | `common.configmap.FS_S3A_ENDPOINT` | If the resource type is `S3`, you should fill this filed, it's the endpoint of s3. | `s3.xxx.amazonaws.com` | | `common.configmap.FS_S3A_ACCESS_KEY` | The access key for your s3 bucket. | `xxxxxxx` | | `common.configmap.FS_S3A_SECRET_KEY` | The secret key for your s3 bucket. | `xxxxxxx` | | `master.podManagementPolicy` | PodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down | `Parallel` | | | | | | `master.replicas` | Replicas is the desired number of replicas of the given Template | `3` | | `master.nodeSelector` | NodeSelector is a selector which must be true for the pod to fit on a node | `{}` | | `master.tolerations` | If specified, the pod's tolerations | `{}` | | `master.affinity` | If specified, the pod's scheduling constraints | `{}` | | `master.jvmOptions` | The JVM options for master server. | `""` | | `master.resources` | The `resource` limit and request config for master server. | `{}` | | `master.annotations` | The `annotations` for master server. | `{}` | | `master.configmap.MASTER_EXEC_THREADS` | Master execute thread num | `100` | | `master.configmap.MASTER_EXEC_TASK_NUM` | Master execute task number in parallel | `20` | | `master.configmap.MASTER_HEARTBEAT_INTERVAL` | Master heartbeat interval | `10` | | `master.configmap.MASTER_TASK_COMMIT_RETRYTIMES` | Master commit task retry times | `5` | | `master.configmap.MASTER_TASK_COMMIT_INTERVAL` | Master commit task interval | `1000` | | `master.configmap.MASTER_MAX_CPULOAD_AVG` | Only less than cpu avg load, master server can work. default value : the number of cpu cores * 2 | `100` | | `master.configmap.MASTER_RESERVED_MEMORY` | Only larger than reserved memory, master server can work. default value : physical memory * 1/10, unit is G | `0.1` | | `master.livenessProbe.enabled` | Turn on and off liveness probe | `true` | | `master.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `30` | | `master.livenessProbe.periodSeconds` | How often to perform the probe | `30` | | `master.livenessProbe.timeoutSeconds` | When the probe times out | `5` | | `master.livenessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `master.livenessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `master.readinessProbe.enabled` | Turn on and off readiness probe | `true` | | `master.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `30` | | `master.readinessProbe.periodSeconds` | How often to perform the probe | `30` | | `master.readinessProbe.timeoutSeconds` | When the probe times out | `5` | | `master.readinessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `master.readinessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `master.persistentVolumeClaim.enabled` | Set `master.persistentVolumeClaim.enabled` to `true` to mount a new volume for `master` | `false` | | `master.persistentVolumeClaim.accessModes` | `PersistentVolumeClaim` Access Modes | `[ReadWriteOnce]` | | `master.persistentVolumeClaim.storageClassName` | `Master` logs data Persistent Volume Storage Class. If set to "-", storageClassName: "", which disables dynamic provisioning | `-` | | `master.persistentVolumeClaim.storage` | `PersistentVolumeClaim` Size | `20Gi` | | | | | | `worker.podManagementPolicy` | PodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down | `Parallel` | | `worker.replicas` | Replicas is the desired number of replicas of the given Template | `3` | | `worker.nodeSelector` | NodeSelector is a selector which must be true for the pod to fit on a node | `{}` | | `worker.tolerations` | If specified, the pod's tolerations | `{}` | | `worker.affinity` | If specified, the pod's scheduling constraints | `{}` | | `worker.jvmOptions` | The JVM options for worker server. | `""` | | `worker.resources` | The `resource` limit and request config for worker server. | `{}` | | `worker.annotations` | The `annotations` for worker server. | `{}` | | `worker.configmap.WORKER_EXEC_THREADS` | Worker execute thread num | `100` | | `worker.configmap.WORKER_HEARTBEAT_INTERVAL` | Worker heartbeat interval | `10` | | `worker.configmap.WORKER_FETCH_TASK_NUM` | Submit the number of tasks at a time | `3` | | `worker.configmap.WORKER_MAX_CPULOAD_AVG` | Only less than cpu avg load, worker server can work. default value : the number of cpu cores * 2 | `100` | | `worker.configmap.WORKER_RESERVED_MEMORY` | Only larger than reserved memory, worker server can work. default value : physical memory * 1/10, unit is G | `0.1` | | `worker.configmap.DOLPHINSCHEDULER_DATA_BASEDIR_PATH` | User data directory path, self configuration, please make sure the directory exists and have read write permissions | `/tmp/dolphinscheduler` | | `worker.configmap.DOLPHINSCHEDULER_ENV` | System env path, self configuration, please read `values.yaml` | `[]` | | `worker.livenessProbe.enabled` | Turn on and off liveness probe | `true` | | `worker.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `30` | | `worker.livenessProbe.periodSeconds` | How often to perform the probe | `30` | | `worker.livenessProbe.timeoutSeconds` | When the probe times out | `5` | | `worker.livenessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `worker.livenessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `worker.readinessProbe.enabled` | Turn on and off readiness probe | `true` | | `worker.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `30` | | `worker.readinessProbe.periodSeconds` | How often to perform the probe | `30` | | `worker.readinessProbe.timeoutSeconds` | When the probe times out | `5` | | `worker.readinessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `worker.readinessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `worker.persistentVolumeClaim.enabled` | Set `worker.persistentVolumeClaim.enabled` to `true` to enable `persistentVolumeClaim` for `worker` | `false` | | `worker.persistentVolumeClaim.dataPersistentVolume.enabled` | Set `worker.persistentVolumeClaim.dataPersistentVolume.enabled` to `true` to mount a data volume for `worker` | `false` | | `worker.persistentVolumeClaim.dataPersistentVolume.accessModes` | `PersistentVolumeClaim` Access Modes | `[ReadWriteOnce]` | | `worker.persistentVolumeClaim.dataPersistentVolume.storageClassName` | `Worker` data Persistent Volume Storage Class. If set to "-", storageClassName: "", which disables dynamic provisioning | `-` | | `worker.persistentVolumeClaim.dataPersistentVolume.storage` | `PersistentVolumeClaim` Size | `20Gi` | | `worker.persistentVolumeClaim.logsPersistentVolume.enabled` | Set `worker.persistentVolumeClaim.logsPersistentVolume.enabled` to `true` to mount a logs volume for `worker` | `false` | | `worker.persistentVolumeClaim.logsPersistentVolume.accessModes` | `PersistentVolumeClaim` Access Modes | `[ReadWriteOnce]` | | `worker.persistentVolumeClaim.logsPersistentVolume.storageClassName` | `Worker` logs data Persistent Volume Storage Class. If set to "-", storageClassName: "", which disables dynamic provisioning | `-` | | `worker.persistentVolumeClaim.logsPersistentVolume.storage` | `PersistentVolumeClaim` Size | `20Gi` | | | | | | `alert.strategy.type` | Type of deployment. Can be "Recreate" or "RollingUpdate" | `RollingUpdate` | | `alert.strategy.rollingUpdate.maxSurge` | The maximum number of pods that can be scheduled above the desired number of pods | `25%` | | `alert.strategy.rollingUpdate.maxUnavailable` | The maximum number of pods that can be unavailable during the update | `25%` | | `alert.replicas` | Replicas is the desired number of replicas of the given Template | `1` | | `alert.nodeSelector` | NodeSelector is a selector which must be true for the pod to fit on a node | `{}` | | `alert.tolerations` | If specified, the pod's tolerations | `{}` | | `alert.affinity` | If specified, the pod's scheduling constraints | `{}` | | `alert.jvmOptions` | The JVM options for alert server. | `""` | | `alert.resources` | The `resource` limit and request config for alert server. | `{}` | | `alert.annotations` | The `annotations` for alert server. | `{}` | | `alert.configmap.ALERT_PLUGIN_DIR` | Alert plugin path. | `/opt/dolphinscheduler/alert/plugin` | | `alert.configmap.XLS_FILE_PATH` | XLS file path | `/tmp/xls` | | `alert.configmap.MAIL_SERVER_HOST` | Mail `SERVER HOST ` | `nil` | | `alert.configmap.MAIL_SERVER_PORT` | Mail `SERVER PORT` | `nil` | | `alert.configmap.MAIL_SENDER` | Mail `SENDER` | `nil` | | `alert.configmap.MAIL_USER` | Mail `USER` | `nil` | | `alert.configmap.MAIL_PASSWD` | Mail `PASSWORD` | `nil` | | `alert.configmap.MAIL_SMTP_STARTTLS_ENABLE` | Mail `SMTP STARTTLS` enable | `false` | | `alert.configmap.MAIL_SMTP_SSL_ENABLE` | Mail `SMTP SSL` enable | `false` | | `alert.configmap.MAIL_SMTP_SSL_TRUST` | Mail `SMTP SSL TRUST` | `nil` | | `alert.configmap.ENTERPRISE_WECHAT_ENABLE` | `Enterprise Wechat` enable | `false` | | `alert.configmap.ENTERPRISE_WECHAT_CORP_ID` | `Enterprise Wechat` corp id | `nil` | | `alert.configmap.ENTERPRISE_WECHAT_SECRET` | `Enterprise Wechat` secret | `nil` | | `alert.configmap.ENTERPRISE_WECHAT_AGENT_ID` | `Enterprise Wechat` agent id | `nil` | | `alert.configmap.ENTERPRISE_WECHAT_USERS` | `Enterprise Wechat` users | `nil` | | `alert.livenessProbe.enabled` | Turn on and off liveness probe | `true` | | `alert.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `30` | | `alert.livenessProbe.periodSeconds` | How often to perform the probe | `30` | | `alert.livenessProbe.timeoutSeconds` | When the probe times out | `5` | | `alert.livenessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `alert.livenessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `alert.readinessProbe.enabled` | Turn on and off readiness probe | `true` | | `alert.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `30` | | `alert.readinessProbe.periodSeconds` | How often to perform the probe | `30` | | `alert.readinessProbe.timeoutSeconds` | When the probe times out | `5` | | `alert.readinessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `alert.readinessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `alert.persistentVolumeClaim.enabled` | Set `alert.persistentVolumeClaim.enabled` to `true` to mount a new volume for `alert` | `false` | | `alert.persistentVolumeClaim.accessModes` | `PersistentVolumeClaim` Access Modes | `[ReadWriteOnce]` | | `alert.persistentVolumeClaim.storageClassName` | `Alert` logs data Persistent Volume Storage Class. If set to "-", storageClassName: "", which disables dynamic provisioning | `-` | | `alert.persistentVolumeClaim.storage` | `PersistentVolumeClaim` Size | `20Gi` | | | | | | `api.strategy.type` | Type of deployment. Can be "Recreate" or "RollingUpdate" | `RollingUpdate` | | `api.strategy.rollingUpdate.maxSurge` | The maximum number of pods that can be scheduled above the desired number of pods | `25%` | | `api.strategy.rollingUpdate.maxUnavailable` | The maximum number of pods that can be unavailable during the update | `25%` | | `api.replicas` | Replicas is the desired number of replicas of the given Template | `1` | | `api.nodeSelector` | NodeSelector is a selector which must be true for the pod to fit on a node | `{}` | | `api.tolerations` | If specified, the pod's tolerations | `{}` | | `api.affinity` | If specified, the pod's scheduling constraints | `{}` | | `api.jvmOptions` | The JVM options for api server. | `""` | | `api.resources` | The `resource` limit and request config for api server. | `{}` | | `api.annotations` | The `annotations` for api server. | `{}` | | `api.livenessProbe.enabled` | Turn on and off liveness probe | `true` | | `api.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `30` | | `api.livenessProbe.periodSeconds` | How often to perform the probe | `30` | | `api.livenessProbe.timeoutSeconds` | When the probe times out | `5` | | `api.livenessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `api.livenessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `api.readinessProbe.enabled` | Turn on and off readiness probe | `true` | | `api.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `30` | | `api.readinessProbe.periodSeconds` | How often to perform the probe | `30` | | `api.readinessProbe.timeoutSeconds` | When the probe times out | `5` | | `api.readinessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `api.readinessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `api.persistentVolumeClaim.enabled` | Set `api.persistentVolumeClaim.enabled` to `true` to mount a new volume for `api` | `false` | | `api.persistentVolumeClaim.accessModes` | `PersistentVolumeClaim` Access Modes | `[ReadWriteOnce]` | | `api.persistentVolumeClaim.storageClassName` | `api` logs data Persistent Volume Storage Class. If set to "-", storageClassName: "", which disables dynamic provisioning | `-` | | `api.persistentVolumeClaim.storage` | `PersistentVolumeClaim` Size | `20Gi` | | | | | | `ingress.enabled` | Enable ingress | `false` | | `ingress.host` | Ingress host | `dolphinscheduler.org` | | `ingress.path` | Ingress path | `/` | | `ingress.tls.enabled` | Enable ingress tls | `false` | | `ingress.tls.hosts` | Ingress tls hosts | `dolphinscheduler.org` | | `ingress.tls.secretName` | Ingress tls secret name | `dolphinscheduler-tls` | For more information please refer to the [chart](https://github.com/apache/incubator-dolphinscheduler.git) documentation.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,584
[Feature] 建议k8s部署的时候默认数据库是MySQL,降低使用门槛
建议k8s部署的时候默认数据库是MySQL,降低使用门槛。 目前随着Tidb等NewSQL数据库的流行,NewSQL会成为技术中台的首选数据库,而Tidb作为一个非常火的项目是搭建技术中台的首选数据库,Tidb兼容MySQL协议而非pg协议,所以incubator-dolphinscheduler的数据直接建在Tidb上是非常合适的
https://github.com/apache/dolphinscheduler/issues/2584
https://github.com/apache/dolphinscheduler/pull/4875
139211f3ddf9e30fb058c659fd467b18a95d0dbe
bfc5d1e4ba08cc19059bb40293bb0777b3d42377
"2020-04-30T02:53:24Z"
java
"2021-02-27T14:44:55Z"
dolphinscheduler-server/src/main/resources/worker.properties
# # 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. # # worker execute thread num #worker.exec.threads=100 # worker heartbeat interval #worker.heartbeat.interval=10 # only less than cpu avg load, worker server can work. default value -1: the number of cpu cores * 2 #worker.max.cpuload.avg=-1 # only larger than reserved memory, worker server can work. default value : physical memory * 1/6, unit is G. #worker.reserved.memory=0.3 # worker listener port #worker.listen.port=1234 # default worker group #worker.groups=default # default worker weight #worker.weight=100 # alert server listener host alert.listen.host=localhost
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,908
[Bug][UI] Dependent task item cannot delete and select
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'Process definition create' 2. Create 'Dependent' task 3. Click 'Add dependency' 4. Click 'Add' 4. See error: Dependent task item cannot delete and select This bug is caused by replacing element-ui. **Expected behavior** Bug fixed **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/4902714/109503586-6d947280-7ad5-11eb-9940-fdbb0b794030.png) ![image](https://user-images.githubusercontent.com/4902714/109503550-62414700-7ad5-11eb-851d-622eb73bd0a4.png) ![image](https://user-images.githubusercontent.com/4902714/109504208-412d2600-7ad6-11eb-9177-01868928a395.png) **Which version of Dolphin Scheduler:** -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4908
https://github.com/apache/dolphinscheduler/pull/4909
a25c3974fcba99d96e884c9f928d5dae4d455785
54fc458e442f823a2d2c491472ce767edeec2196
"2021-03-01T13:31:46Z"
java
"2021-03-01T13:58:39Z"
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/dependItemList.vue
/* * 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. */ <template> <div class="dep-list-model"> <div v-for="(el,$index) in dependItemList" :key='$index' @click="itemIndex = $index"> <el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.projectId" @change="_onChangeProjectId" size="small"> <el-option v-for="item in projectList" :key="item.value" :value="item.value" :label="item.label"></el-option> </el-select> <el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.definitionId" @change="_onChangeDefinitionId" size="small"> <el-option v-for="item in el.definitionList" :key="item.value" :value="item.value" :label="item.label"></el-option> </el-select> <el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.depTasks" size="small"> <el-option v-for="item in el.depTasksList || []" :key="item" :value="item" :label="item"></el-option> </el-select> <el-select v-model="el.cycle" :disabled="isDetails" @change="_onChangeCycle" size="small"> <el-option v-for="item in cycleList" :key="item.value" :value="item.value" :label="item.label"></el-option> </el-select> <el-select v-model="el.dateValue" :disabled="isDetails" size="small"> <el-option v-for="item in el.dateValueList || []" :key="item.value" :value="item.value" :label="item.label"></el-option> </el-select> <template v-if="isInstance"> <span class="instance-state"> <em class="iconfont el-icon-success" :class="'icon-' + el.state" v-if="el.state === 'SUCCESS'" data-toggle="tooltip" data-container="body" :title="$t('success')"></em> <em class="iconfont el-icon-timer" :class="'icon-' + el.state" v-if="el.state === 'WAITING'" data-toggle="tooltip" data-container="body" :title="$t('waiting')"></em> <em class="iconfont el-icon-error" :class="'icon-' + el.state" v-if="el.state === 'FAILED'" data-toggle="tooltip" data-container="body" :title="$t('failed')"></em> </span> </template> <span class="operation"> <a href="javascript:" class="delete" @click="!isDetails && _remove($index)"> <em class="el-icon-delete" :class="_isDetails" data-toggle="tooltip" data-container="body" :title="$t('delete')" ></em> </a> <a href="javascript:" class="add" @click="!isDetails && _add()" v-if="$index === (dependItemList.length - 1)"> <em class="iconfont el-icon-circle-plus-outline" :class="_isDetails" data-toggle="tooltip" data-container="body" :title="$t('Add')"></em> </a> </span> </div> </div> </template> <script> import _ from 'lodash' import { cycleList, dateValueList } from './commcon' import disabledState from '@/module/mixin/disabledState' export default { name: 'dep-list', data () { return { list: [], projectList: [], cycleList: cycleList, isInstance: false, itemIndex: null } }, mixins: [disabledState], props: { dependItemList: Array, index: Number, dependTaskList: Array }, model: { prop: 'dependItemList', event: 'dependItemListEvent' }, methods: { /** * add task */ _add () { // btn loading this.isLoading = true // add task list let projectId = this.projectList[0].value this._getProcessByProjectId(projectId).then(definitionList => { // dependItemList index let is = (value) => _.some(this.dependItemList, { definitionId: value }) let noArr = _.filter(definitionList, v => !is(v.value)) let value = noArr[0] && noArr[0].value || null let val = value || definitionList[0].value this._getDependItemList(val).then(depTasksList => { this.$nextTick(() => { this.$emit('dependItemListEvent', _.concat(this.dependItemList, this._rtNewParams(val, definitionList, depTasksList, projectId))) }) }) }) // remove tooltip this._removeTip() }, /** * remove task */ _remove (i) { // this.dependTaskList[this.index].dependItemList.splice(i, 1) this._removeTip() if (!this.dependItemList.length || this.dependItemList.length === 0) { this.$emit('on-delete-all', { index: this.index }) } }, _getProjectList () { return new Promise((resolve, reject) => { this.projectList = _.map(_.cloneDeep(this.store.state.dag.projectListS), v => { return { value: v.id, label: v.name } }) resolve() }) }, /** * get processlist */ _getProcessList () { return new Promise((resolve, reject) => { let definitionList = _.map(_.cloneDeep(this.store.state.dag.processListS), v => { return { value: v.id, label: v.name } }) resolve(definitionList) }) }, _getProcessByProjectId (id) { return new Promise((resolve, reject) => { this.store.dispatch('dag/getProcessByProjectId', { projectId: id }).then(res => { let definitionList = _.map(_.cloneDeep(res), v => { return { value: v.id, label: v.name } }) resolve(definitionList) }) }) }, /** * get dependItemList */ _getDependItemList (ids, is = true) { return new Promise((resolve, reject) => { if (is) { this.store.dispatch('dag/getProcessTasksList', { processDefinitionId: ids }).then(res => { resolve(['ALL'].concat(_.map(res, v => v.name))) }) } else { this.store.dispatch('dag/getTaskListDefIdAll', { processDefinitionIdList: ids }).then(res => { resolve(res) }) } }) }, /** * change process get dependItemList */ _onChangeProjectId (value) { this._getProcessByProjectId(value).then(definitionList => { /* this.$set(this.dependItemList, this.itemIndex, this._dlOldParams(value, definitionList, item)) */ let definitionId = definitionList[0].value this._getDependItemList(definitionId).then(depTasksList => { let item = this.dependItemList[this.itemIndex] // init set depTasks All item.depTasks = 'ALL' // set dependItemList item data this.$set(this.dependItemList, this.itemIndex, this._cpOldParams(value, definitionId, definitionList, depTasksList, item)) }) }) }, _onChangeDefinitionId (value) { // get depItem list data this._getDependItemList(value).then(depTasksList => { let item = this.dependItemList[this.itemIndex] // init set depTasks All item.depTasks = 'ALL' // set dependItemList item data this.$set(this.dependItemList, this.itemIndex, this._rtOldParams(value, item.definitionList, depTasksList, item)) }) }, _onChangeCycle (value) { let list = _.cloneDeep(dateValueList[value]) this.$set(this.dependItemList[this.itemIndex], 'dateValue', list[0].value) this.$set(this.dependItemList[this.itemIndex], 'dateValueList', list) }, _rtNewParams (value, definitionList, depTasksList, projectId) { return { projectId: projectId, definitionId: value, // dependItem need private definitionList definitionList: definitionList, depTasks: 'ALL', depTasksList: depTasksList, cycle: 'day', dateValue: 'today', dateValueList: _.cloneDeep(dateValueList.day), state: '' } }, _rtOldParams (value, definitionList, depTasksList, item) { return { projectId: item.projectId, definitionId: value, // dependItem need private definitionList definitionList: definitionList, depTasks: item.depTasks || 'ALL', depTasksList: depTasksList, cycle: item.cycle, dateValue: item.dateValue, dateValueList: _.cloneDeep(dateValueList[item.cycle]), state: item.state } }, _cpOldParams (value, definitionId, definitionList, depTasksList, item) { return { projectId: value, definitionList: definitionList, definitionId: definitionId, depTasks: item.depTasks || 'ALL', depTasksList: depTasksList, cycle: item.cycle, dateValue: item.dateValue, dateValueList: _.cloneDeep(dateValueList[item.cycle]), state: item.state } }, /** * remove tip */ _removeTip () { $('body').find('.tooltip.fade.top.in').remove() } }, watch: { }, beforeCreate () { }, created () { // is type projects-instance-details this.isInstance = this.router.history.current.name === 'projects-instance-details' // get processlist this._getProjectList().then(() => { if (!this.dependItemList.length) { let projectId = this.projectList[0].value this._getProcessByProjectId(projectId).then(definitionList => { let value = definitionList[0].value this._getDependItemList(value).then(depTasksList => { this.$emit('dependItemListEvent', _.concat(this.dependItemList, this._rtNewParams(value, definitionList, depTasksList, projectId))) }) }) } else { // get definitionId ids let ids = _.map(this.dependItemList, v => v.definitionId).join(',') // get item list this._getDependItemList(ids, false).then(res => { _.map(this.dependItemList, (v, i) => { this._getProcessByProjectId(v.projectId).then(definitionList => { this.$set(this.dependItemList, i, this._rtOldParams(v.definitionId, definitionList, ['ALL'].concat(_.map(res[v.definitionId] || [], v => v.name)), v)) }) }) }) } }) }, mounted () { }, components: {} } </script> <style lang="scss" rel="stylesheet/scss"> .dep-list-model { position: relative; min-height: 32px; .list { margin-bottom: 6px; .operation { width: 80px; padding-left: 4px; a { i { font-size: 18px; vertical-align: middle; } } .delete { color: #ff0000; } .add { color: #0097e0; } } } .instance-state { display: inline-block; width: 24px; .iconfont { font-size: 20px; vertical-align: middle; cursor: pointer; margin-left: 6px; &.icon-SUCCESS { color: #33cc00; } &.icon-WAITING { color: #888888; } &.icon-FAILED { color: #F31322; } } } } </style>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,908
[Bug][UI] Dependent task item cannot delete and select
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'Process definition create' 2. Create 'Dependent' task 3. Click 'Add dependency' 4. Click 'Add' 4. See error: Dependent task item cannot delete and select This bug is caused by replacing element-ui. **Expected behavior** Bug fixed **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/4902714/109503586-6d947280-7ad5-11eb-9940-fdbb0b794030.png) ![image](https://user-images.githubusercontent.com/4902714/109503550-62414700-7ad5-11eb-851d-622eb73bd0a4.png) ![image](https://user-images.githubusercontent.com/4902714/109504208-412d2600-7ad6-11eb-9177-01868928a395.png) **Which version of Dolphin Scheduler:** -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4908
https://github.com/apache/dolphinscheduler/pull/4909
a25c3974fcba99d96e884c9f928d5dae4d455785
54fc458e442f823a2d2c491472ce767edeec2196
"2021-03-01T13:31:46Z"
java
"2021-03-01T13:58:39Z"
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/nodeStatus.vue
/* * 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. */ <template> <div class="dep-list-model"> <div v-for="(el,$index) in dependItemList" :key='$index' class="list" @click="itemIndex = $index"> <el-select style="width: 150px;" size="small" v-model="el.depTasks" :disabled="isDetails"> <el-option v-for="item in preNode" :key="item.value" :value="item.value" :label="item.label"> </el-option> </el-select> <el-select style="width: 116px;" size="small" v-model="el.status" :disabled="isDetails"> <el-option v-for="item in nodeStatusList || []" :key="item.value" :value="item.value" :label="item.label"> </el-option> </el-select> <template v-if="isInstance"> <span class="instance-state"> <em class="iconfont el-icon-success" :class="'icon-' + el.state" v-if="el.state === 'SUCCESS'" data-toggle="tooltip" data-container="body" :title="$t('success')"></em> <em class="iconfont el-icon-timer" :class="'icon-' + el.state" v-if="el.state === 'RUNNING_EXECUTION'" data-toggle="tooltip" data-container="body" :title="$t('waiting')"></em> <em class="iconfont el-icon-error" :class="'icon-' + el.state" v-if="el.state === 'FAILURE'" data-toggle="tooltip" data-container="body" :title="$t('failed')"></em> </span> </template> <span class="operation"> <a href="javascript:" class="delete" @click="!isDetails && _remove($index)"> <em class="iconfont el-icon-delete" :class="_isDetails" data-toggle="tooltip" data-container="body" :title="$t('delete')" ></em> </a> <a href="javascript:" class="add" @click="!isDetails && _add()" v-if="$index === (dependItemList.length - 1)"> <em class="iconfont el-icon-circle-plus-outline" :class="_isDetails" data-toggle="tooltip" data-container="body" :title="$t('Add')"></em> </a> </span> </div> </div> </template> <script> import _ from 'lodash' import { cycleList, nodeStatusList } from './commcon' import disabledState from '@/module/mixin/disabledState' export default { name: 'node-status', data () { return { list: [], definitionList: [], projectList: [], cycleList: cycleList, isInstance: false, itemIndex: null, nodeStatusList: nodeStatusList } }, mixins: [disabledState], props: { dependItemList: Array, index: Number, dependTaskList: Array, preNode: Array }, model: { prop: 'dependItemList', event: 'dependItemListEvent' }, methods: { /** * add task */ _add () { // btn loading this.isLoading = true this.$emit('dependItemListEvent', _.concat(this.dependItemList, this._rtNewParams())) // remove tooltip this._removeTip() }, /** * remove task */ _remove (i) { this._removeTip() if (!this.dependItemList.length || this.dependItemList.length === 0) { this.$emit('on-delete-all', { index: this.index }) } }, _getProjectList () { return new Promise((resolve, reject) => { this.projectList = _.map(_.cloneDeep(this.store.state.dag.projectListS), v => { return { value: v.id, label: v.name } }) resolve() }) }, _getProcessByProjectId (id) { return new Promise((resolve, reject) => { this.store.dispatch('dag/getProcessByProjectId', { projectId: id }).then(res => { this.definitionList = _.map(_.cloneDeep(res), v => { return { value: v.id, label: v.name } }) resolve(res) }) }) }, /** * get dependItemList */ _getDependItemList (ids, is = true) { return new Promise((resolve, reject) => { if (is) { this.store.dispatch('dag/getProcessTasksList', { processDefinitionId: ids }).then(res => { resolve(['ALL'].concat(_.map(res, v => v.name))) }) } }) }, _rtNewParams () { return { depTasks: '', status: '' } }, _rtOldParams (value, depTasksList, item) { return { depTasks: '', status: '' } }, /** * remove tip */ _removeTip () { $('body').find('.tooltip.fade.top.in').remove() } }, watch: { }, beforeCreate () { }, created () { // is type projects-instance-details this.isInstance = this.router.history.current.name === 'projects-instance-details' // get processlist this._getProjectList().then(() => { if (!this.dependItemList.length) { this.$emit('dependItemListEvent', _.concat(this.dependItemList, this._rtNewParams())) } else { // get definitionId ids let ids = _.map(this.dependItemList, v => v.definitionId).join(',') // get item list this._getDependItemList(ids, false).then(res => { _.map(this.dependItemList, (v, i) => { this._getProcessByProjectId(v.projectId).then(definitionList => { this.$set(this.dependItemList, i, this._rtOldParams(v.definitionId, ['ALL'].concat(_.map(res[v.definitionId] || [], v => v.name)), v)) }) }) }) } }) }, mounted () {}, components: {} } </script> <style lang="scss" rel="stylesheet/scss"> .dep-list-model { position: relative; min-height: 32px; .list { margin-bottom: 6px; .operation { padding-left: 4px; a { i { font-size: 18px; vertical-align: middle; } } .delete { color: #ff0000; } .add { color: #0097e0; } } } .instance-state { display: inline-block; width: 24px; .iconfont { font-size: 20px; vertical-align: middle; cursor: pointer; margin-left: 6px; &.icon-SUCCESS { color: #33cc00; } &.icon-WAITING { color: #888888; } &.icon-FAILED { color: #F31322; } } } } </style>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,908
[Bug][UI] Dependent task item cannot delete and select
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'Process definition create' 2. Create 'Dependent' task 3. Click 'Add dependency' 4. Click 'Add' 4. See error: Dependent task item cannot delete and select This bug is caused by replacing element-ui. **Expected behavior** Bug fixed **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/4902714/109503586-6d947280-7ad5-11eb-9940-fdbb0b794030.png) ![image](https://user-images.githubusercontent.com/4902714/109503550-62414700-7ad5-11eb-851d-622eb73bd0a4.png) ![image](https://user-images.githubusercontent.com/4902714/109504208-412d2600-7ad6-11eb-9177-01868928a395.png) **Which version of Dolphin Scheduler:** -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4908
https://github.com/apache/dolphinscheduler/pull/4909
a25c3974fcba99d96e884c9f928d5dae4d455785
54fc458e442f823a2d2c491472ce767edeec2196
"2021-03-01T13:31:46Z"
java
"2021-03-01T13:58:39Z"
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/conditions.vue
/* * 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. */ <template> <div class="dependence-model"> <m-list-box> <div slot="text">{{$t('Custom Parameters')}}</div> <div slot="content"> <div class="dep-opt"> <a href="javascript:" @click="!isDetails && _addDep()" class="add-dep"> <em v-if="!isLoading" class="el-icon-circle-plus-outline" :class="_isDetails" data-toggle="tooltip" :title="$t('Add')"></em> <em v-if="isLoading" class="el-icon-loading as as-spin" data-toggle="tooltip" :title="$t('Add')"></em> </a> </div> <div class="dep-box"> <span class="dep-relation" @click="!isDetails && _setGlobalRelation()" v-if="dependTaskList.length"> {{relation === 'AND' ? $t('and') : $t('or')}} </span> <div class="dep-list" v-for="(el,$index) in dependTaskList" :key='$index'> <span class="dep-line-pie" v-if="el.dependItemList.length" @click="!isDetails && _setRelation($index)"> {{el.relation === 'AND' ? $t('and') : $t('or')}} </span> <em class="el-icon-delete dep-delete" data-toggle="tooltip" data-container="body" :class="_isDetails" @click="!isDetails && _deleteDep($index)" :title="$t('delete')" > </em> <m-node-status :dependTaskList='dependTaskList' v-model="el.dependItemList" @on-delete-all="_onDeleteAll" @getDependTaskList="getDependTaskList" :index="$index" :rear-list = "rearList" :pre-node = "preNode"> </m-node-status> </div> </div> </div> </m-list-box> </div> </template> <script> import _ from 'lodash' import mListBox from './_source/listBox' import mNodeStatus from './_source/nodeStatus' import disabledState from '@/module/mixin/disabledState' export default { name: 'dependence', data () { return { relation: 'AND', dependTaskList: [], isLoading: false } }, mixins: [disabledState], props: { backfillItem: Object, preNode: Array, rearList: Array }, methods: { _addDep () { if (!this.isLoading) { this.isLoading = true this.dependTaskList.push({ dependItemList: [], relation: 'AND' }) } }, _deleteDep (i) { // remove index dependent this.dependTaskList.splice(i, 1) // remove tootip $('body').find('.tooltip.fade.top.in').remove() }, _onDeleteAll (i) { this.dependTaskList[this.index].dependItemList.splice(i, 1) this.dependTaskList.map((item, i) => { if (item.dependItemList.length === 0) { this.dependTaskList.splice(i, 1) } }) // this._deleteDep(i) }, _setGlobalRelation () { this.relation = this.relation === 'AND' ? 'OR' : 'AND' }, getDependTaskList (i) { // console.log('getDependTaskList',i) }, _setRelation (i) { this.dependTaskList[i].relation = this.dependTaskList[i].relation === 'AND' ? 'OR' : 'AND' }, _verification () { this.$emit('on-dependent', { relation: this.relation, dependTaskList: _.map(this.dependTaskList, v => { return { relation: v.relation, dependItemList: _.map(v.dependItemList, v1 => _.omit(v1, ['depTasksList', 'state', 'dateValueList'])) } }) }) return true } }, watch: { dependTaskList (e) { setTimeout(() => { this.isLoading = false }, 600) }, cacheDependence (val) { this.$emit('on-cache-dependent', val) } }, beforeCreate () { }, created () { let o = this.backfillItem // Does not represent an empty object backfill if (!_.isEmpty(o)) { this.relation = _.cloneDeep(o.dependence.relation) || 'AND' this.dependTaskList = _.cloneDeep(o.dependence.dependTaskList) || [] // Process instance return status display matches by key _.map(this.dependTaskList, v => _.map(v.dependItemList, v1 => { $(`#${o.id}`).siblings().each(function () { if (v1.depTasks === $(this).text()) { v1.state = $(this).attr('data-dependent-depstate') } }) })) } }, mounted () { }, destroyed () { }, computed: { cacheDependence () { return { relation: this.relation, dependTaskList: _.map(this.dependTaskList, v => { return { relation: v.relation, dependItemList: _.map(v.dependItemList, v1 => _.omit(v1, ['depTasksList', 'state', 'dateValueList'])) } }) } } }, components: { mListBox, mNodeStatus } } </script> <style lang="scss" rel="stylesheet/scss"> .dependence-model { margin-top: -10px; .dep-opt { margin-bottom: 10px; padding-top: 3px; line-height: 24px; .add-dep { color: #0097e0; margin-right: 10px; i { font-size: 18px; vertical-align: middle; } } } .dep-list { margin-bottom: 16px; position: relative; border-left: 1px solid #eee; padding-left: 16px; margin-left: -16px; transition: all 0.2s ease-out; padding-bottom: 20px; &:hover{ border-left: 1px solid #0097e0; transition: all 0.2s ease-out; .dep-line-pie { transition: all 0.2s ease-out; border: 1px solid #0097e0; background: #0097e0; color: #fff; } } .dep-line-pie { transition: all 0.2s ease-out; position: absolute; width: 20px; height: 20px; border: 1px solid #e2e2e2; text-align: center; top: 50%; margin-top: -20px; z-index: 1; left: -10px; border-radius: 10px; background: #fff; font-size: 12px; cursor: pointer; &::selection { background:transparent; } &::-moz-selection { background:transparent; } &::-webkit-selection { background:transparent; } } .dep-delete { position: absolute; bottom: -6px; left: 14px; font-size: 18px; color: #ff0000; cursor: pointer; } } .dep-box { border-left: 4px solid #eee; margin-left: -46px; padding-left: 42px; position: relative; .dep-relation { position: absolute; width: 20px; height: 20px; border: 1px solid #e2e2e2; text-align: center; top: 50%; margin-top: -10px; z-index: 1; left: -12px; border-radius: 10px; background: #fff; font-size: 12px; cursor: pointer; &::selection { background:transparent; } &::-moz-selection { background:transparent; } &::-webkit-selection { background:transparent; } } } } </style>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,929
[Bug][dao] when run a hive-sql with udf throw ClassCastException
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. create an hive udf 2. run a hive-sql with udf 3. check task log **Expected behavior** Can run hive-sql with udf success **Screenshots** If applicable, add screenshots to help explain your problem. ![企业微信截图_16146789692797.png](http://ww1.sinaimg.cn/large/005Cc2n2gy1go5pomkwcjj30nx05ujrw.jpg) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4929
https://github.com/apache/dolphinscheduler/pull/4930
ba2bb22100a2d20180477897cadd6cb57b139dd2
397c78149c3eb0aad10b6cacd82e82013d4b7dbd
"2021-03-02T09:57:49Z"
java
"2021-03-02T10:26:14Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/UdfFunc.java
/* * 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.dolphinscheduler.dao.entity; import org.apache.dolphinscheduler.common.enums.UdfType; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.KeyDeserializer; import java.io.IOException; import java.util.Date; /** * udf function */ @TableName("t_ds_udfs") public class UdfFunc { /** * id */ @TableId(value="id", type=IdType.AUTO) private int id; /** * user id */ private int userId; /** * udf function name */ private String funcName; /** * udf class name */ private String className; /** * udf argument types */ private String argTypes; /** * udf data base */ private String database; /** * udf description */ private String description; /** * resource id */ private int resourceId; /** * resource name */ private String resourceName; /** * udf function type: hive / spark */ private UdfType type; /** * create time */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") private Date createTime; /** * update time */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") private Date updateTime; public int getId() { return id; } public void setId(int id) { this.id = id; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getFuncName() { return funcName; } public void setFuncName(String funcName) { this.funcName = funcName; } public String getClassName() { return className; } public void setClassName(String className) { this.className = className; } public String getArgTypes() { return argTypes; } public void setArgTypes(String argTypes) { this.argTypes = argTypes; } public String getDatabase() { return database; } public void setDatabase(String database) { this.database = database; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public int getResourceId() { return resourceId; } public void setResourceId(int resourceId) { this.resourceId = resourceId; } public String getResourceName() { return resourceName; } public void setResourceName(String resourceName) { this.resourceName = resourceName; } public UdfType getType() { return type; } public void setType(UdfType type) { this.type = type; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } UdfFunc udfFunc = (UdfFunc) o; if (id != udfFunc.id) { return false; } return !(funcName != null ? !funcName.equals(udfFunc.funcName) : udfFunc.funcName != null); } @Override public int hashCode() { int result = id; result = 31 * result + (funcName != null ? funcName.hashCode() : 0); return result; } @Override public String toString() { return JSONUtils.toJsonString(this); } public static class UdfFuncDeserializer extends KeyDeserializer { @Override public Object deserializeKey(String key, DeserializationContext ctxt) throws IOException { if (StringUtils.isBlank(key)) { return null; } return JSONUtils.parseObject(key); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,934
[Bug][UI] Index page statics info not show todays but show all history statics task info
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Go to index page 2. See task info statics and time range,it shows all history task statics info but not todays 3. Use F12 debug page,you can see **startDate** and **endtDate** is null **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** ![微信图片_20210303103153.png](http://ww1.sinaimg.cn/large/005Cc2n2ly1go6igf2agxj31ls0omah2.jpg) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4934
https://github.com/apache/dolphinscheduler/pull/4935
5bfe3fca673d9f0a0622ef5c3f089e52a9599641
53aedc50eca8bad176e1c9dfbec6d38b9c34cd4b
"2021-03-03T02:32:48Z"
java
"2021-03-03T12:36:41Z"
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/index.vue
/* * 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. */ <template> <m-list-construction :title="searchParams.projectId ? $t('Project Home') : $t('Home')"> <template slot="content"> <div class="perject-home-content"> <div class="time-model"> <el-date-picker v-model="dataTime" type="datetimerange" size="small" @change="_datepicker" range-separator="-" :start-placeholder="$t('startDate')" :end-placeholder="$t('endDate')" value-format="yyyy-MM-dd HH:mm:ss"> </el-date-picker> </div> <div class="row" > <div class="col-md-6"> <div class="chart-title"> <span>{{$t('Task status statistics')}}</span> </div> <div class="row"> <m-task-status-count :search-params="searchParams"> </m-task-status-count> </div> </div> <div class="col-md-6"> <div class="chart-title"> <span>{{$t('Process Status Statistics')}}</span> </div> <div class="row"> <m-process-state-count :search-params="searchParams"> </m-process-state-count> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="chart-title" style="margin-bottom: -20px;margin-top: 30px"> <span>{{$t('Process Definition Statistics')}}</span> </div> <div> <m-define-user-count :project-id="searchParams.projectId"> </m-define-user-count> </div> </div> </div> </div> </template> </m-list-construction> </template> <script> import dayjs from 'dayjs' import mDefineUserCount from './_source/defineUserCount' import mTaskStatusCount from './_source/taskStatusCount' import mProcessStateCount from './_source/processStateCount' import localStore from '@/module/util/localStorage' import mListConstruction from '@/module/components/listConstruction/listConstruction' export default { name: 'projects-index-index', data () { return { searchParams: { projectId: null, startDate: '', endDate: '' }, dataTime: [] } }, props: { id: Number }, methods: { _datepicker (val) { this.searchParams.startDate = val[0] this.searchParams.endDate = val[1] } }, created () { this.searchParams.projectId = this.id === 0 ? 0 : localStore.getItem('projectId') this.dataTime[0] = dayjs().format('YYYY-MM-DD 00:00:00') this.dataTime[1] = dayjs().format('YYYY-MM-DD HH:mm:ss') }, components: { mListConstruction, mDefineUserCount, mTaskStatusCount, mProcessStateCount } } </script> <style lang="scss" rel="stylesheet/scss"> .perject-home-content { padding: 10px 20px; position: relative; .time-model { position: absolute; right: 8px; top: -40px; .ans-input { >input { width: 344px; } } } .chart-title { text-align: center; height: 60px; line-height: 60px; span { font-size: 22px; color: #333; font-weight: bold; } } } .table-small-model { .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; } } </style>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,940
[Bug][UI] when upload a file to a directory in resource page,then call resources/list-paging error
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Go to Resources Center 2. Create a directory,then click into this dir 3. upload a file to the dir you created 4. use F12 debug page,see the call **http://xxxxxx:8888/dolphinscheduler/resources/list-paging** **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** ![微信图片_20210303153502.png](http://ww1.sinaimg.cn/large/005Cc2n2gy1go6r7ads75j316o0mj76y.jpg) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4940
https://github.com/apache/dolphinscheduler/pull/4941
53aedc50eca8bad176e1c9dfbec6d38b9c34cd4b
658a7f5661a3bee4f6bfb72d6981eb8d1c428e77
"2021-03-03T07:35:49Z"
java
"2021-03-03T12:37:35Z"
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/index.vue
/* * 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. */ <template> <div class="home-main list-construction-model"> <div class="content-title"> <a class="bread" style="padding-left: 15px;" @click="() => $router.push({path: `/resource/file`})">{{$t('File Manage')}}</a> <a class="bread" v-for="(item,$index) in breadList" :key="$index" @click="_ckOperation($index)">{{'>'+item}}</a> </div> <div class="conditions-box"> <m-conditions @on-conditions="_onConditions"> <template slot="button-group"> <el-button-group> <el-button size="mini" @click="() => $router.push({path: `/resource/file/subFileFolder/${searchParams.id}`})">{{$t('Create folder')}}</el-button> <el-button size="mini" @click="() => $router.push({path: `/resource/file/subFile/${searchParams.id}`})">{{$t('Create File')}}</el-button> <el-button size="mini" @click="_uploading">{{$t('Upload Files')}}</el-button> </el-button-group> </template> </m-conditions> </div> <div class="list-box"> <template v-if="fileResourcesList.length || total>0"> <m-list @on-update="_onUpdate" @on-updateList="_updateList" :file-resources-list="fileResourcesList" :page-no="searchParams.pageNo" :page-size="searchParams.pageSize"> </m-list> <div class="page-box"> <el-pagination background @current-change="_page" @size-change="_pageSize" :page-size="searchParams.pageSize" :current-page.sync="searchParams.pageNo" :page-sizes="[10, 30, 50]" layout="sizes, prev, pager, next, jumper" :total="total"> </el-pagination> </div> </template> <template v-if="!fileResourcesList.length && total<=0"> <m-no-data></m-no-data> </template> <m-spin :is-spin="isLoading" :is-left="isLeft"> </m-spin> </div> </div> </template> <script> import _ from 'lodash' import { mapActions } from 'vuex' import mList from './_source/list' import localStore from '@/module/util/localStorage' import mSpin from '@/module/components/spin/spin' import { findComponentDownward } from '@/module/util/' import mNoData from '@/module/components/noData/noData' import listUrlParamHandle from '@/module/mixin/listUrlParamHandle' import mConditions from '@/module/components/conditions/conditions' export default { name: 'resource-list-index-FILE', data () { return { total: null, isLoading: false, fileResourcesList: [], searchParams: { id: this.$route.params.id, pageSize: 10, pageNo: 1, searchVal: '', type: 'FILE' }, isLeft: true, breadList: [] } }, mixins: [listUrlParamHandle], props: {}, methods: { ...mapActions('resource', ['getResourcesListP', 'getResourceId']), /** * File Upload */ _uploading () { findComponentDownward(this.$root, 'roof-nav')._fileChildUpdate('FILE', this.searchParams.id) }, _onConditions (o) { this.searchParams = _.assign(this.searchParams, o) this.searchParams.pageNo = 1 }, _page (val) { this.searchParams.pageNo = val }, _pageSize (val) { this.searchParams.pageSize = val }, _getList (flag) { if (sessionStorage.getItem('isLeft') === 0) { this.isLeft = false } else { this.isLeft = true } this.isLoading = !flag this.getResourcesListP(this.searchParams).then(res => { if (this.searchParams.pageNo > 1 && res.totalList.length === 0) { this.searchParams.pageNo = this.searchParams.pageNo - 1 } else { this.fileResourcesList = res.totalList this.total = res.total this.isLoading = false } }).catch(e => { this.isLoading = false }) }, _updateList (data) { this.searchParams.id = data this.searchParams.pageNo = 1 this.searchParams.searchVal = '' this._debounceGET() }, _onUpdate () { this.searchParams.id = this.$route.params.id this._debounceGET() }, _ckOperation (index) { let breadName = '' this.breadList.forEach((item, i) => { if (i <= index) { breadName = breadName + '/' + item } }) this.transferApi(breadName) }, transferApi (api) { this.getResourceId({ type: 'FILE', fullName: api }).then(res => { localStore.setItem('currentDir', `${res.fullName}`) this.$router.push({ path: `/resource/file/subdirectory/${res.id}` }) }).catch(e => { this.$message.error(e.msg || '') }) } }, watch: { // router '$route' (a) { // url no params get instance list this.searchParams.pageNo = _.isEmpty(a.query) ? 1 : a.query.pageNo this.searchParams.id = a.params.id let dir = localStore.getItem('currentDir').split('/') dir.shift() this.breadList = dir } }, created () {}, mounted () { let dir = localStore.getItem('currentDir').split('/') dir.shift() this.breadList = dir }, beforeDestroy () { sessionStorage.setItem('isLeft', 1) }, components: { mConditions, mList, mSpin, mNoData } } </script> <style lang="scss" rel="stylesheet/scss"> .bread { font-size: 22px; padding-top: 10px; color: #2a455b; display: inline-block; cursor: pointer; } </style>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,837
Docker & K8s Improvement Plan
### 1.3.5-release Docker Improvement Plan - [x] Reduce image size - [x] Remove frontend/nginx - [x] Remove stdout log in properties - [x] improve compose/swarm deployment - [x] Fix random PSQLException - [x] Sync docker conf templates to the latest conf properties - [x] Update outdated readme K8s Improvement Plan - [x] Remove frontend/nginx - [x] Remove redundant configs - [x] Support resource storage when fs.defaultFS=file:/// - [x] Fix task log disappear after recreating or upgrading helm release - [x] Improve long host display in K8s - [x] Update outdated readme ### dev & 1.3.6-release Docker Improvement Plan - [x] Reduce image size - [x] Remove frontend/nginx - [x] Remove stdout log in properties - [x] improve compose/swarm deployment - [x] Fix random PSQLException - [x] Sync docker conf templates to the latest conf properties - [x] Update outdated readme - [x] Rename `WORKER_GROUP` to `WORKER_GROUPS` (#4843) - [x] Add FAQ support about MySQL and Oracle in readme (#4732 #4871) - [x] Add default login username and password in readme (#4881) - [x] Check compatibility in Windows (#4804) - [x] Fix invalid volume specification in Windows (#4886) - [x] Support supervisor management (#2687) - [x] Optimize log stdout with supervisor (#4897) - [x] Fix that can not build a docker image on Windows (#3124) - [x] Support docker compose file 3.1+ version - [x] Add tenant tip for quick start - [x] Sync the latest configs in master.properties and worker.properties - [x] Support all configs in common.properties - [x] Improve the environment variables and reduce the duplication configs - [x] Fix mysql check - [x] Add config.env.sh for docker compose and swarm - [x] Add `MASTER_SERVER_OPTS`, `WORKER_SERVER_OPTS`, `ALERT_SERVER_OPTS`, `API_SERVER_OPTS`, `LOGGER_SERVER_OPTS` - [x] Support skywalking config in docker - [x] Replace alpine with debian:slim (#5155) - [x] Remove redundant postgresql-client and mysql-client - [x] Add faq for python, spark, hadoop, flink and datax - [x] Add docs for support matrix on docker (#5068) - [x] Support task scalability on Docker such as Spark, Flink and DataX (#5100) K8s Improvement Plan - [x] Remove frontend/nginx - [x] Remove redundant configs - [x] Support resource storage when fs.defaultFS=file:/// - [x] Fix task log disappear after recreating or upgrading helm release - [x] Improve long host display in K8s - [x] Adapt to the latest alert-server with updated config and port 50052 - [x] Update outdated readme - [x] Rename `WORKER_GROUP` to `WORKER_GROUPS` (#4843) - [x] Add FAQ support about MySQL and Oracle in readme (#2584) - [x] Add FAQ support to use namespace, access ui and delete pv in readme - [x] Incorrect host problem in minikube (#4905) - [x] Check compatibility in all Kubernetes 1.12+ - [x] Support local docker image - [x] Optimize image pull secret - [x] Optimize fullname - [x] Optimize metadata name - [x] Sync the latest configs in master.properties and worker.properties - [x] Support all configs in common.properties - [x] Improve the environment variables and reduce the duplication configs - [x] Support skywalking config in k8s - [x] Unify annotations, affinity, nodeSelector, tolerations, resources and probe in K8s - [x] Support more service access like ClusterIP, NodePort and LoadBalancer - [x] Improve https tip in k8s - [x] Add `MASTER_SERVER_OPTS`, `WORKER_SERVER_OPTS`, `ALERT_SERVER_OPTS`, `API_SERVER_OPTS`, `LOGGER_SERVER_OPTS` - [x] Add faq for python, spark, hadoop, flink and datax - [x] Add docs for support matrix on k8s (#5068) - [x] Support task scalability on K8s such as Spark, Flink and DataX (#5100) - [x] Fix quartz cron task cannot take effect in K8s (#5351) - [x] Reduce long host and improve long host display on K8s
https://github.com/apache/dolphinscheduler/issues/4837
https://github.com/apache/dolphinscheduler/pull/4902
24fda3fbb1cdf4a58b519feb85e7613b15804dd2
4706de717ceb6d399aca1dbd683566ef8f97b578
"2021-02-22T07:30:35Z"
java
"2021-03-04T01:40:28Z"
docker/kubernetes/dolphinscheduler/README.md
# DolphinScheduler [DolphinScheduler](https://dolphinscheduler.apache.org) is a distributed and easy-to-expand visual DAG workflow scheduling system, dedicated to solving the complex dependencies in data processing, making the scheduling system out of the box for data processing. ## Introduction This chart bootstraps a [DolphinScheduler](https://dolphinscheduler.apache.org) distributed deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. ## Prerequisites - [Helm](https://helm.sh/) 3.1.0+ - [Kubernetes](https://kubernetes.io/) 1.12+ - PV provisioner support in the underlying infrastructure ## Installing the Chart To install the chart with the release name `dolphinscheduler`: ```bash $ git clone https://github.com/apache/incubator-dolphinscheduler.git $ cd incubator-dolphinscheduler/docker/kubernetes/dolphinscheduler $ helm repo add bitnami https://charts.bitnami.com/bitnami $ helm dependency update . $ helm install dolphinscheduler . ``` To install the chart with a namespace named `test`: ```bash $ helm install dolphinscheduler . -n test ``` > **Tip**: If a namespace named `test` is used, the option `-n test` needs to be added to the `helm` and `kubectl` command These commands deploy DolphinScheduler on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. > **Tip**: List all releases using `helm list` ## Access DolphinScheduler UI If `ingress.enabled` in `values.yaml` is set to `true`, you just access `http://${ingress.host}/dolphinscheduler` in browser. > **Tip**: If there is a problem with ingress access, please contact the Kubernetes administrator and refer to the [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) Otherwise, you need to execute port-forward command like: ```bash $ kubectl port-forward --address 0.0.0.0 svc/dolphinscheduler-api 12345:12345 $ kubectl port-forward --address 0.0.0.0 -n test svc/dolphinscheduler-api 12345:12345 # with test namespace ``` > **Tip**: If the error of `unable to do port forwarding: socat not found` appears, you need to install `socat` at first And then access the web: http://192.168.xx.xx:12345/dolphinscheduler The default username is `admin` and the default password is `dolphinscheduler123` ## Uninstalling the Chart To uninstall/delete the `dolphinscheduler` deployment: ```bash $ helm uninstall dolphinscheduler ``` The command removes all the Kubernetes components but PVC's associated with the chart and deletes the release. To delete the PVC's associated with `dolphinscheduler`: ```bash $ kubectl delete pvc -l app.kubernetes.io/instance=dolphinscheduler ``` > **Note**: Deleting the PVC's will delete all data as well. Please be cautious before doing it. ## Configuration The Configuration file is `values.yaml`, and the following tables lists the configurable parameters of the DolphinScheduler chart and their default values. | Parameter | Description | Default | | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------- | | `nameOverride` | String to partially override common.names.fullname | `nil` | | `fullnameOverride` | String to fully override common.names.fullname | `nil` | | `timezone` | World time and date for cities in all time zones | `Asia/Shanghai` | | `image.registry` | Docker image registry for the DolphinScheduler | `docker.io` | | `image.repository` | Docker image repository for the DolphinScheduler | `dolphinscheduler` | | `image.tag` | Docker image version for the DolphinScheduler | `latest` | | `image.pullPolicy` | Image pull policy. One of Always, Never, IfNotPresent | `IfNotPresent` | | `image.pullSecrets` | Image pull secrets. An optional list of references to secrets in the same namespace to use for pulling any of the images | `[]` | | | | | | `postgresql.enabled` | If not exists external PostgreSQL, by default, the DolphinScheduler will use a internal PostgreSQL | `true` | | `postgresql.postgresqlUsername` | The username for internal PostgreSQL | `root` | | `postgresql.postgresqlPassword` | The password for internal PostgreSQL | `root` | | `postgresql.postgresqlDatabase` | The database for internal PostgreSQL | `dolphinscheduler` | | `postgresql.persistence.enabled` | Set `postgresql.persistence.enabled` to `true` to mount a new volume for internal PostgreSQL | `false` | | `postgresql.persistence.size` | `PersistentVolumeClaim` Size | `20Gi` | | `postgresql.persistence.storageClass` | PostgreSQL data Persistent Volume Storage Class. If set to "-", storageClassName: "", which disables dynamic provisioning | `-` | | `externalDatabase.type` | If exists external PostgreSQL, and set `postgresql.enabled` value to false. DolphinScheduler's database type will use it | `postgresql` | | `externalDatabase.driver` | If exists external PostgreSQL, and set `postgresql.enabled` value to false. DolphinScheduler's database driver will use it | `org.postgresql.Driver` | | `externalDatabase.host` | If exists external PostgreSQL, and set `postgresql.enabled` value to false. DolphinScheduler's database host will use it | `localhost` | | `externalDatabase.port` | If exists external PostgreSQL, and set `postgresql.enabled` value to false. DolphinScheduler's database port will use it | `5432` | | `externalDatabase.username` | If exists external PostgreSQL, and set `postgresql.enabled` value to false. DolphinScheduler's database username will use it | `root` | | `externalDatabase.password` | If exists external PostgreSQL, and set `postgresql.enabled` value to false. DolphinScheduler's database password will use it | `root` | | `externalDatabase.database` | If exists external PostgreSQL, and set `postgresql.enabled` value to false. DolphinScheduler's database database will use it | `dolphinscheduler` | | `externalDatabase.params` | If exists external PostgreSQL, and set `postgresql.enabled` value to false. DolphinScheduler's database params will use it | `characterEncoding=utf8` | | | | | | `zookeeper.enabled` | If not exists external Zookeeper, by default, the DolphinScheduler will use a internal Zookeeper | `true` | | `zookeeper.fourlwCommandsWhitelist` | A list of comma separated Four Letter Words commands to use | `srvr,ruok,wchs,cons` | | `zookeeper.service.port` | ZooKeeper port | `2181` | | `zookeeper.persistence.enabled` | Set `zookeeper.persistence.enabled` to `true` to mount a new volume for internal Zookeeper | `false` | | `zookeeper.persistence.size` | `PersistentVolumeClaim` Size | `20Gi` | | `zookeeper.persistence.storageClass` | Zookeeper data Persistent Volume Storage Class. If set to "-", storageClassName: "", which disables dynamic provisioning | `-` | | `zookeeper.zookeeperRoot` | Specify dolphinscheduler root directory in Zookeeper | `/dolphinscheduler` | | `externalZookeeper.zookeeperQuorum` | If exists external Zookeeper, and set `zookeeper.enabled` value to false. Specify Zookeeper quorum | `127.0.0.1:2181` | | `externalZookeeper.zookeeperRoot` | If exists external Zookeeper, and set `zookeeper.enabled` value to false. Specify dolphinscheduler root directory in Zookeeper | `/dolphinscheduler` | | | | | | `common.configmap.DOLPHINSCHEDULER_ENV` | System env path, self configuration, please read `values.yaml` | `[]` | | `common.configmap.DOLPHINSCHEDULER_DATA_BASEDIR_PATH` | User data directory path, self configuration, please make sure the directory exists and have read write permissions | `/tmp/dolphinscheduler` | | `common.configmap.RESOURCE_STORAGE_TYPE` | Resource storage type: HDFS, S3, NONE | `HDFS` | | `common.configmap.RESOURCE_UPLOAD_PATH` | Resource store on HDFS/S3 path, please make sure the directory exists on hdfs and have read write permissions | `/dolphinscheduler` | | `common.configmap.FS_DEFAULT_FS` | Resource storage file system like `file:///`, `hdfs://mycluster:8020` or `s3a://dolphinscheduler` | `file:///` | | `common.configmap.FS_S3A_ENDPOINT` | S3 endpoint when `common.configmap.RESOURCE_STORAGE_TYPE` is set to `S3` | `s3.xxx.amazonaws.com` | | `common.configmap.FS_S3A_ACCESS_KEY` | S3 access key when `common.configmap.RESOURCE_STORAGE_TYPE` is set to `S3` | `xxxxxxx` | | `common.configmap.FS_S3A_SECRET_KEY` | S3 secret key when `common.configmap.RESOURCE_STORAGE_TYPE` is set to `S3` | `xxxxxxx` | | `common.fsFileResourcePersistence.enabled` | Set `common.fsFileResourcePersistence.enabled` to `true` to mount a new file resource volume for `api` and `worker` | `false` | | `common.fsFileResourcePersistence.accessModes` | `PersistentVolumeClaim` Access Modes, must be `ReadWriteMany` | `[ReadWriteMany]` | | `common.fsFileResourcePersistence.storageClassName` | Resource Persistent Volume Storage Class, must support the access mode: ReadWriteMany | `-` | | `common.fsFileResourcePersistence.storage` | `PersistentVolumeClaim` Size | `20Gi` | | | | | | `master.podManagementPolicy` | PodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down | `Parallel` | | `master.replicas` | Replicas is the desired number of replicas of the given Template | `3` | | `master.annotations` | The `annotations` for master server | `{}` | | `master.affinity` | If specified, the pod's scheduling constraints | `{}` | | `master.nodeSelector` | NodeSelector is a selector which must be true for the pod to fit on a node | `{}` | | `master.tolerations` | If specified, the pod's tolerations | `{}` | | `master.resources` | The `resource` limit and request config for master server | `{}` | | `master.configmap.DOLPHINSCHEDULER_OPTS` | The java options for master server | `""` | | `master.configmap.MASTER_EXEC_THREADS` | Master execute thread num | `100` | | `master.configmap.MASTER_EXEC_TASK_NUM` | Master execute task number in parallel | `20` | | `master.configmap.MASTER_HEARTBEAT_INTERVAL` | Master heartbeat interval | `10` | | `master.configmap.MASTER_TASK_COMMIT_RETRYTIMES` | Master commit task retry times | `5` | | `master.configmap.MASTER_TASK_COMMIT_INTERVAL` | Master commit task interval | `1000` | | `master.configmap.MASTER_MAX_CPULOAD_AVG` | Only less than cpu avg load, master server can work. default value : the number of cpu cores * 2 | `100` | | `master.configmap.MASTER_RESERVED_MEMORY` | Only larger than reserved memory, master server can work. default value : physical memory * 1/10, unit is G | `0.1` | | `master.configmap.MASTER_LISTEN_PORT` | Master listen port | `5678` | | `master.livenessProbe.enabled` | Turn on and off liveness probe | `true` | | `master.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `30` | | `master.livenessProbe.periodSeconds` | How often to perform the probe | `30` | | `master.livenessProbe.timeoutSeconds` | When the probe times out | `5` | | `master.livenessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `master.livenessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `master.readinessProbe.enabled` | Turn on and off readiness probe | `true` | | `master.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `30` | | `master.readinessProbe.periodSeconds` | How often to perform the probe | `30` | | `master.readinessProbe.timeoutSeconds` | When the probe times out | `5` | | `master.readinessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `master.readinessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `master.persistentVolumeClaim.enabled` | Set `master.persistentVolumeClaim.enabled` to `true` to mount a new volume for `master` | `false` | | `master.persistentVolumeClaim.accessModes` | `PersistentVolumeClaim` Access Modes | `[ReadWriteOnce]` | | `master.persistentVolumeClaim.storageClassName` | `Master` logs data Persistent Volume Storage Class. If set to "-", storageClassName: "", which disables dynamic provisioning | `-` | | `master.persistentVolumeClaim.storage` | `PersistentVolumeClaim` Size | `20Gi` | | | | | | `worker.podManagementPolicy` | PodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down | `Parallel` | | `worker.replicas` | Replicas is the desired number of replicas of the given Template | `3` | | `worker.annotations` | The `annotations` for worker server | `{}` | | `worker.affinity` | If specified, the pod's scheduling constraints | `{}` | | `worker.nodeSelector` | NodeSelector is a selector which must be true for the pod to fit on a node | `{}` | | `worker.tolerations` | If specified, the pod's tolerations | `{}` | | `worker.resources` | The `resource` limit and request config for worker server | `{}` | | `worker.configmap.DOLPHINSCHEDULER_OPTS` | The java options for worker server | `""` | | `worker.configmap.WORKER_EXEC_THREADS` | Worker execute thread num | `100` | | `worker.configmap.WORKER_HEARTBEAT_INTERVAL` | Worker heartbeat interval | `10` | | `worker.configmap.WORKER_MAX_CPULOAD_AVG` | Only less than cpu avg load, worker server can work. default value : the number of cpu cores * 2 | `100` | | `worker.configmap.WORKER_RESERVED_MEMORY` | Only larger than reserved memory, worker server can work. default value : physical memory * 1/10, unit is G | `0.1` | | `worker.configmap.WORKER_LISTEN_PORT` | Worker listen port | `1234` | | `worker.configmap.WORKER_GROUPS` | Worker groups | `default` | | `worker.configmap.WORKER_WEIGHT` | Worker weight | `100` | | `worker.livenessProbe.enabled` | Turn on and off liveness probe | `true` | | `worker.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `30` | | `worker.livenessProbe.periodSeconds` | How often to perform the probe | `30` | | `worker.livenessProbe.timeoutSeconds` | When the probe times out | `5` | | `worker.livenessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `worker.livenessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `worker.readinessProbe.enabled` | Turn on and off readiness probe | `true` | | `worker.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `30` | | `worker.readinessProbe.periodSeconds` | How often to perform the probe | `30` | | `worker.readinessProbe.timeoutSeconds` | When the probe times out | `5` | | `worker.readinessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `worker.readinessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `worker.persistentVolumeClaim.enabled` | Set `worker.persistentVolumeClaim.enabled` to `true` to enable `persistentVolumeClaim` for `worker` | `false` | | `worker.persistentVolumeClaim.dataPersistentVolume.enabled` | Set `worker.persistentVolumeClaim.dataPersistentVolume.enabled` to `true` to mount a data volume for `worker` | `false` | | `worker.persistentVolumeClaim.dataPersistentVolume.accessModes` | `PersistentVolumeClaim` Access Modes | `[ReadWriteOnce]` | | `worker.persistentVolumeClaim.dataPersistentVolume.storageClassName` | `Worker` data Persistent Volume Storage Class. If set to "-", storageClassName: "", which disables dynamic provisioning | `-` | | `worker.persistentVolumeClaim.dataPersistentVolume.storage` | `PersistentVolumeClaim` Size | `20Gi` | | `worker.persistentVolumeClaim.logsPersistentVolume.enabled` | Set `worker.persistentVolumeClaim.logsPersistentVolume.enabled` to `true` to mount a logs volume for `worker` | `false` | | `worker.persistentVolumeClaim.logsPersistentVolume.accessModes` | `PersistentVolumeClaim` Access Modes | `[ReadWriteOnce]` | | `worker.persistentVolumeClaim.logsPersistentVolume.storageClassName` | `Worker` logs data Persistent Volume Storage Class. If set to "-", storageClassName: "", which disables dynamic provisioning | `-` | | `worker.persistentVolumeClaim.logsPersistentVolume.storage` | `PersistentVolumeClaim` Size | `20Gi` | | | | | | `alert.replicas` | Replicas is the desired number of replicas of the given Template | `1` | | `alert.strategy.type` | Type of deployment. Can be "Recreate" or "RollingUpdate" | `RollingUpdate` | | `alert.strategy.rollingUpdate.maxSurge` | The maximum number of pods that can be scheduled above the desired number of pods | `25%` | | `alert.strategy.rollingUpdate.maxUnavailable` | The maximum number of pods that can be unavailable during the update | `25%` | | `alert.annotations` | The `annotations` for alert server | `{}` | | `alert.affinity` | If specified, the pod's scheduling constraints | `{}` | | `alert.nodeSelector` | NodeSelector is a selector which must be true for the pod to fit on a node | `{}` | | `alert.tolerations` | If specified, the pod's tolerations | `{}` | | `alert.resources` | The `resource` limit and request config for alert server | `{}` | | `alert.configmap.DOLPHINSCHEDULER_OPTS` | The java options for alert server | `""` | | `alert.configmap.ALERT_PLUGIN_DIR` | Alert plugin directory | `lib/plugin/alert` | | `alert.livenessProbe.enabled` | Turn on and off liveness probe | `true` | | `alert.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `30` | | `alert.livenessProbe.periodSeconds` | How often to perform the probe | `30` | | `alert.livenessProbe.timeoutSeconds` | When the probe times out | `5` | | `alert.livenessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `alert.livenessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `alert.readinessProbe.enabled` | Turn on and off readiness probe | `true` | | `alert.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `30` | | `alert.readinessProbe.periodSeconds` | How often to perform the probe | `30` | | `alert.readinessProbe.timeoutSeconds` | When the probe times out | `5` | | `alert.readinessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `alert.readinessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `alert.persistentVolumeClaim.enabled` | Set `alert.persistentVolumeClaim.enabled` to `true` to mount a new volume for `alert` | `false` | | `alert.persistentVolumeClaim.accessModes` | `PersistentVolumeClaim` Access Modes | `[ReadWriteOnce]` | | `alert.persistentVolumeClaim.storageClassName` | `Alert` logs data Persistent Volume Storage Class. If set to "-", storageClassName: "", which disables dynamic provisioning | `-` | | `alert.persistentVolumeClaim.storage` | `PersistentVolumeClaim` Size | `20Gi` | | | | | | `api.replicas` | Replicas is the desired number of replicas of the given Template | `1` | | `api.strategy.type` | Type of deployment. Can be "Recreate" or "RollingUpdate" | `RollingUpdate` | | `api.strategy.rollingUpdate.maxSurge` | The maximum number of pods that can be scheduled above the desired number of pods | `25%` | | `api.strategy.rollingUpdate.maxUnavailable` | The maximum number of pods that can be unavailable during the update | `25%` | | `api.annotations` | The `annotations` for api server | `{}` | | `api.affinity` | If specified, the pod's scheduling constraints | `{}` | | `api.nodeSelector` | NodeSelector is a selector which must be true for the pod to fit on a node | `{}` | | `api.tolerations` | If specified, the pod's tolerations | `{}` | | `api.resources` | The `resource` limit and request config for api server | `{}` | | `api.configmap.DOLPHINSCHEDULER_OPTS` | The java options for api server | `""` | | `api.livenessProbe.enabled` | Turn on and off liveness probe | `true` | | `api.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `30` | | `api.livenessProbe.periodSeconds` | How often to perform the probe | `30` | | `api.livenessProbe.timeoutSeconds` | When the probe times out | `5` | | `api.livenessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `api.livenessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `api.readinessProbe.enabled` | Turn on and off readiness probe | `true` | | `api.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `30` | | `api.readinessProbe.periodSeconds` | How often to perform the probe | `30` | | `api.readinessProbe.timeoutSeconds` | When the probe times out | `5` | | `api.readinessProbe.failureThreshold` | Minimum consecutive successes for the probe | `3` | | `api.readinessProbe.successThreshold` | Minimum consecutive failures for the probe | `1` | | `api.persistentVolumeClaim.enabled` | Set `api.persistentVolumeClaim.enabled` to `true` to mount a new volume for `api` | `false` | | `api.persistentVolumeClaim.accessModes` | `PersistentVolumeClaim` Access Modes | `[ReadWriteOnce]` | | `api.persistentVolumeClaim.storageClassName` | `api` logs data Persistent Volume Storage Class. If set to "-", storageClassName: "", which disables dynamic provisioning | `-` | | `api.persistentVolumeClaim.storage` | `PersistentVolumeClaim` Size | `20Gi` | | | | | | `ingress.enabled` | Enable ingress | `false` | | `ingress.host` | Ingress host | `dolphinscheduler.org` | | `ingress.path` | Ingress path | `/` | | `ingress.tls.enabled` | Enable ingress tls | `false` | | `ingress.tls.hosts` | Ingress tls hosts | `dolphinscheduler.org` | | `ingress.tls.secretName` | Ingress tls secret name | `dolphinscheduler-tls` | ## FAQ ### How to use MySQL as the DolphinScheduler's database instead of PostgreSQL? > Because of the commercial license, we cannot directly use the driver and client of MySQL. > > If you want to use MySQL, you can build a new image based on the `apache/dolphinscheduler` image as follows. 1. Download the MySQL driver [mysql-connector-java-5.1.49.jar](https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar) (require `>=5.1.47`) 2. Create a new `Dockerfile` to add MySQL driver and client: ``` FROM apache/dolphinscheduler:latest COPY mysql-connector-java-5.1.49.jar /opt/dolphinscheduler/lib RUN apk add --update --no-cache mysql-client ``` 3. Build a new docker image including MySQL driver and client: ``` docker build -t apache/dolphinscheduler:mysql . ``` 4. Push the docker image `apache/dolphinscheduler:mysql` to a docker registry 5. Modify image `registry` and `repository`, and update `tag` to `mysql` in `values.yaml` 6. Modify postgresql `enabled` to `false` 7. Modify externalDatabase (especially modify `host`, `username` and `password`): ``` externalDatabase: type: "mysql" driver: "com.mysql.jdbc.Driver" host: "localhost" port: "3306" username: "root" password: "root" database: "dolphinscheduler" params: "useUnicode=true&characterEncoding=UTF-8" ``` 8. Run a DolphinScheduler release in Kubernetes (See **Installing the Chart**) ### How to support MySQL datasource in `Datasource manage`? > Because of the commercial license, we cannot directly use the driver of MySQL. > > If you want to add MySQL datasource, you can build a new image based on the `apache/dolphinscheduler` image as follows. 1. Download the MySQL driver [mysql-connector-java-5.1.49.jar](https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar) (require `>=5.1.47`) 2. Create a new `Dockerfile` to add MySQL driver: ``` FROM apache/dolphinscheduler:latest COPY mysql-connector-java-5.1.49.jar /opt/dolphinscheduler/lib ``` 3. Build a new docker image including MySQL driver: ``` docker build -t apache/dolphinscheduler:mysql-driver . ``` 4. Push the docker image `apache/dolphinscheduler:mysql-driver` to a docker registry 5. Modify image `registry` and `repository`, and update `tag` to `mysql-driver` in `values.yaml` 6. Run a DolphinScheduler release in Kubernetes (See **Installing the Chart**) 7. Add a MySQL datasource in `Datasource manage` ### How to support Oracle datasource in `Datasource manage`? > Because of the commercial license, we cannot directly use the driver of Oracle. > > If you want to add Oracle datasource, you can build a new image based on the `apache/dolphinscheduler` image as follows. 1. Download the Oracle driver [ojdbc8.jar](https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc8/) (such as `ojdbc8-19.9.0.0.jar`) 2. Create a new `Dockerfile` to add Oracle driver: ``` FROM apache/dolphinscheduler:latest COPY ojdbc8-19.9.0.0.jar /opt/dolphinscheduler/lib ``` 3. Build a new docker image including Oracle driver: ``` docker build -t apache/dolphinscheduler:oracle-driver . ``` 4. Push the docker image `apache/dolphinscheduler:oracle-driver` to a docker registry 5. Modify image `registry` and `repository`, and update `tag` to `oracle-driver` in `values.yaml` 6. Run a DolphinScheduler release in Kubernetes (See **Installing the Chart**) 7. Add a Oracle datasource in `Datasource manage` For more information please refer to the [incubator-dolphinscheduler](https://github.com/apache/incubator-dolphinscheduler.git) documentation.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,837
Docker & K8s Improvement Plan
### 1.3.5-release Docker Improvement Plan - [x] Reduce image size - [x] Remove frontend/nginx - [x] Remove stdout log in properties - [x] improve compose/swarm deployment - [x] Fix random PSQLException - [x] Sync docker conf templates to the latest conf properties - [x] Update outdated readme K8s Improvement Plan - [x] Remove frontend/nginx - [x] Remove redundant configs - [x] Support resource storage when fs.defaultFS=file:/// - [x] Fix task log disappear after recreating or upgrading helm release - [x] Improve long host display in K8s - [x] Update outdated readme ### dev & 1.3.6-release Docker Improvement Plan - [x] Reduce image size - [x] Remove frontend/nginx - [x] Remove stdout log in properties - [x] improve compose/swarm deployment - [x] Fix random PSQLException - [x] Sync docker conf templates to the latest conf properties - [x] Update outdated readme - [x] Rename `WORKER_GROUP` to `WORKER_GROUPS` (#4843) - [x] Add FAQ support about MySQL and Oracle in readme (#4732 #4871) - [x] Add default login username and password in readme (#4881) - [x] Check compatibility in Windows (#4804) - [x] Fix invalid volume specification in Windows (#4886) - [x] Support supervisor management (#2687) - [x] Optimize log stdout with supervisor (#4897) - [x] Fix that can not build a docker image on Windows (#3124) - [x] Support docker compose file 3.1+ version - [x] Add tenant tip for quick start - [x] Sync the latest configs in master.properties and worker.properties - [x] Support all configs in common.properties - [x] Improve the environment variables and reduce the duplication configs - [x] Fix mysql check - [x] Add config.env.sh for docker compose and swarm - [x] Add `MASTER_SERVER_OPTS`, `WORKER_SERVER_OPTS`, `ALERT_SERVER_OPTS`, `API_SERVER_OPTS`, `LOGGER_SERVER_OPTS` - [x] Support skywalking config in docker - [x] Replace alpine with debian:slim (#5155) - [x] Remove redundant postgresql-client and mysql-client - [x] Add faq for python, spark, hadoop, flink and datax - [x] Add docs for support matrix on docker (#5068) - [x] Support task scalability on Docker such as Spark, Flink and DataX (#5100) K8s Improvement Plan - [x] Remove frontend/nginx - [x] Remove redundant configs - [x] Support resource storage when fs.defaultFS=file:/// - [x] Fix task log disappear after recreating or upgrading helm release - [x] Improve long host display in K8s - [x] Adapt to the latest alert-server with updated config and port 50052 - [x] Update outdated readme - [x] Rename `WORKER_GROUP` to `WORKER_GROUPS` (#4843) - [x] Add FAQ support about MySQL and Oracle in readme (#2584) - [x] Add FAQ support to use namespace, access ui and delete pv in readme - [x] Incorrect host problem in minikube (#4905) - [x] Check compatibility in all Kubernetes 1.12+ - [x] Support local docker image - [x] Optimize image pull secret - [x] Optimize fullname - [x] Optimize metadata name - [x] Sync the latest configs in master.properties and worker.properties - [x] Support all configs in common.properties - [x] Improve the environment variables and reduce the duplication configs - [x] Support skywalking config in k8s - [x] Unify annotations, affinity, nodeSelector, tolerations, resources and probe in K8s - [x] Support more service access like ClusterIP, NodePort and LoadBalancer - [x] Improve https tip in k8s - [x] Add `MASTER_SERVER_OPTS`, `WORKER_SERVER_OPTS`, `ALERT_SERVER_OPTS`, `API_SERVER_OPTS`, `LOGGER_SERVER_OPTS` - [x] Add faq for python, spark, hadoop, flink and datax - [x] Add docs for support matrix on k8s (#5068) - [x] Support task scalability on K8s such as Spark, Flink and DataX (#5100) - [x] Fix quartz cron task cannot take effect in K8s (#5351) - [x] Reduce long host and improve long host display on K8s
https://github.com/apache/dolphinscheduler/issues/4837
https://github.com/apache/dolphinscheduler/pull/4902
24fda3fbb1cdf4a58b519feb85e7613b15804dd2
4706de717ceb6d399aca1dbd683566ef8f97b578
"2021-02-22T07:30:35Z"
java
"2021-03-04T01:40:28Z"
docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml
# # 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. # apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "dolphinscheduler.fullname" . }}-api labels: app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: api spec: replicas: {{ .Values.api.replicas }} selector: matchLabels: app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: api strategy: type: {{ .Values.api.strategy.type | quote }} rollingUpdate: maxSurge: {{ .Values.api.strategy.rollingUpdate.maxSurge | quote }} maxUnavailable: {{ .Values.api.strategy.rollingUpdate.maxUnavailable | quote }} template: metadata: labels: app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: api {{- if .Values.alert.annotations }} annotations: {{- toYaml .Values.alert.annotations | nindent 8 }} {{- end }} spec: {{- if .Values.api.affinity }} affinity: {{- toYaml .Values.api.affinity | nindent 8 }} {{- end }} {{- if .Values.api.nodeSelector }} nodeSelector: {{- toYaml .Values.api.nodeSelector | nindent 8 }} {{- end }} {{- if .Values.api.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- if .Values.image.pullSecrets }} imagePullSecrets: - name: {{ include "dolphinscheduler.image.pullSecrets" . }} {{- end }} containers: - name: {{ include "dolphinscheduler.fullname" . }}-api image: {{ include "dolphinscheduler.image.repository" . | quote }} imagePullPolicy: {{ .Values.image.pullPolicy }} args: - "api-server" ports: - containerPort: 12345 name: tcp-port env: - name: TZ value: {{ .Values.timezone }} - name: DOLPHINSCHEDULER_OPTS valueFrom: configMapKeyRef: key: DOLPHINSCHEDULER_OPTS name: {{ include "dolphinscheduler.fullname" . }}-api - name: DATABASE_TYPE {{- if .Values.postgresql.enabled }} value: "postgresql" {{- else }} value: {{ .Values.externalDatabase.type | quote }} {{- end }} - name: DATABASE_DRIVER {{- if .Values.postgresql.enabled }} value: "org.postgresql.Driver" {{- else }} value: {{ .Values.externalDatabase.driver | quote }} {{- end }} - name: DATABASE_HOST {{- if .Values.postgresql.enabled }} value: {{ template "dolphinscheduler.postgresql.fullname" . }} {{- else }} value: {{ .Values.externalDatabase.host | quote }} {{- end }} - name: DATABASE_PORT {{- if .Values.postgresql.enabled }} value: "5432" {{- else }} value: {{ .Values.externalDatabase.port | quote }} {{- end }} - name: DATABASE_USERNAME {{- if .Values.postgresql.enabled }} value: {{ .Values.postgresql.postgresqlUsername }} {{- else }} value: {{ .Values.externalDatabase.username | quote }} {{- end }} - name: DATABASE_PASSWORD valueFrom: secretKeyRef: {{- if .Values.postgresql.enabled }} name: {{ template "dolphinscheduler.postgresql.fullname" . }} key: postgresql-password {{- else }} name: {{ printf "%s-%s" .Release.Name "externaldb" }} key: db-password {{- end }} - name: DATABASE_DATABASE {{- if .Values.postgresql.enabled }} value: {{ .Values.postgresql.postgresqlDatabase }} {{- else }} value: {{ .Values.externalDatabase.database | quote }} {{- end }} - name: DATABASE_PARAMS {{- if .Values.postgresql.enabled }} value: "characterEncoding=utf8" {{- else }} value: {{ .Values.externalDatabase.params | quote }} {{- end }} - name: ZOOKEEPER_QUORUM {{- if .Values.zookeeper.enabled }} value: "{{ template "dolphinscheduler.zookeeper.quorum" . }}" {{- else }} value: {{ .Values.externalZookeeper.zookeeperQuorum }} {{- end }} - name: ZOOKEEPER_ROOT {{- if .Values.zookeeper.enabled }} value: {{ .Values.zookeeper.zookeeperRoot }} {{- else }} value: {{ .Values.externalZookeeper.zookeeperRoot }} {{- end }} - name: RESOURCE_STORAGE_TYPE valueFrom: configMapKeyRef: key: RESOURCE_STORAGE_TYPE name: {{ include "dolphinscheduler.fullname" . }}-common - name: RESOURCE_UPLOAD_PATH valueFrom: configMapKeyRef: key: RESOURCE_UPLOAD_PATH name: {{ include "dolphinscheduler.fullname" . }}-common - name: FS_DEFAULT_FS valueFrom: configMapKeyRef: key: FS_DEFAULT_FS name: {{ include "dolphinscheduler.fullname" . }}-common {{- if eq .Values.common.configmap.RESOURCE_STORAGE_TYPE "S3" }} - name: FS_S3A_ENDPOINT valueFrom: configMapKeyRef: key: FS_S3A_ENDPOINT name: {{ include "dolphinscheduler.fullname" . }}-common - name: FS_S3A_ACCESS_KEY valueFrom: configMapKeyRef: key: FS_S3A_ACCESS_KEY name: {{ include "dolphinscheduler.fullname" . }}-common - name: FS_S3A_SECRET_KEY valueFrom: secretKeyRef: key: fs-s3a-secret-key name: {{ printf "%s-%s" .Release.Name "fs-s3a" }} {{- end }} {{- if .Values.api.resources }} resources: limits: memory: {{ .Values.api.resources.limits.memory | quote }} cpu: {{ .Values.api.resources.limits.cpu | quote }} requests: memory: {{ .Values.api.resources.requests.memory | quote }} cpu: {{ .Values.api.resources.requests.cpu | quote }} {{- end }} {{- if .Values.api.livenessProbe.enabled }} livenessProbe: tcpSocket: port: 12345 initialDelaySeconds: {{ .Values.api.livenessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.api.livenessProbe.periodSeconds }} timeoutSeconds: {{ .Values.api.livenessProbe.timeoutSeconds }} successThreshold: {{ .Values.api.livenessProbe.successThreshold }} failureThreshold: {{ .Values.api.livenessProbe.failureThreshold }} {{- end }} {{- if .Values.api.readinessProbe.enabled }} readinessProbe: tcpSocket: port: 12345 initialDelaySeconds: {{ .Values.api.readinessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.api.readinessProbe.periodSeconds }} timeoutSeconds: {{ .Values.api.readinessProbe.timeoutSeconds }} successThreshold: {{ .Values.api.readinessProbe.successThreshold }} failureThreshold: {{ .Values.api.readinessProbe.failureThreshold }} {{- end }} volumeMounts: - mountPath: "/opt/dolphinscheduler/logs" name: {{ include "dolphinscheduler.fullname" . }}-api {{- if .Values.common.fsFileResourcePersistence.enabled }} - mountPath: {{ .Values.common.configmap.RESOURCE_UPLOAD_PATH | quote }} name: {{ include "dolphinscheduler.fullname" . }}-fs-file {{- end }} volumes: - name: {{ include "dolphinscheduler.fullname" . }}-api {{- if .Values.api.persistentVolumeClaim.enabled }} persistentVolumeClaim: claimName: {{ include "dolphinscheduler.fullname" . }}-api {{- else }} emptyDir: {} {{- end }} {{- if .Values.common.fsFileResourcePersistence.enabled }} - name: {{ include "dolphinscheduler.fullname" . }}-fs-file persistentVolumeClaim: claimName: {{ include "dolphinscheduler.fullname" . }}-fs-file {{- end }}
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,837
Docker & K8s Improvement Plan
### 1.3.5-release Docker Improvement Plan - [x] Reduce image size - [x] Remove frontend/nginx - [x] Remove stdout log in properties - [x] improve compose/swarm deployment - [x] Fix random PSQLException - [x] Sync docker conf templates to the latest conf properties - [x] Update outdated readme K8s Improvement Plan - [x] Remove frontend/nginx - [x] Remove redundant configs - [x] Support resource storage when fs.defaultFS=file:/// - [x] Fix task log disappear after recreating or upgrading helm release - [x] Improve long host display in K8s - [x] Update outdated readme ### dev & 1.3.6-release Docker Improvement Plan - [x] Reduce image size - [x] Remove frontend/nginx - [x] Remove stdout log in properties - [x] improve compose/swarm deployment - [x] Fix random PSQLException - [x] Sync docker conf templates to the latest conf properties - [x] Update outdated readme - [x] Rename `WORKER_GROUP` to `WORKER_GROUPS` (#4843) - [x] Add FAQ support about MySQL and Oracle in readme (#4732 #4871) - [x] Add default login username and password in readme (#4881) - [x] Check compatibility in Windows (#4804) - [x] Fix invalid volume specification in Windows (#4886) - [x] Support supervisor management (#2687) - [x] Optimize log stdout with supervisor (#4897) - [x] Fix that can not build a docker image on Windows (#3124) - [x] Support docker compose file 3.1+ version - [x] Add tenant tip for quick start - [x] Sync the latest configs in master.properties and worker.properties - [x] Support all configs in common.properties - [x] Improve the environment variables and reduce the duplication configs - [x] Fix mysql check - [x] Add config.env.sh for docker compose and swarm - [x] Add `MASTER_SERVER_OPTS`, `WORKER_SERVER_OPTS`, `ALERT_SERVER_OPTS`, `API_SERVER_OPTS`, `LOGGER_SERVER_OPTS` - [x] Support skywalking config in docker - [x] Replace alpine with debian:slim (#5155) - [x] Remove redundant postgresql-client and mysql-client - [x] Add faq for python, spark, hadoop, flink and datax - [x] Add docs for support matrix on docker (#5068) - [x] Support task scalability on Docker such as Spark, Flink and DataX (#5100) K8s Improvement Plan - [x] Remove frontend/nginx - [x] Remove redundant configs - [x] Support resource storage when fs.defaultFS=file:/// - [x] Fix task log disappear after recreating or upgrading helm release - [x] Improve long host display in K8s - [x] Adapt to the latest alert-server with updated config and port 50052 - [x] Update outdated readme - [x] Rename `WORKER_GROUP` to `WORKER_GROUPS` (#4843) - [x] Add FAQ support about MySQL and Oracle in readme (#2584) - [x] Add FAQ support to use namespace, access ui and delete pv in readme - [x] Incorrect host problem in minikube (#4905) - [x] Check compatibility in all Kubernetes 1.12+ - [x] Support local docker image - [x] Optimize image pull secret - [x] Optimize fullname - [x] Optimize metadata name - [x] Sync the latest configs in master.properties and worker.properties - [x] Support all configs in common.properties - [x] Improve the environment variables and reduce the duplication configs - [x] Support skywalking config in k8s - [x] Unify annotations, affinity, nodeSelector, tolerations, resources and probe in K8s - [x] Support more service access like ClusterIP, NodePort and LoadBalancer - [x] Improve https tip in k8s - [x] Add `MASTER_SERVER_OPTS`, `WORKER_SERVER_OPTS`, `ALERT_SERVER_OPTS`, `API_SERVER_OPTS`, `LOGGER_SERVER_OPTS` - [x] Add faq for python, spark, hadoop, flink and datax - [x] Add docs for support matrix on k8s (#5068) - [x] Support task scalability on K8s such as Spark, Flink and DataX (#5100) - [x] Fix quartz cron task cannot take effect in K8s (#5351) - [x] Reduce long host and improve long host display on K8s
https://github.com/apache/dolphinscheduler/issues/4837
https://github.com/apache/dolphinscheduler/pull/4902
24fda3fbb1cdf4a58b519feb85e7613b15804dd2
4706de717ceb6d399aca1dbd683566ef8f97b578
"2021-02-22T07:30:35Z"
java
"2021-03-04T01:40:28Z"
docker/kubernetes/dolphinscheduler/templates/ingress.yaml
# # 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. # {{- if .Values.ingress.enabled }} apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: {{ include "dolphinscheduler.fullname" . }} labels: app.kubernetes.io/name: {{ include "dolphinscheduler.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} spec: rules: - host: {{ .Values.ingress.host }} http: paths: - path: {{ .Values.ingress.path }} backend: serviceName: {{ include "dolphinscheduler.fullname" . }}-api servicePort: tcp-port {{- if .Values.ingress.tls.enabled }} tls: hosts: {{- range .Values.ingress.tls.hosts }} - {{ . | quote }} {{- end }} secretName: {{ .Values.ingress.tls.secretName }} {{- end }} {{- end }}
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,837
Docker & K8s Improvement Plan
### 1.3.5-release Docker Improvement Plan - [x] Reduce image size - [x] Remove frontend/nginx - [x] Remove stdout log in properties - [x] improve compose/swarm deployment - [x] Fix random PSQLException - [x] Sync docker conf templates to the latest conf properties - [x] Update outdated readme K8s Improvement Plan - [x] Remove frontend/nginx - [x] Remove redundant configs - [x] Support resource storage when fs.defaultFS=file:/// - [x] Fix task log disappear after recreating or upgrading helm release - [x] Improve long host display in K8s - [x] Update outdated readme ### dev & 1.3.6-release Docker Improvement Plan - [x] Reduce image size - [x] Remove frontend/nginx - [x] Remove stdout log in properties - [x] improve compose/swarm deployment - [x] Fix random PSQLException - [x] Sync docker conf templates to the latest conf properties - [x] Update outdated readme - [x] Rename `WORKER_GROUP` to `WORKER_GROUPS` (#4843) - [x] Add FAQ support about MySQL and Oracle in readme (#4732 #4871) - [x] Add default login username and password in readme (#4881) - [x] Check compatibility in Windows (#4804) - [x] Fix invalid volume specification in Windows (#4886) - [x] Support supervisor management (#2687) - [x] Optimize log stdout with supervisor (#4897) - [x] Fix that can not build a docker image on Windows (#3124) - [x] Support docker compose file 3.1+ version - [x] Add tenant tip for quick start - [x] Sync the latest configs in master.properties and worker.properties - [x] Support all configs in common.properties - [x] Improve the environment variables and reduce the duplication configs - [x] Fix mysql check - [x] Add config.env.sh for docker compose and swarm - [x] Add `MASTER_SERVER_OPTS`, `WORKER_SERVER_OPTS`, `ALERT_SERVER_OPTS`, `API_SERVER_OPTS`, `LOGGER_SERVER_OPTS` - [x] Support skywalking config in docker - [x] Replace alpine with debian:slim (#5155) - [x] Remove redundant postgresql-client and mysql-client - [x] Add faq for python, spark, hadoop, flink and datax - [x] Add docs for support matrix on docker (#5068) - [x] Support task scalability on Docker such as Spark, Flink and DataX (#5100) K8s Improvement Plan - [x] Remove frontend/nginx - [x] Remove redundant configs - [x] Support resource storage when fs.defaultFS=file:/// - [x] Fix task log disappear after recreating or upgrading helm release - [x] Improve long host display in K8s - [x] Adapt to the latest alert-server with updated config and port 50052 - [x] Update outdated readme - [x] Rename `WORKER_GROUP` to `WORKER_GROUPS` (#4843) - [x] Add FAQ support about MySQL and Oracle in readme (#2584) - [x] Add FAQ support to use namespace, access ui and delete pv in readme - [x] Incorrect host problem in minikube (#4905) - [x] Check compatibility in all Kubernetes 1.12+ - [x] Support local docker image - [x] Optimize image pull secret - [x] Optimize fullname - [x] Optimize metadata name - [x] Sync the latest configs in master.properties and worker.properties - [x] Support all configs in common.properties - [x] Improve the environment variables and reduce the duplication configs - [x] Support skywalking config in k8s - [x] Unify annotations, affinity, nodeSelector, tolerations, resources and probe in K8s - [x] Support more service access like ClusterIP, NodePort and LoadBalancer - [x] Improve https tip in k8s - [x] Add `MASTER_SERVER_OPTS`, `WORKER_SERVER_OPTS`, `ALERT_SERVER_OPTS`, `API_SERVER_OPTS`, `LOGGER_SERVER_OPTS` - [x] Add faq for python, spark, hadoop, flink and datax - [x] Add docs for support matrix on k8s (#5068) - [x] Support task scalability on K8s such as Spark, Flink and DataX (#5100) - [x] Fix quartz cron task cannot take effect in K8s (#5351) - [x] Reduce long host and improve long host display on K8s
https://github.com/apache/dolphinscheduler/issues/4837
https://github.com/apache/dolphinscheduler/pull/4902
24fda3fbb1cdf4a58b519feb85e7613b15804dd2
4706de717ceb6d399aca1dbd683566ef8f97b578
"2021-02-22T07:30:35Z"
java
"2021-03-04T01:40:28Z"
docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-api.yaml
# # 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. # apiVersion: v1 kind: Service metadata: name: {{ include "dolphinscheduler.fullname" . }}-api labels: app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} spec: ports: - port: 12345 targetPort: tcp-port protocol: TCP name: tcp-port selector: app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: api
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,837
Docker & K8s Improvement Plan
### 1.3.5-release Docker Improvement Plan - [x] Reduce image size - [x] Remove frontend/nginx - [x] Remove stdout log in properties - [x] improve compose/swarm deployment - [x] Fix random PSQLException - [x] Sync docker conf templates to the latest conf properties - [x] Update outdated readme K8s Improvement Plan - [x] Remove frontend/nginx - [x] Remove redundant configs - [x] Support resource storage when fs.defaultFS=file:/// - [x] Fix task log disappear after recreating or upgrading helm release - [x] Improve long host display in K8s - [x] Update outdated readme ### dev & 1.3.6-release Docker Improvement Plan - [x] Reduce image size - [x] Remove frontend/nginx - [x] Remove stdout log in properties - [x] improve compose/swarm deployment - [x] Fix random PSQLException - [x] Sync docker conf templates to the latest conf properties - [x] Update outdated readme - [x] Rename `WORKER_GROUP` to `WORKER_GROUPS` (#4843) - [x] Add FAQ support about MySQL and Oracle in readme (#4732 #4871) - [x] Add default login username and password in readme (#4881) - [x] Check compatibility in Windows (#4804) - [x] Fix invalid volume specification in Windows (#4886) - [x] Support supervisor management (#2687) - [x] Optimize log stdout with supervisor (#4897) - [x] Fix that can not build a docker image on Windows (#3124) - [x] Support docker compose file 3.1+ version - [x] Add tenant tip for quick start - [x] Sync the latest configs in master.properties and worker.properties - [x] Support all configs in common.properties - [x] Improve the environment variables and reduce the duplication configs - [x] Fix mysql check - [x] Add config.env.sh for docker compose and swarm - [x] Add `MASTER_SERVER_OPTS`, `WORKER_SERVER_OPTS`, `ALERT_SERVER_OPTS`, `API_SERVER_OPTS`, `LOGGER_SERVER_OPTS` - [x] Support skywalking config in docker - [x] Replace alpine with debian:slim (#5155) - [x] Remove redundant postgresql-client and mysql-client - [x] Add faq for python, spark, hadoop, flink and datax - [x] Add docs for support matrix on docker (#5068) - [x] Support task scalability on Docker such as Spark, Flink and DataX (#5100) K8s Improvement Plan - [x] Remove frontend/nginx - [x] Remove redundant configs - [x] Support resource storage when fs.defaultFS=file:/// - [x] Fix task log disappear after recreating or upgrading helm release - [x] Improve long host display in K8s - [x] Adapt to the latest alert-server with updated config and port 50052 - [x] Update outdated readme - [x] Rename `WORKER_GROUP` to `WORKER_GROUPS` (#4843) - [x] Add FAQ support about MySQL and Oracle in readme (#2584) - [x] Add FAQ support to use namespace, access ui and delete pv in readme - [x] Incorrect host problem in minikube (#4905) - [x] Check compatibility in all Kubernetes 1.12+ - [x] Support local docker image - [x] Optimize image pull secret - [x] Optimize fullname - [x] Optimize metadata name - [x] Sync the latest configs in master.properties and worker.properties - [x] Support all configs in common.properties - [x] Improve the environment variables and reduce the duplication configs - [x] Support skywalking config in k8s - [x] Unify annotations, affinity, nodeSelector, tolerations, resources and probe in K8s - [x] Support more service access like ClusterIP, NodePort and LoadBalancer - [x] Improve https tip in k8s - [x] Add `MASTER_SERVER_OPTS`, `WORKER_SERVER_OPTS`, `ALERT_SERVER_OPTS`, `API_SERVER_OPTS`, `LOGGER_SERVER_OPTS` - [x] Add faq for python, spark, hadoop, flink and datax - [x] Add docs for support matrix on k8s (#5068) - [x] Support task scalability on K8s such as Spark, Flink and DataX (#5100) - [x] Fix quartz cron task cannot take effect in K8s (#5351) - [x] Reduce long host and improve long host display on K8s
https://github.com/apache/dolphinscheduler/issues/4837
https://github.com/apache/dolphinscheduler/pull/4902
24fda3fbb1cdf4a58b519feb85e7613b15804dd2
4706de717ceb6d399aca1dbd683566ef8f97b578
"2021-02-22T07:30:35Z"
java
"2021-03-04T01:40:28Z"
docker/kubernetes/dolphinscheduler/values.yaml
# # 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. # # Default values for dolphinscheduler-chart. # This is a YAML-formatted file. # Declare variables to be passed into your templates. nameOverride: "" fullnameOverride: "" timezone: "Asia/Shanghai" image: registry: "apache" repository: "dolphinscheduler" tag: "latest" pullPolicy: "IfNotPresent" pullSecrets: [] # If not exists external database, by default, Dolphinscheduler's database will use it. postgresql: enabled: true postgresqlUsername: "root" postgresqlPassword: "root" postgresqlDatabase: "dolphinscheduler" persistence: enabled: false size: "20Gi" storageClass: "-" # If exists external database, and set postgresql.enable value to false. # external database will be used, otherwise Dolphinscheduler's database will be used. externalDatabase: type: "postgresql" driver: "org.postgresql.Driver" host: "localhost" port: "5432" username: "root" password: "root" database: "dolphinscheduler" # multi params should join with & char params: "characterEncoding=utf8" # If not exists external zookeeper, by default, Dolphinscheduler's zookeeper will use it. zookeeper: enabled: true fourlwCommandsWhitelist: srvr,ruok,wchs,cons service: port: "2181" persistence: enabled: false size: "20Gi" storageClass: "-" zookeeperRoot: "/dolphinscheduler" # If exists external zookeeper, and set zookeeper.enable value to false. # If zookeeper.enable is false, Dolphinscheduler's zookeeper will use it. externalZookeeper: zookeeperQuorum: "127.0.0.1:2181" zookeeperRoot: "/dolphinscheduler" common: ## ConfigMap configmap: DOLPHINSCHEDULER_ENV: - "export HADOOP_HOME=/opt/soft/hadoop" - "export HADOOP_CONF_DIR=/opt/soft/hadoop/etc/hadoop" - "export SPARK_HOME1=/opt/soft/spark1" - "export SPARK_HOME2=/opt/soft/spark2" - "export PYTHON_HOME=/usr/bin/python" - "export JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk" - "export HIVE_HOME=/opt/soft/hive" - "export FLINK_HOME=/opt/soft/flink" - "export DATAX_HOME=/opt/soft/datax/bin/datax.py" - "export PATH=$HADOOP_HOME/bin:$SPARK_HOME1/bin:$SPARK_HOME2/bin:$PYTHON_HOME:$JAVA_HOME/bin:$HIVE_HOME/bin:$FLINK_HOME/bin:$PATH" DOLPHINSCHEDULER_DATA_BASEDIR_PATH: "/tmp/dolphinscheduler" RESOURCE_STORAGE_TYPE: "HDFS" RESOURCE_UPLOAD_PATH: "/dolphinscheduler" FS_DEFAULT_FS: "file:///" FS_S3A_ENDPOINT: "s3.xxx.amazonaws.com" FS_S3A_ACCESS_KEY: "xxxxxxx" FS_S3A_SECRET_KEY: "xxxxxxx" ## If RESOURCE_STORAGE_TYPE is HDFS and FS_DEFAULT_FS is file:///, fsFileResourcePersistence should be enabled for resource storage fsFileResourcePersistence: enabled: false accessModes: - "ReadWriteMany" ## storageClassName must support the access mode: ReadWriteMany storageClassName: "-" storage: "20Gi" master: ## PodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. podManagementPolicy: "Parallel" ## Replicas is the desired number of replicas of the given Template. replicas: "3" ## You can use annotations to attach arbitrary non-identifying metadata to objects. ## Clients such as tools and libraries can retrieve this metadata. annotations: {} ## Affinity is a group of affinity scheduling rules. If specified, the pod's scheduling constraints. ## More info: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#affinity-v1-core affinity: {} ## NodeSelector is a selector which must be true for the pod to fit on a node. ## Selector which must match a node's labels for the pod to be scheduled on that node. ## More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ nodeSelector: {} ## Tolerations are appended (excluding duplicates) to pods running with this RuntimeClass during admission, ## effectively unioning the set of nodes tolerated by the pod and the RuntimeClass. tolerations: [] ## Compute Resources required by this container. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container resources: {} # resources: # limits: # memory: "8Gi" # cpu: "4" # requests: # memory: "2Gi" # cpu: "500m" ## ConfigMap configmap: DOLPHINSCHEDULER_OPTS: "" MASTER_EXEC_THREADS: "100" MASTER_EXEC_TASK_NUM: "20" MASTER_HEARTBEAT_INTERVAL: "10" MASTER_TASK_COMMIT_RETRYTIMES: "5" MASTER_TASK_COMMIT_INTERVAL: "1000" MASTER_MAX_CPULOAD_AVG: "100" MASTER_RESERVED_MEMORY: "0.1" MASTER_LISTEN_PORT: "5678" ## Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes livenessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes readinessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## PersistentVolumeClaim represents a reference to a PersistentVolumeClaim in the same namespace. ## The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. ## Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. ## A claim in this list takes precedence over any volumes in the template, with the same name. persistentVolumeClaim: enabled: false accessModes: - "ReadWriteOnce" storageClassName: "-" storage: "20Gi" worker: ## PodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. podManagementPolicy: "Parallel" ## Replicas is the desired number of replicas of the given Template. replicas: "3" ## You can use annotations to attach arbitrary non-identifying metadata to objects. ## Clients such as tools and libraries can retrieve this metadata. annotations: {} ## Affinity is a group of affinity scheduling rules. If specified, the pod's scheduling constraints. ## More info: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#affinity-v1-core affinity: {} ## NodeSelector is a selector which must be true for the pod to fit on a node. ## Selector which must match a node's labels for the pod to be scheduled on that node. ## More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ nodeSelector: {} ## Tolerations are appended (excluding duplicates) to pods running with this RuntimeClass during admission, ## effectively unioning the set of nodes tolerated by the pod and the RuntimeClass. tolerations: [] ## Compute Resources required by this container. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container resources: {} # resources: # limits: # memory: "8Gi" # cpu: "4" # requests: # memory: "2Gi" # cpu: "500m" ## ConfigMap configmap: DOLPHINSCHEDULER_OPTS: "" WORKER_EXEC_THREADS: "100" WORKER_HEARTBEAT_INTERVAL: "10" WORKER_MAX_CPULOAD_AVG: "100" WORKER_RESERVED_MEMORY: "0.1" WORKER_LISTEN_PORT: "1234" WORKER_GROUPS: "default" WORKER_WEIGHT: "100" ## Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes livenessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes readinessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## PersistentVolumeClaim represents a reference to a PersistentVolumeClaim in the same namespace. ## The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. ## Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. ## A claim in this list takes precedence over any volumes in the template, with the same name. persistentVolumeClaim: enabled: false ## dolphinscheduler data volume dataPersistentVolume: enabled: false accessModes: - "ReadWriteOnce" storageClassName: "-" storage: "20Gi" ## dolphinscheduler logs volume logsPersistentVolume: enabled: false accessModes: - "ReadWriteOnce" storageClassName: "-" storage: "20Gi" alert: ## Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1. replicas: "1" ## The deployment strategy to use to replace existing pods with new ones. strategy: type: "RollingUpdate" rollingUpdate: maxSurge: "25%" maxUnavailable: "25%" ## You can use annotations to attach arbitrary non-identifying metadata to objects. ## Clients such as tools and libraries can retrieve this metadata. annotations: {} ## NodeSelector is a selector which must be true for the pod to fit on a node. ## Selector which must match a node's labels for the pod to be scheduled on that node. ## More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ affinity: {} ## Compute Resources required by this container. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container nodeSelector: {} ## Tolerations are appended (excluding duplicates) to pods running with this RuntimeClass during admission, ## effectively unioning the set of nodes tolerated by the pod and the RuntimeClass. tolerations: [] ## Affinity is a group of affinity scheduling rules. If specified, the pod's scheduling constraints. ## More info: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#affinity-v1-core resources: {} # resources: # limits: # memory: "2Gi" # cpu: "1" # requests: # memory: "1Gi" # cpu: "500m" ## ConfigMap configmap: DOLPHINSCHEDULER_OPTS: "" ALERT_PLUGIN_DIR: "/opt/dolphinscheduler/alert/plugin" XLS_FILE_PATH: "/tmp/xls" MAIL_SERVER_HOST: "" MAIL_SERVER_PORT: "" MAIL_SENDER: "" MAIL_USER: "" MAIL_PASSWD: "" MAIL_SMTP_STARTTLS_ENABLE: false MAIL_SMTP_SSL_ENABLE: false MAIL_SMTP_SSL_TRUST: "" ENTERPRISE_WECHAT_ENABLE: false ENTERPRISE_WECHAT_CORP_ID: "" ENTERPRISE_WECHAT_SECRET: "" ENTERPRISE_WECHAT_AGENT_ID: "" ENTERPRISE_WECHAT_USERS: "" ## Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes livenessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes readinessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## PersistentVolumeClaim represents a reference to a PersistentVolumeClaim in the same namespace. ## More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims persistentVolumeClaim: enabled: false accessModes: - "ReadWriteOnce" storageClassName: "-" storage: "20Gi" api: ## Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1. replicas: "1" ## The deployment strategy to use to replace existing pods with new ones. strategy: type: "RollingUpdate" rollingUpdate: maxSurge: "25%" maxUnavailable: "25%" ## You can use annotations to attach arbitrary non-identifying metadata to objects. ## Clients such as tools and libraries can retrieve this metadata. annotations: {} ## NodeSelector is a selector which must be true for the pod to fit on a node. ## Selector which must match a node's labels for the pod to be scheduled on that node. ## More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ affinity: {} ## Compute Resources required by this container. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container nodeSelector: {} ## Tolerations are appended (excluding duplicates) to pods running with this RuntimeClass during admission, ## effectively unioning the set of nodes tolerated by the pod and the RuntimeClass. tolerations: [] ## Affinity is a group of affinity scheduling rules. If specified, the pod's scheduling constraints. ## More info: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#affinity-v1-core resources: {} # resources: # limits: # memory: "2Gi" # cpu: "1" # requests: # memory: "1Gi" # cpu: "500m" ## ConfigMap configmap: DOLPHINSCHEDULER_OPTS: "" ## Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes livenessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes readinessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## PersistentVolumeClaim represents a reference to a PersistentVolumeClaim in the same namespace. ## More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims persistentVolumeClaim: enabled: false accessModes: - "ReadWriteOnce" storageClassName: "-" storage: "20Gi" ingress: enabled: false host: "dolphinscheduler.org" path: "/" tls: enabled: false hosts: - "dolphinscheduler.org" secretName: "dolphinscheduler-tls"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,905
[Bug][K8s] Incorrect host problem in minikube
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Deploy K8s on minikube by `helm` 2. Access `Worker groups manage` 3. See incorrect host **Expected behavior** Bug fixed, and the host in the picture below is correct: ![image](https://user-images.githubusercontent.com/4902714/109470921-ff3aba80-7aaa-11eb-9555-9e5c97504ecb.png) **Screenshots** If applicable, add screenshots to help explain your problem. Incorrect host: ![image](https://user-images.githubusercontent.com/4902714/109471044-2a250e80-7aab-11eb-840b-a59cf2fd8e36.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4905
https://github.com/apache/dolphinscheduler/pull/4906
4706de717ceb6d399aca1dbd683566ef8f97b578
d6675259132c7eeebb183782bdc7f09fe04ff21b
"2021-03-01T08:28:45Z"
java
"2021-03-04T02:05:24Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java
/* * 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.dolphinscheduler.common.utils; import static org.apache.dolphinscheduler.common.Constants.DOLPHIN_SCHEDULER_PREFERRED_NETWORK_INTERFACE; import static java.util.Collections.emptyList; import org.apache.dolphinscheduler.common.Constants; import java.io.IOException; import java.net.Inet6Address; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.net.UnknownHostException; import java.util.Enumeration; import java.util.LinkedList; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * NetUtils */ public class NetUtils { private static final Pattern IP_PATTERN = Pattern.compile("\\d{1,3}(\\.\\d{1,3}){3,5}$"); private static final String NETWORK_PRIORITY_DEFAULT = "default"; private static final String NETWORK_PRIORITY_INNER = "inner"; private static final String NETWORK_PRIORITY_OUTER = "outer"; private static final Logger logger = LoggerFactory.getLogger(NetUtils.class); private static InetAddress LOCAL_ADDRESS = null; private static volatile String HOST_ADDRESS; private NetUtils() { throw new UnsupportedOperationException("Construct NetUtils"); } /** * get addr like host:port * @return addr */ public static String getAddr(String host, int port) { return String.format("%s:%d", host, port); } /** * get addr like host:port * @return addr */ public static String getAddr(int port) { return getAddr(getHost(), port); } /** * get host * @return host */ public static String getHost(InetAddress inetAddress) { if (inetAddress != null) { return Constants.KUBERNETES_MODE ? inetAddress.getHostName() : inetAddress.getHostAddress(); } return null; } public static String getHost() { if (HOST_ADDRESS != null) { return HOST_ADDRESS; } InetAddress address = getLocalAddress(); if (address != null) { HOST_ADDRESS = getHost(address); return HOST_ADDRESS; } return Constants.KUBERNETES_MODE ? "localhost" : "127.0.0.1"; } private static InetAddress getLocalAddress() { if (null != LOCAL_ADDRESS) { return LOCAL_ADDRESS; } return getLocalAddress0(); } /** * Find first valid IP from local network card * * @return first valid local IP */ private static synchronized InetAddress getLocalAddress0() { if (null != LOCAL_ADDRESS) { return LOCAL_ADDRESS; } InetAddress localAddress = null; try { NetworkInterface networkInterface = findNetworkInterface(); if (networkInterface != null) { Enumeration<InetAddress> addresses = networkInterface.getInetAddresses(); while (addresses.hasMoreElements()) { Optional<InetAddress> addressOp = toValidAddress(addresses.nextElement()); if (addressOp.isPresent()) { try { if (addressOp.get().isReachable(100)) { LOCAL_ADDRESS = addressOp.get(); return LOCAL_ADDRESS; } } catch (IOException e) { logger.warn("test address id reachable io exception", e); } } } } localAddress = InetAddress.getLocalHost(); } catch (UnknownHostException e) { logger.warn("InetAddress get LocalHost exception", e); } Optional<InetAddress> addressOp = toValidAddress(localAddress); if (addressOp.isPresent()) { LOCAL_ADDRESS = addressOp.get(); } return LOCAL_ADDRESS; } private static Optional<InetAddress> toValidAddress(InetAddress address) { if (address instanceof Inet6Address) { Inet6Address v6Address = (Inet6Address) address; if (isPreferIPV6Address()) { return Optional.ofNullable(normalizeV6Address(v6Address)); } } if (isValidV4Address(address)) { return Optional.of(address); } return Optional.empty(); } private static InetAddress normalizeV6Address(Inet6Address address) { String addr = address.getHostAddress(); int i = addr.lastIndexOf('%'); if (i > 0) { try { return InetAddress.getByName(addr.substring(0, i) + '%' + address.getScopeId()); } catch (UnknownHostException e) { logger.debug("Unknown IPV6 address: ", e); } } return address; } public static boolean isValidV4Address(InetAddress address) { if (address == null || address.isLoopbackAddress()) { return false; } String name = address.getHostAddress(); return (name != null && IP_PATTERN.matcher(name).matches() && !address.isAnyLocalAddress() && !address.isLoopbackAddress()); } /** * Check if an ipv6 address * * @return true if it is reachable */ private static boolean isPreferIPV6Address() { return Boolean.getBoolean("java.net.preferIPv6Addresses"); } /** * Get the suitable {@link NetworkInterface} * * @return If no {@link NetworkInterface} is available , return <code>null</code> */ private static NetworkInterface findNetworkInterface() { List<NetworkInterface> validNetworkInterfaces = emptyList(); try { validNetworkInterfaces = getValidNetworkInterfaces(); } catch (SocketException e) { logger.warn("ValidNetworkInterfaces exception", e); } NetworkInterface result = null; // Try to specify config NetWork Interface for (NetworkInterface networkInterface : validNetworkInterfaces) { if (isSpecifyNetworkInterface(networkInterface)) { result = networkInterface; break; } } if (null != result) { return result; } return findAddress(validNetworkInterfaces); } /** * Get the valid {@link NetworkInterface network interfaces} * * @throws SocketException SocketException if an I/O error occurs. */ private static List<NetworkInterface> getValidNetworkInterfaces() throws SocketException { List<NetworkInterface> validNetworkInterfaces = new LinkedList<>(); Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { NetworkInterface networkInterface = interfaces.nextElement(); if (ignoreNetworkInterface(networkInterface)) { // ignore continue; } validNetworkInterfaces.add(networkInterface); } return validNetworkInterfaces; } /** * @param networkInterface {@link NetworkInterface} * @return if the specified {@link NetworkInterface} should be ignored, return <code>true</code> * @throws SocketException SocketException if an I/O error occurs. */ public static boolean ignoreNetworkInterface(NetworkInterface networkInterface) throws SocketException { return networkInterface == null || networkInterface.isLoopback() || networkInterface.isVirtual() || !networkInterface.isUp(); } private static boolean isSpecifyNetworkInterface(NetworkInterface networkInterface) { String preferredNetworkInterface = System.getProperty(DOLPHIN_SCHEDULER_PREFERRED_NETWORK_INTERFACE); return Objects.equals(networkInterface.getDisplayName(), preferredNetworkInterface); } private static NetworkInterface findAddress(List<NetworkInterface> validNetworkInterfaces) { if (validNetworkInterfaces.isEmpty()) { return null; } String networkPriority = PropertyUtils.getString(Constants.NETWORK_PRIORITY_STRATEGY, NETWORK_PRIORITY_DEFAULT); if (NETWORK_PRIORITY_DEFAULT.equalsIgnoreCase(networkPriority)) { return findAddressByDefaultPolicy(validNetworkInterfaces); } else if (NETWORK_PRIORITY_INNER.equalsIgnoreCase(networkPriority)) { return findInnerAddress(validNetworkInterfaces); } else if (NETWORK_PRIORITY_OUTER.equalsIgnoreCase(networkPriority)) { return findOuterAddress(validNetworkInterfaces); } else { logger.error("There is no matching network card acquisition policy!"); return null; } } private static NetworkInterface findAddressByDefaultPolicy(List<NetworkInterface> validNetworkInterfaces) { NetworkInterface networkInterface; networkInterface = findInnerAddress(validNetworkInterfaces); if (networkInterface == null) { networkInterface = findOuterAddress(validNetworkInterfaces); if (networkInterface == null) { networkInterface = validNetworkInterfaces.get(0); } } return networkInterface; } /** * Get the Intranet IP * * @return If no {@link NetworkInterface} is available , return <code>null</code> */ private static NetworkInterface findInnerAddress(List<NetworkInterface> validNetworkInterfaces) { NetworkInterface networkInterface = null; for (NetworkInterface ni : validNetworkInterfaces) { Enumeration<InetAddress> address = ni.getInetAddresses(); while (address.hasMoreElements()) { InetAddress ip = address.nextElement(); if (ip.isSiteLocalAddress() && !ip.isLoopbackAddress()) { networkInterface = ni; } } } return networkInterface; } private static NetworkInterface findOuterAddress(List<NetworkInterface> validNetworkInterfaces) { NetworkInterface networkInterface = null; for (NetworkInterface ni : validNetworkInterfaces) { Enumeration<InetAddress> address = ni.getInetAddresses(); while (address.hasMoreElements()) { InetAddress ip = address.nextElement(); if (!ip.isSiteLocalAddress() && !ip.isLoopbackAddress()) { networkInterface = ni; } } } return networkInterface; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,905
[Bug][K8s] Incorrect host problem in minikube
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Deploy K8s on minikube by `helm` 2. Access `Worker groups manage` 3. See incorrect host **Expected behavior** Bug fixed, and the host in the picture below is correct: ![image](https://user-images.githubusercontent.com/4902714/109470921-ff3aba80-7aaa-11eb-9555-9e5c97504ecb.png) **Screenshots** If applicable, add screenshots to help explain your problem. Incorrect host: ![image](https://user-images.githubusercontent.com/4902714/109471044-2a250e80-7aab-11eb-840b-a59cf2fd8e36.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4905
https://github.com/apache/dolphinscheduler/pull/4906
4706de717ceb6d399aca1dbd683566ef8f97b578
d6675259132c7eeebb183782bdc7f09fe04ff21b
"2021-03-01T08:28:45Z"
java
"2021-03-04T02:05:24Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/CommonTest.java
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,905
[Bug][K8s] Incorrect host problem in minikube
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Deploy K8s on minikube by `helm` 2. Access `Worker groups manage` 3. See incorrect host **Expected behavior** Bug fixed, and the host in the picture below is correct: ![image](https://user-images.githubusercontent.com/4902714/109470921-ff3aba80-7aaa-11eb-9555-9e5c97504ecb.png) **Screenshots** If applicable, add screenshots to help explain your problem. Incorrect host: ![image](https://user-images.githubusercontent.com/4902714/109471044-2a250e80-7aab-11eb-840b-a59cf2fd8e36.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4905
https://github.com/apache/dolphinscheduler/pull/4906
4706de717ceb6d399aca1dbd683566ef8f97b578
d6675259132c7eeebb183782bdc7f09fe04ff21b
"2021-03-01T08:28:45Z"
java
"2021-03-04T02:05:24Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/NetUtilsTest.java
/* * 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.dolphinscheduler.common.utils; import org.junit.Test; import java.net.InetAddress; import static org.junit.Assert.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** * NetUtilsTest */ public class NetUtilsTest { @Test public void testGetAddr() { assertEquals(NetUtils.getHost() + ":5678", NetUtils.getAddr(5678)); assertEquals("127.0.0.1:5678", NetUtils.getAddr("127.0.0.1", 5678)); assertEquals("localhost:1234", NetUtils.getAddr("localhost", 1234)); } @Test public void testGetLocalHost() { assertNotNull(NetUtils.getHost()); } @Test public void testIsValidAddress() { assertFalse(NetUtils.isValidV4Address(null)); InetAddress address = mock(InetAddress.class); when(address.isLoopbackAddress()).thenReturn(true); assertFalse(NetUtils.isValidV4Address(address)); address = mock(InetAddress.class); when(address.getHostAddress()).thenReturn("localhost"); assertFalse(NetUtils.isValidV4Address(address)); address = mock(InetAddress.class); when(address.getHostAddress()).thenReturn("0.0.0.0"); when(address.isAnyLocalAddress()).thenReturn(true); assertFalse(NetUtils.isValidV4Address(address)); address = mock(InetAddress.class); when(address.getHostAddress()).thenReturn("127.0.0.1"); when(address.isLoopbackAddress()).thenReturn(true); assertFalse(NetUtils.isValidV4Address(address)); address = mock(InetAddress.class); when(address.getHostAddress()).thenReturn("1.2.3.4"); assertTrue(NetUtils.isValidV4Address(address)); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,897
[Bug][Docker] `docker logs -f` command cannot keep outputting logs all the time
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Run a dolphinscheduler by `docker-compose up -d` 2. Run `docker logs -f dolphinscheduler-master` command 3. Wait more than an hour 4. See error: The logs outputed by `docker logs -f dolphinscheduler-master` are not changed, while the log file in the container contains more log contents by `docker exec -it dolphinscheduler-master cat /opt/dolphinscheduler/logs/dolphinscheduler-master.log` **Bug reason**: Due to log rotation, the `tail` command cannot obtain a new rotation log **Expected behavior** Bug fixed **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4897
https://github.com/apache/dolphinscheduler/pull/4900
d6675259132c7eeebb183782bdc7f09fe04ff21b
cf13c87dae0b30d994f448140f5c7e506d8f3ca4
"2021-02-27T05:14:30Z"
java
"2021-03-04T02:08:03Z"
.licenserc.yaml
# Licensed to 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. Apache Software Foundation (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. header: license: spdx-id: Apache-2.0 copyright-owner: Apache Software Foundation paths-ignore: - dist - NOTICE - LICENSE - DISCLAIMER - dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ScriptRunner.java - mvnw.cmd - sql/soft_version - .mvn - .gitattributes - '**/licenses/**/LICENSE-*' - '**/*.md' - '**/*.json' - '**/*.iml' - '**/.babelrc' - '**/.eslintignore' - '**/.gitignore' - '**/LICENSE' - '**/NOTICE' comment: on-failure
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,897
[Bug][Docker] `docker logs -f` command cannot keep outputting logs all the time
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Run a dolphinscheduler by `docker-compose up -d` 2. Run `docker logs -f dolphinscheduler-master` command 3. Wait more than an hour 4. See error: The logs outputed by `docker logs -f dolphinscheduler-master` are not changed, while the log file in the container contains more log contents by `docker exec -it dolphinscheduler-master cat /opt/dolphinscheduler/logs/dolphinscheduler-master.log` **Bug reason**: Due to log rotation, the `tail` command cannot obtain a new rotation log **Expected behavior** Bug fixed **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4897
https://github.com/apache/dolphinscheduler/pull/4900
d6675259132c7eeebb183782bdc7f09fe04ff21b
cf13c87dae0b30d994f448140f5c7e506d8f3ca4
"2021-02-27T05:14:30Z"
java
"2021-03-04T02:08:03Z"
docker/build/Dockerfile
# # 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. # FROM openjdk:8-jdk-alpine ARG VERSION ENV TZ Asia/Shanghai ENV LANG C.UTF-8 ENV DOCKER true # 1. install command/library/software # If install slowly, you can replcae alpine's mirror with aliyun's mirror, Example: # RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories # RUN sed -i 's/dl-cdn.alpinelinux.org/mirror.tuna.tsinghua.edu.cn/g' /etc/apk/repositories RUN apk update && \ apk add --no-cache tzdata dos2unix bash python2 python3 procps sudo shadow tini postgresql-client && \ cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ apk del tzdata && \ rm -rf /var/cache/apk/* # 2. add dolphinscheduler ADD ./apache-dolphinscheduler-incubating-${VERSION}-dolphinscheduler-bin.tar.gz /opt/ RUN ln -s /opt/apache-dolphinscheduler-incubating-${VERSION}-dolphinscheduler-bin /opt/dolphinscheduler ENV DOLPHINSCHEDULER_HOME /opt/dolphinscheduler # 3. add configuration and modify permissions and set soft links COPY ./checkpoint.sh /root/checkpoint.sh COPY ./startup-init-conf.sh /root/startup-init-conf.sh COPY ./startup.sh /root/startup.sh COPY ./conf/dolphinscheduler/*.tpl /opt/dolphinscheduler/conf/ COPY ./conf/dolphinscheduler/logback/* /opt/dolphinscheduler/conf/ COPY ./conf/dolphinscheduler/env/dolphinscheduler_env.sh.tpl /opt/dolphinscheduler/conf/env/ RUN dos2unix /root/checkpoint.sh && \ dos2unix /root/startup-init-conf.sh && \ dos2unix /root/startup.sh && \ dos2unix /opt/dolphinscheduler/script/*.sh && \ dos2unix /opt/dolphinscheduler/bin/*.sh && \ rm -rf /bin/sh && \ ln -s /bin/bash /bin/sh && \ mkdir -p /var/mail /tmp/xls && \ echo "Set disable_coredump false" >> /etc/sudo.conf # 4. expose port EXPOSE 5678 1234 12345 50051 50052 ENTRYPOINT ["/sbin/tini", "--", "/root/startup.sh"]
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,897
[Bug][Docker] `docker logs -f` command cannot keep outputting logs all the time
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Run a dolphinscheduler by `docker-compose up -d` 2. Run `docker logs -f dolphinscheduler-master` command 3. Wait more than an hour 4. See error: The logs outputed by `docker logs -f dolphinscheduler-master` are not changed, while the log file in the container contains more log contents by `docker exec -it dolphinscheduler-master cat /opt/dolphinscheduler/logs/dolphinscheduler-master.log` **Bug reason**: Due to log rotation, the `tail` command cannot obtain a new rotation log **Expected behavior** Bug fixed **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4897
https://github.com/apache/dolphinscheduler/pull/4900
d6675259132c7eeebb183782bdc7f09fe04ff21b
cf13c87dae0b30d994f448140f5c7e506d8f3ca4
"2021-02-27T05:14:30Z"
java
"2021-03-04T02:08:03Z"
docker/build/conf/dolphinscheduler/logback/logback-alert.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ 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. --> <!-- Logback configuration. See http://logback.qos.ch/manual/index.html --> <configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" --> <property name="log.base" value="logs"/> <appender name="ALERTLOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${log.base}/dolphinscheduler-alert.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${log.base}/dolphinscheduler-alert.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> <maxHistory>20</maxHistory> <maxFileSize>64MB</maxFileSize> </rollingPolicy> <encoder> <pattern> [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n </pattern> <charset>UTF-8</charset> </encoder> </appender> <root level="INFO"> <appender-ref ref="ALERTLOGFILE"/> </root> </configuration>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,897
[Bug][Docker] `docker logs -f` command cannot keep outputting logs all the time
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Run a dolphinscheduler by `docker-compose up -d` 2. Run `docker logs -f dolphinscheduler-master` command 3. Wait more than an hour 4. See error: The logs outputed by `docker logs -f dolphinscheduler-master` are not changed, while the log file in the container contains more log contents by `docker exec -it dolphinscheduler-master cat /opt/dolphinscheduler/logs/dolphinscheduler-master.log` **Bug reason**: Due to log rotation, the `tail` command cannot obtain a new rotation log **Expected behavior** Bug fixed **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4897
https://github.com/apache/dolphinscheduler/pull/4900
d6675259132c7eeebb183782bdc7f09fe04ff21b
cf13c87dae0b30d994f448140f5c7e506d8f3ca4
"2021-02-27T05:14:30Z"
java
"2021-03-04T02:08:03Z"
docker/build/conf/dolphinscheduler/logback/logback-api.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ 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. --> <!-- Logback configuration. See http://logback.qos.ch/manual/index.html --> <configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" --> <property name="log.base" value="logs"/> <!-- api server logback config start --> <appender name="APILOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${log.base}/dolphinscheduler-api.log</file> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>INFO</level> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${log.base}/dolphinscheduler-api.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> <maxHistory>168</maxHistory> <maxFileSize>64MB</maxFileSize> </rollingPolicy> <encoder> <pattern> [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n </pattern> <charset>UTF-8</charset> </encoder> </appender> <!-- api server logback config end --> <logger name="org.apache.zookeeper" level="WARN"/> <logger name="org.apache.hbase" level="WARN"/> <logger name="org.apache.hadoop" level="WARN"/> <root level="INFO"> <appender-ref ref="APILOGFILE"/> </root> </configuration>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,897
[Bug][Docker] `docker logs -f` command cannot keep outputting logs all the time
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Run a dolphinscheduler by `docker-compose up -d` 2. Run `docker logs -f dolphinscheduler-master` command 3. Wait more than an hour 4. See error: The logs outputed by `docker logs -f dolphinscheduler-master` are not changed, while the log file in the container contains more log contents by `docker exec -it dolphinscheduler-master cat /opt/dolphinscheduler/logs/dolphinscheduler-master.log` **Bug reason**: Due to log rotation, the `tail` command cannot obtain a new rotation log **Expected behavior** Bug fixed **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4897
https://github.com/apache/dolphinscheduler/pull/4900
d6675259132c7eeebb183782bdc7f09fe04ff21b
cf13c87dae0b30d994f448140f5c7e506d8f3ca4
"2021-02-27T05:14:30Z"
java
"2021-03-04T02:08:03Z"
docker/build/conf/dolphinscheduler/logback/logback-master.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ 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. --> <!-- Logback configuration. See http://logback.qos.ch/manual/index.html --> <configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" --> <property name="log.base" value="logs"/> <conversionRule conversionWord="messsage" converterClass="org.apache.dolphinscheduler.server.log.SensitiveDataConverter"/> <appender name="TASKLOGFILE" class="ch.qos.logback.classic.sift.SiftingAppender"> <!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>INFO</level> </filter> --> <filter class="org.apache.dolphinscheduler.server.log.TaskLogFilter"/> <Discriminator class="org.apache.dolphinscheduler.server.log.TaskLogDiscriminator"> <key>taskAppId</key> <logBase>${log.base}</logBase> </Discriminator> <sift> <appender name="FILE-${taskAppId}" class="ch.qos.logback.core.FileAppender"> <file>${log.base}/${taskAppId}.log</file> <encoder> <pattern> [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %messsage%n </pattern> <charset>UTF-8</charset> </encoder> <append>true</append> </appender> </sift> </appender> <!-- master server logback config start --> <appender name="MASTERLOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${log.base}/dolphinscheduler-master.log</file> <!--<filter class="org.apache.dolphinscheduler.server.log.MasterLogFilter"> <level>INFO</level> </filter>--> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${log.base}/dolphinscheduler-master.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> <maxHistory>168</maxHistory> <maxFileSize>200MB</maxFileSize> </rollingPolicy> <encoder> <pattern> [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n </pattern> <charset>UTF-8</charset> </encoder> </appender> <!-- master server logback config end --> <root level="INFO"> <appender-ref ref="TASKLOGFILE"/> <appender-ref ref="MASTERLOGFILE"/> </root> </configuration>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,897
[Bug][Docker] `docker logs -f` command cannot keep outputting logs all the time
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Run a dolphinscheduler by `docker-compose up -d` 2. Run `docker logs -f dolphinscheduler-master` command 3. Wait more than an hour 4. See error: The logs outputed by `docker logs -f dolphinscheduler-master` are not changed, while the log file in the container contains more log contents by `docker exec -it dolphinscheduler-master cat /opt/dolphinscheduler/logs/dolphinscheduler-master.log` **Bug reason**: Due to log rotation, the `tail` command cannot obtain a new rotation log **Expected behavior** Bug fixed **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4897
https://github.com/apache/dolphinscheduler/pull/4900
d6675259132c7eeebb183782bdc7f09fe04ff21b
cf13c87dae0b30d994f448140f5c7e506d8f3ca4
"2021-02-27T05:14:30Z"
java
"2021-03-04T02:08:03Z"
docker/build/conf/dolphinscheduler/logback/logback-worker.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ 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. --> <!-- Logback configuration. See http://logback.qos.ch/manual/index.html --> <configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" --> <property name="log.base" value="logs"/> <!-- worker server logback config start --> <conversionRule conversionWord="messsage" converterClass="org.apache.dolphinscheduler.server.log.SensitiveDataConverter"/> <appender name="TASKLOGFILE" class="ch.qos.logback.classic.sift.SiftingAppender"> <!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>INFO</level> </filter> --> <filter class="org.apache.dolphinscheduler.server.log.TaskLogFilter"/> <Discriminator class="org.apache.dolphinscheduler.server.log.TaskLogDiscriminator"> <key>taskAppId</key> <logBase>${log.base}</logBase> </Discriminator> <sift> <appender name="FILE-${taskAppId}" class="ch.qos.logback.core.FileAppender"> <file>${log.base}/${taskAppId}.log</file> <encoder> <pattern> [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %messsage%n </pattern> <charset>UTF-8</charset> </encoder> <append>true</append> </appender> </sift> </appender> <appender name="WORKERLOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${log.base}/dolphinscheduler-worker.log</file> <!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>INFO</level> </filter> --> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${log.base}/dolphinscheduler-worker.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> <maxHistory>168</maxHistory> <maxFileSize>200MB</maxFileSize> </rollingPolicy> <encoder> <pattern> [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %messsage%n </pattern> <charset>UTF-8</charset> </encoder> </appender> <!-- worker server logback config end --> <root level="INFO"> <appender-ref ref="TASKLOGFILE"/> <appender-ref ref="WORKERLOGFILE"/> </root> </configuration>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,897
[Bug][Docker] `docker logs -f` command cannot keep outputting logs all the time
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Run a dolphinscheduler by `docker-compose up -d` 2. Run `docker logs -f dolphinscheduler-master` command 3. Wait more than an hour 4. See error: The logs outputed by `docker logs -f dolphinscheduler-master` are not changed, while the log file in the container contains more log contents by `docker exec -it dolphinscheduler-master cat /opt/dolphinscheduler/logs/dolphinscheduler-master.log` **Bug reason**: Due to log rotation, the `tail` command cannot obtain a new rotation log **Expected behavior** Bug fixed **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4897
https://github.com/apache/dolphinscheduler/pull/4900
d6675259132c7eeebb183782bdc7f09fe04ff21b
cf13c87dae0b30d994f448140f5c7e506d8f3ca4
"2021-02-27T05:14:30Z"
java
"2021-03-04T02:08:03Z"
docker/build/conf/dolphinscheduler/supervisor/supervisor.ini
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,897
[Bug][Docker] `docker logs -f` command cannot keep outputting logs all the time
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Run a dolphinscheduler by `docker-compose up -d` 2. Run `docker logs -f dolphinscheduler-master` command 3. Wait more than an hour 4. See error: The logs outputed by `docker logs -f dolphinscheduler-master` are not changed, while the log file in the container contains more log contents by `docker exec -it dolphinscheduler-master cat /opt/dolphinscheduler/logs/dolphinscheduler-master.log` **Bug reason**: Due to log rotation, the `tail` command cannot obtain a new rotation log **Expected behavior** Bug fixed **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4897
https://github.com/apache/dolphinscheduler/pull/4900
d6675259132c7eeebb183782bdc7f09fe04ff21b
cf13c87dae0b30d994f448140f5c7e506d8f3ca4
"2021-02-27T05:14:30Z"
java
"2021-03-04T02:08:03Z"
docker/build/startup-init-conf.sh
#!/bin/bash # # 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. # set -e echo "init env variables" # Define parameters default value #============================================================================ # Database Source #============================================================================ export DATABASE_HOST=${DATABASE_HOST:-"127.0.0.1"} export DATABASE_PORT=${DATABASE_PORT:-"5432"} export DATABASE_USERNAME=${DATABASE_USERNAME:-"root"} export DATABASE_PASSWORD=${DATABASE_PASSWORD:-"root"} export DATABASE_DATABASE=${DATABASE_DATABASE:-"dolphinscheduler"} export DATABASE_TYPE=${DATABASE_TYPE:-"postgresql"} export DATABASE_DRIVER=${DATABASE_DRIVER:-"org.postgresql.Driver"} export DATABASE_PARAMS=${DATABASE_PARAMS:-"characterEncoding=utf8"} #============================================================================ # Common #============================================================================ # dolphinscheduler env export HADOOP_HOME=${HADOOP_HOME:-"/opt/soft/hadoop"} export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-"/opt/soft/hadoop/etc/hadoop"} export SPARK_HOME1=${SPARK_HOME1:-"/opt/soft/spark1"} export SPARK_HOME2=${SPARK_HOME2:-"/opt/soft/spark2"} export PYTHON_HOME=${PYTHON_HOME:-"/usr/bin/python"} export JAVA_HOME=${JAVA_HOME:-"/usr/lib/jvm/java-1.8-openjdk"} export HIVE_HOME=${HIVE_HOME:-"/opt/soft/hive"} export FLINK_HOME=${FLINK_HOME:-"/opt/soft/flink"} export DATAX_HOME=${DATAX_HOME:-"/opt/soft/datax/bin/datax.py"} # common env export DOLPHINSCHEDULER_DATA_BASEDIR_PATH=${DOLPHINSCHEDULER_DATA_BASEDIR_PATH:-"/tmp/dolphinscheduler"} export DOLPHINSCHEDULER_OPTS=${DOLPHINSCHEDULER_OPTS:-""} export RESOURCE_STORAGE_TYPE=${RESOURCE_STORAGE_TYPE:-"HDFS"} export RESOURCE_UPLOAD_PATH=${RESOURCE_UPLOAD_PATH:-"/dolphinscheduler"} export FS_DEFAULT_FS=${FS_DEFAULT_FS:-"file:///"} export FS_S3A_ENDPOINT=${FS_S3A_ENDPOINT:-"s3.xxx.amazonaws.com"} export FS_S3A_ACCESS_KEY=${FS_S3A_ACCESS_KEY:-"xxxxxxx"} export FS_S3A_SECRET_KEY=${FS_S3A_SECRET_KEY:-"xxxxxxx"} #============================================================================ # Zookeeper #============================================================================ export ZOOKEEPER_QUORUM=${ZOOKEEPER_QUORUM:-"127.0.0.1:2181"} export ZOOKEEPER_ROOT=${ZOOKEEPER_ROOT:-"/dolphinscheduler"} #============================================================================ # Master Server #============================================================================ export MASTER_EXEC_THREADS=${MASTER_EXEC_THREADS:-"100"} export MASTER_EXEC_TASK_NUM=${MASTER_EXEC_TASK_NUM:-"20"} export MASTER_HEARTBEAT_INTERVAL=${MASTER_HEARTBEAT_INTERVAL:-"10"} export MASTER_TASK_COMMIT_RETRYTIMES=${MASTER_TASK_COMMIT_RETRYTIMES:-"5"} export MASTER_TASK_COMMIT_INTERVAL=${MASTER_TASK_COMMIT_INTERVAL:-"1000"} export MASTER_MAX_CPULOAD_AVG=${MASTER_MAX_CPULOAD_AVG:-"100"} export MASTER_RESERVED_MEMORY=${MASTER_RESERVED_MEMORY:-"0.1"} export MASTER_LISTEN_PORT=${MASTER_LISTEN_PORT:-"5678"} #============================================================================ # Worker Server #============================================================================ export WORKER_EXEC_THREADS=${WORKER_EXEC_THREADS:-"100"} export WORKER_HEARTBEAT_INTERVAL=${WORKER_HEARTBEAT_INTERVAL:-"10"} export WORKER_MAX_CPULOAD_AVG=${WORKER_MAX_CPULOAD_AVG:-"100"} export WORKER_RESERVED_MEMORY=${WORKER_RESERVED_MEMORY:-"0.1"} export WORKER_LISTEN_PORT=${WORKER_LISTEN_PORT:-"1234"} export WORKER_GROUPS=${WORKER_GROUPS:-"default"} export WORKER_WEIGHT=${WORKER_WEIGHT:-"100"} export ALERT_LISTEN_HOST=${ALERT_LISTEN_HOST:-"127.0.0.1"} #============================================================================ # Alert Server #============================================================================ export ALERT_PLUGIN_DIR=${ALERT_PLUGIN_DIR:-"lib/plugin/alert"} echo "generate app config" find ${DOLPHINSCHEDULER_HOME}/conf/ -name "*.tpl" | while read file; do eval "cat << EOF $(cat ${file}) EOF " > ${file%.*} done find ${DOLPHINSCHEDULER_HOME}/conf/ -name "*.sh" -exec chmod +x {} \;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,897
[Bug][Docker] `docker logs -f` command cannot keep outputting logs all the time
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Run a dolphinscheduler by `docker-compose up -d` 2. Run `docker logs -f dolphinscheduler-master` command 3. Wait more than an hour 4. See error: The logs outputed by `docker logs -f dolphinscheduler-master` are not changed, while the log file in the container contains more log contents by `docker exec -it dolphinscheduler-master cat /opt/dolphinscheduler/logs/dolphinscheduler-master.log` **Bug reason**: Due to log rotation, the `tail` command cannot obtain a new rotation log **Expected behavior** Bug fixed **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4897
https://github.com/apache/dolphinscheduler/pull/4900
d6675259132c7eeebb183782bdc7f09fe04ff21b
cf13c87dae0b30d994f448140f5c7e506d8f3ca4
"2021-02-27T05:14:30Z"
java
"2021-03-04T02:08:03Z"
docker/build/startup.sh
#!/bin/bash # # 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. # set -e DOLPHINSCHEDULER_BIN=${DOLPHINSCHEDULER_HOME}/bin DOLPHINSCHEDULER_SCRIPT=${DOLPHINSCHEDULER_HOME}/script DOLPHINSCHEDULER_LOGS=${DOLPHINSCHEDULER_HOME}/logs # wait database waitDatabase() { echo "test ${DATABASE_TYPE} service" while ! nc -z ${DATABASE_HOST} ${DATABASE_PORT}; do local counter=$((counter+1)) if [ $counter == 30 ]; then echo "Error: Couldn't connect to ${DATABASE_TYPE}." exit 1 fi echo "Trying to connect to ${DATABASE_TYPE} at ${DATABASE_HOST}:${DATABASE_PORT}. Attempt $counter." sleep 5 done echo "connect ${DATABASE_TYPE} service" if [ ${DATABASE_TYPE} = "mysql" ]; then v=$(mysql -h${DATABASE_HOST} -P${DATABASE_PORT} -u${DATABASE_USERNAME} --password=${DATABASE_PASSWORD} -D ${DATABASE_DATABASE} -e "select 1" 2>&1) if [ "$(echo ${v} | grep 'ERROR' | wc -l)" -eq 1 ]; then echo "Error: Can't connect to database...${v}" exit 1 fi else v=$(PGPASSWORD=${DATABASE_PASSWORD} psql -h ${DATABASE_HOST} -p ${DATABASE_PORT} -U ${DATABASE_USERNAME} -d ${DATABASE_DATABASE} -tAc "select 1") if [ "$(echo ${v} | grep 'FATAL' | wc -l)" -eq 1 ]; then echo "Error: Can't connect to database...${v}" exit 1 fi fi } # init database initDatabase() { echo "import sql data" ${DOLPHINSCHEDULER_SCRIPT}/create-dolphinscheduler.sh } # check ds version checkDSVersion() { if [ ${DATABASE_TYPE} = "mysql" ]; then v=$(mysql -h${DATABASE_HOST} -P${DATABASE_PORT} -u${DATABASE_USERNAME} --password=${DATABASE_PASSWORD} -D ${DATABASE_DATABASE} -e "SELECT * FROM public.t_ds_version" 2>/dev/null) else v=$(PGPASSWORD=${DATABASE_PASSWORD} psql -h ${DATABASE_HOST} -p ${DATABASE_PORT} -U ${DATABASE_USERNAME} -d ${DATABASE_DATABASE} -tAc "SELECT * FROM public.t_ds_version" 2>/dev/null) fi if [ -n "$v" ]; then echo "ds version: $v" return 0 else return 1 fi } # check init database checkInitDatabase() { echo "check init database" while ! checkDSVersion; do local counter=$((counter+1)) if [ $counter == 30 ]; then echo "Error: Couldn't check init database." exit 1 fi echo "Trying to check init database. Attempt $counter." sleep 5 done } # wait zk waitZK() { echo "connect remote zookeeper" echo "${ZOOKEEPER_QUORUM}" | awk -F ',' 'BEGIN{ i=1 }{ while( i <= NF ){ print $i; i++ } }' | while read line; do while ! nc -z ${line%:*} ${line#*:}; do local counter=$((counter+1)) if [ $counter == 30 ]; then echo "Error: Couldn't connect to zookeeper." exit 1 fi echo "Trying to connect to zookeeper at ${line}. Attempt $counter." sleep 5 done done } # start master-server initMasterServer() { echo "start master-server" ${DOLPHINSCHEDULER_BIN}/dolphinscheduler-daemon.sh stop master-server ${DOLPHINSCHEDULER_BIN}/dolphinscheduler-daemon.sh start master-server } # start worker-server initWorkerServer() { echo "start worker-server" ${DOLPHINSCHEDULER_BIN}/dolphinscheduler-daemon.sh stop worker-server ${DOLPHINSCHEDULER_BIN}/dolphinscheduler-daemon.sh start worker-server } # start api-server initApiServer() { echo "start api-server" ${DOLPHINSCHEDULER_BIN}/dolphinscheduler-daemon.sh stop api-server ${DOLPHINSCHEDULER_BIN}/dolphinscheduler-daemon.sh start api-server } # start logger-server initLoggerServer() { echo "start logger-server" ${DOLPHINSCHEDULER_BIN}/dolphinscheduler-daemon.sh stop logger-server ${DOLPHINSCHEDULER_BIN}/dolphinscheduler-daemon.sh start logger-server } # start alert-server initAlertServer() { echo "start alert-server" ${DOLPHINSCHEDULER_BIN}/dolphinscheduler-daemon.sh stop alert-server ${DOLPHINSCHEDULER_BIN}/dolphinscheduler-daemon.sh start alert-server } # print usage printUsage() { echo -e "Dolphin Scheduler is a distributed and easy-to-expand visual DAG workflow scheduling system," echo -e "dedicated to solving the complex dependencies in data processing, making the scheduling system out of the box for data processing.\n" echo -e "Usage: [ all | master-server | worker-server | api-server | alert-server ]\n" printf "%-13s: %s\n" "all" "Run master-server, worker-server, api-server and alert-server" printf "%-13s: %s\n" "master-server" "MasterServer is mainly responsible for DAG task split, task submission monitoring." printf "%-13s: %s\n" "worker-server" "WorkerServer is mainly responsible for task execution and providing log services." printf "%-13s: %s\n" "api-server" "ApiServer is mainly responsible for processing requests and providing the front-end UI layer." printf "%-13s: %s\n" "alert-server" "AlertServer mainly include Alarms." } # init config file source /root/startup-init-conf.sh case "$1" in (all) waitZK waitDatabase initDatabase initMasterServer initWorkerServer initApiServer initAlertServer initLoggerServer LOGFILE=${DOLPHINSCHEDULER_LOGS}/dolphinscheduler-api.log ;; (master-server) waitZK waitDatabase initMasterServer LOGFILE=${DOLPHINSCHEDULER_LOGS}/dolphinscheduler-master.log ;; (worker-server) waitZK waitDatabase initWorkerServer initLoggerServer LOGFILE=${DOLPHINSCHEDULER_LOGS}/dolphinscheduler-worker.log ;; (api-server) waitZK waitDatabase initDatabase initApiServer LOGFILE=${DOLPHINSCHEDULER_LOGS}/dolphinscheduler-api.log ;; (alert-server) waitDatabase checkInitDatabase initAlertServer LOGFILE=${DOLPHINSCHEDULER_LOGS}/dolphinscheduler-alert.log ;; (help) printUsage exit 1 ;; (*) printUsage exit 1 ;; esac # init directories and log files mkdir -p ${DOLPHINSCHEDULER_LOGS} && cat /dev/null >> ${LOGFILE} echo "tail begin" exec bash -c "tail -n 1 -f ${LOGFILE}"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,897
[Bug][Docker] `docker logs -f` command cannot keep outputting logs all the time
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Run a dolphinscheduler by `docker-compose up -d` 2. Run `docker logs -f dolphinscheduler-master` command 3. Wait more than an hour 4. See error: The logs outputed by `docker logs -f dolphinscheduler-master` are not changed, while the log file in the container contains more log contents by `docker exec -it dolphinscheduler-master cat /opt/dolphinscheduler/logs/dolphinscheduler-master.log` **Bug reason**: Due to log rotation, the `tail` command cannot obtain a new rotation log **Expected behavior** Bug fixed **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4897
https://github.com/apache/dolphinscheduler/pull/4900
d6675259132c7eeebb183782bdc7f09fe04ff21b
cf13c87dae0b30d994f448140f5c7e506d8f3ca4
"2021-02-27T05:14:30Z"
java
"2021-03-04T02:08:03Z"
script/dolphinscheduler-daemon.sh
#!/bin/sh # # 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. # usage="Usage: dolphinscheduler-daemon.sh (start|stop|status) <api-server|master-server|worker-server|alert-server> " # if no args specified, show usage if [ $# -le 1 ]; then echo $usage exit 1 fi startStop=$1 shift command=$1 shift BIN_DIR=`dirname $0` BIN_DIR=`cd "$BIN_DIR"; pwd` DOLPHINSCHEDULER_HOME=$BIN_DIR/.. source /etc/profile export JAVA_HOME=$JAVA_HOME #export JAVA_HOME=/opt/soft/jdk export HOSTNAME=`hostname` export DOLPHINSCHEDULER_PID_DIR=$DOLPHINSCHEDULER_HOME/pid export DOLPHINSCHEDULER_LOG_DIR=$DOLPHINSCHEDULER_HOME/logs export DOLPHINSCHEDULER_CONF_DIR=$DOLPHINSCHEDULER_HOME/conf export DOLPHINSCHEDULER_LIB_JARS=$DOLPHINSCHEDULER_HOME/lib/* export STOP_TIMEOUT=5 if [ ! -d "$DOLPHINSCHEDULER_LOG_DIR" ]; then mkdir $DOLPHINSCHEDULER_LOG_DIR fi log=$DOLPHINSCHEDULER_LOG_DIR/dolphinscheduler-$command-$HOSTNAME.out pid=$DOLPHINSCHEDULER_PID_DIR/dolphinscheduler-$command.pid # print logs to /dev/null in docker if [ "$DOCKER" = "true" ]; then echo "start in docker" log=/dev/null fi cd $DOLPHINSCHEDULER_HOME if [ "$command" = "api-server" ]; then HEAP_INITIAL_SIZE=1g HEAP_MAX_SIZE=1g HEAP_NEW_GENERATION__SIZE=500m LOG_FILE="-Dlogging.config=classpath:logback-api.xml -Dspring.profiles.active=api" CLASS=org.apache.dolphinscheduler.api.ApiApplicationServer elif [ "$command" = "master-server" ]; then HEAP_INITIAL_SIZE=4g HEAP_MAX_SIZE=4g HEAP_NEW_GENERATION__SIZE=2g LOG_FILE="-Dlogging.config=classpath:logback-master.xml -Ddruid.mysql.usePingMethod=false" CLASS=org.apache.dolphinscheduler.server.master.MasterServer elif [ "$command" = "worker-server" ]; then HEAP_INITIAL_SIZE=2g HEAP_MAX_SIZE=2g HEAP_NEW_GENERATION__SIZE=1g LOG_FILE="-Dlogging.config=classpath:logback-worker.xml -Ddruid.mysql.usePingMethod=false" CLASS=org.apache.dolphinscheduler.server.worker.WorkerServer elif [ "$command" = "alert-server" ]; then HEAP_INITIAL_SIZE=1g HEAP_MAX_SIZE=1g HEAP_NEW_GENERATION__SIZE=500m LOG_FILE="-Dlogback.configurationFile=conf/logback-alert.xml" CLASS=org.apache.dolphinscheduler.alert.AlertServer elif [ "$command" = "logger-server" ]; then HEAP_INITIAL_SIZE=1g HEAP_MAX_SIZE=1g HEAP_NEW_GENERATION__SIZE=500m CLASS=org.apache.dolphinscheduler.server.log.LoggerServer elif [ "$command" = "zookeeper-server" ]; then #note: this command just for getting a quick experience,not recommended for production. this operation will start a standalone zookeeper server LOG_FILE="-Dlogback.configurationFile=classpath:logback-zookeeper.xml" CLASS=org.apache.dolphinscheduler.service.zk.ZKServer else echo "Error: No command named \`$command' was found." exit 1 fi export DOLPHINSCHEDULER_OPTS="-server -Xms$HEAP_INITIAL_SIZE -Xmx$HEAP_MAX_SIZE -Xmn$HEAP_NEW_GENERATION__SIZE -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xss512k -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof $DOLPHINSCHEDULER_OPTS" case $startStop in (start) [ -w "$DOLPHINSCHEDULER_PID_DIR" ] || mkdir -p "$DOLPHINSCHEDULER_PID_DIR" if [ -f $pid ]; then if kill -0 `cat $pid` > /dev/null 2>&1; then echo $command running as process `cat $pid`. Stop it first. exit 1 fi fi echo starting $command, logging to $log exec_command="$LOG_FILE $DOLPHINSCHEDULER_OPTS -classpath $DOLPHINSCHEDULER_CONF_DIR:$DOLPHINSCHEDULER_LIB_JARS $CLASS" echo "nohup $JAVA_HOME/bin/java $exec_command > $log 2>&1 &" nohup $JAVA_HOME/bin/java $exec_command > $log 2>&1 & echo $! > $pid ;; (stop) if [ -f $pid ]; then TARGET_PID=`cat $pid` if kill -0 $TARGET_PID > /dev/null 2>&1; then echo stopping $command kill $TARGET_PID sleep $STOP_TIMEOUT if kill -0 $TARGET_PID > /dev/null 2>&1; then echo "$command did not stop gracefully after $STOP_TIMEOUT seconds: killing with kill -9" kill -9 $TARGET_PID fi else echo no $command to stop fi rm -f $pid else echo no $command to stop fi ;; (status) # more details about the status can be added later serverCount=`ps -ef |grep "$CLASS" |grep -v "grep" |wc -l` state="STOP" # font color - red state="[ \033[1;31m $state \033[0m ]" if [[ $serverCount -gt 0 ]];then state="RUNNING" # font color - green state="[ \033[1;32m $state \033[0m ]" fi echo -e "$command $state" ;; (*) echo $usage exit 1 ;; esac echo "End $startStop $command."
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,955
[Bug][Worker] Worker cannot start and alertClientService NullPointerException
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Start worker server 2. See error This issue is introduce by #4626 **Expected behavior** Bug fixed. **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/4902714/109948515-5e9c0300-7d15-11eb-96e6-361036ab58a0.png) ``` org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:na] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:na] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) [classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) [classes/:na] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) [classes/:na] 2021-03-04 17:23:03.016 ERROR 86498 --- [ Worker-Server] o.a.d.server.worker.WorkerServer : org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:na] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) ~[classes/:na] Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:na] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:na] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:na] ... 26 common frames omitted 17:23:03.036 [Worker-Server] ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workerServer': Invocation of init method failed; nested exception is java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) [classes/:?] Caused by: java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:137) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Caused by: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:?] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:?] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:?] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:?] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Exception in thread "Worker-Server" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workerServer': Invocation of init method failed; nested exception is java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) Caused by: java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:137) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ... 16 more Caused by: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ... 23 more Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ... 26 more ``` **Which version of Dolphin Scheduler:** -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4955
https://github.com/apache/dolphinscheduler/pull/4956
01b71f1a0d49b57e8ccbd296d1d4b466ab362c7c
8c68e2c60b50c76c5aacf36b03a107213d2d0a0a
"2021-03-04T10:15:24Z"
java
"2021-03-05T01:50:49Z"
.github/workflows/ci_ut.yml
# # 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. # on: pull_request: push: branches: - dev env: LOG_DIR: /tmp/dolphinscheduler name: Unit Test jobs: build: name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: submodule: true - name: Check License Header uses: apache/skywalking-eyes@ec88b7d850018c8983f87729ea88549e100c5c82 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Only enable review / suggestion here - uses: actions/cache@v1 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - name: Bootstrap database run: | sed -i "s/: root/: test/g" $(pwd)/docker/docker-swarm/docker-compose.yml docker-compose -f $(pwd)/docker/docker-swarm/docker-compose.yml create --force-recreate dolphinscheduler-zookeeper dolphinscheduler-postgresql sudo cp $(pwd)/sql/dolphinscheduler_postgre.sql $(docker volume inspect docker-swarm_dolphinscheduler-postgresql-initdb | grep "Mountpoint" | awk -F "\"" '{print $4}') docker-compose -f $(pwd)/docker/docker-swarm/docker-compose.yml up -d dolphinscheduler-zookeeper dolphinscheduler-postgresql - name: Set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Git fetch unshallow run: | git fetch --unshallow git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" git fetch origin - name: Compile run: | export MAVEN_OPTS='-Dmaven.repo.local=.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx5g' mvn test -B -Dmaven.test.skip=false - name: Upload coverage report to codecov run: | CODECOV_TOKEN="09c2663f-b091-4258-8a47-c981827eb29a" bash <(curl -s https://codecov.io/bash) # Set up JDK 11 for SonarCloud. - name: Set up JDK 1.11 uses: actions/setup-java@v1 with: java-version: 1.11 - name: Run SonarCloud Analysis run: > mvn --batch-mode verify sonar:sonar -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml -Dmaven.test.skip=true -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.core.codeCoveragePlugin=jacoco -Dsonar.projectKey=apache-dolphinscheduler -Dsonar.login=e4058004bc6be89decf558ac819aa1ecbee57682 -Dsonar.exclusions=dolphinscheduler-ui/src/**/i18n/locale/*.js,dolphinscheduler-microbench/src/**/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: Collect logs run: | mkdir -p ${LOG_DIR} docker-compose -f $(pwd)/docker/docker-swarm/docker-compose.yml logs dolphinscheduler-postgresql > ${LOG_DIR}/db.txt continue-on-error: true Checkstyle: name: Check code style runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 with: submodule: true - name: check code style env: WORKDIR: ./ REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} CHECKSTYLE_CONFIG: style/checkstyle.xml REVIEWDOG_VERSION: v0.10.2 run: | wget -O - -q https://github.com/checkstyle/checkstyle/releases/download/checkstyle-8.22/checkstyle-8.22-all.jar > /opt/checkstyle.jar wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b /opt ${REVIEWDOG_VERSION} java -jar /opt/checkstyle.jar "${WORKDIR}" -c "${CHECKSTYLE_CONFIG}" -f xml \ | /opt/reviewdog -f=checkstyle \ -reporter="${INPUT_REPORTER:-github-pr-check}" \ -filter-mode="${INPUT_FILTER_MODE:-added}" \ -fail-on-error="${INPUT_FAIL_ON_ERROR:-false}"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,955
[Bug][Worker] Worker cannot start and alertClientService NullPointerException
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Start worker server 2. See error This issue is introduce by #4626 **Expected behavior** Bug fixed. **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/4902714/109948515-5e9c0300-7d15-11eb-96e6-361036ab58a0.png) ``` org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:na] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:na] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) [classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) [classes/:na] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) [classes/:na] 2021-03-04 17:23:03.016 ERROR 86498 --- [ Worker-Server] o.a.d.server.worker.WorkerServer : org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:na] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) ~[classes/:na] Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:na] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:na] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:na] ... 26 common frames omitted 17:23:03.036 [Worker-Server] ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workerServer': Invocation of init method failed; nested exception is java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) [classes/:?] Caused by: java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:137) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Caused by: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:?] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:?] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:?] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:?] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Exception in thread "Worker-Server" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workerServer': Invocation of init method failed; nested exception is java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) Caused by: java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:137) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ... 16 more Caused by: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ... 23 more Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ... 26 more ``` **Which version of Dolphin Scheduler:** -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4955
https://github.com/apache/dolphinscheduler/pull/4956
01b71f1a0d49b57e8ccbd296d1d4b466ab362c7c
8c68e2c60b50c76c5aacf36b03a107213d2d0a0a
"2021-03-04T10:15:24Z"
java
"2021-03-05T01:50:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java
/* * 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.dolphinscheduler.server.master; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.IStoppable; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.remote.NettyRemotingServer; import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.config.NettyServerConfig; import org.apache.dolphinscheduler.server.master.config.MasterConfig; import org.apache.dolphinscheduler.server.master.processor.TaskAckProcessor; import org.apache.dolphinscheduler.server.master.processor.TaskKillResponseProcessor; import org.apache.dolphinscheduler.server.master.processor.TaskResponseProcessor; import org.apache.dolphinscheduler.server.master.registry.MasterRegistry; import org.apache.dolphinscheduler.server.master.runner.MasterSchedulerService; import org.apache.dolphinscheduler.server.worker.WorkerServer; import org.apache.dolphinscheduler.server.zk.ZKMasterClient; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; import org.apache.dolphinscheduler.service.quartz.QuartzExecutors; import javax.annotation.PostConstruct; import org.quartz.SchedulerException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.WebApplicationType; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.FilterType; @ComponentScan(value = "org.apache.dolphinscheduler", excludeFilters = { @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {WorkerServer.class}) }) public class MasterServer implements IStoppable { /** * logger of MasterServer */ private static final Logger logger = LoggerFactory.getLogger(MasterServer.class); /** * master config */ @Autowired private MasterConfig masterConfig; /** * spring application context * only use it for initialization */ @Autowired private SpringApplicationContext springApplicationContext; /** * netty remote server */ private NettyRemotingServer nettyRemotingServer; /** * master registry */ @Autowired private MasterRegistry masterRegistry; /** * zk master client */ @Autowired private ZKMasterClient zkMasterClient; /** * scheduler service */ @Autowired private MasterSchedulerService masterSchedulerService; /** * master server startup * <p> * master server not use web service * * @param args arguments */ public static void main(String[] args) { Thread.currentThread().setName(Constants.THREAD_NAME_MASTER_SERVER); new SpringApplicationBuilder(MasterServer.class).web(WebApplicationType.NONE).run(args); } /** * run master server */ @PostConstruct public void run() { try { //init remoting server NettyServerConfig serverConfig = new NettyServerConfig(); serverConfig.setListenPort(masterConfig.getListenPort()); this.nettyRemotingServer = new NettyRemotingServer(serverConfig); this.nettyRemotingServer.registerProcessor(CommandType.TASK_EXECUTE_RESPONSE, new TaskResponseProcessor()); this.nettyRemotingServer.registerProcessor(CommandType.TASK_EXECUTE_ACK, new TaskAckProcessor()); this.nettyRemotingServer.registerProcessor(CommandType.TASK_KILL_RESPONSE, new TaskKillResponseProcessor()); this.nettyRemotingServer.start(); this.masterRegistry.getZookeeperRegistryCenter().setStoppable(this); } catch (Exception e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } // self tolerant this.zkMasterClient.start(); // scheduler start this.masterSchedulerService.start(); // start QuartzExecutors // what system should do if exception try { logger.info("start Quartz server..."); QuartzExecutors.getInstance().start(); } catch (Exception e) { try { QuartzExecutors.getInstance().shutdown(); } catch (SchedulerException e1) { logger.error("QuartzExecutors shutdown failed : " + e1.getMessage(), e1); } logger.error("start Quartz failed", e); } /** * register hooks, which are called before the process exits */ Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { if (Stopper.isRunning()) { close("shutdownHook"); } } })); } /** * gracefully close * * @param cause close cause */ public void close(String cause) { try { //execute only once if (Stopper.isStopped()) { return; } logger.info("master server is stopping ..., cause : {}", cause); // set stop signal is true Stopper.stop(); try { //thread sleep 3 seconds for thread quietly stop Thread.sleep(3000L); } catch (Exception e) { logger.warn("thread sleep exception ", e); } // this.masterSchedulerService.close(); this.nettyRemotingServer.close(); this.masterRegistry.unRegistry(); this.zkMasterClient.close(); //close quartz try { QuartzExecutors.getInstance().shutdown(); logger.info("Quartz service stopped"); } catch (Exception e) { logger.warn("Quartz service stopped exception:{}", e.getMessage()); } } catch (Exception e) { logger.error("master server stop exception ", e); } finally { System.exit(-1); } } @Override public void stop(String cause) { close(cause); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,955
[Bug][Worker] Worker cannot start and alertClientService NullPointerException
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Start worker server 2. See error This issue is introduce by #4626 **Expected behavior** Bug fixed. **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/4902714/109948515-5e9c0300-7d15-11eb-96e6-361036ab58a0.png) ``` org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:na] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:na] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) [classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) [classes/:na] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) [classes/:na] 2021-03-04 17:23:03.016 ERROR 86498 --- [ Worker-Server] o.a.d.server.worker.WorkerServer : org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:na] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) ~[classes/:na] Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:na] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:na] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:na] ... 26 common frames omitted 17:23:03.036 [Worker-Server] ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workerServer': Invocation of init method failed; nested exception is java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) [classes/:?] Caused by: java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:137) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Caused by: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:?] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:?] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:?] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:?] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Exception in thread "Worker-Server" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workerServer': Invocation of init method failed; nested exception is java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) Caused by: java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:137) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ... 16 more Caused by: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ... 23 more Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ... 26 more ``` **Which version of Dolphin Scheduler:** -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4955
https://github.com/apache/dolphinscheduler/pull/4956
01b71f1a0d49b57e8ccbd296d1d4b466ab362c7c
8c68e2c60b50c76c5aacf36b03a107213d2d0a0a
"2021-03-04T10:15:24Z"
java
"2021-03-05T01:50:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
/* * 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.dolphinscheduler.server.worker; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.IStoppable; import org.apache.dolphinscheduler.common.enums.ZKNodeType; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.remote.NettyRemotingServer; import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.config.NettyServerConfig; import org.apache.dolphinscheduler.server.worker.config.WorkerConfig; import org.apache.dolphinscheduler.server.worker.processor.DBTaskAckProcessor; import org.apache.dolphinscheduler.server.worker.processor.DBTaskResponseProcessor; import org.apache.dolphinscheduler.server.worker.processor.TaskExecuteProcessor; import org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor; import org.apache.dolphinscheduler.server.worker.registry.WorkerRegistry; import org.apache.dolphinscheduler.server.worker.runner.RetryReportTaskStatusThread; import org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread; import org.apache.dolphinscheduler.service.alert.AlertClientService; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; import java.util.Set; import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.WebApplicationType; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.context.annotation.ComponentScan; /** * worker server */ @ComponentScan("org.apache.dolphinscheduler") public class WorkerServer implements IStoppable { /** * logger */ private static final Logger logger = LoggerFactory.getLogger(WorkerServer.class); /** * netty remote server */ private NettyRemotingServer nettyRemotingServer; /** * worker registry */ @Autowired private WorkerRegistry workerRegistry; /** * worker config */ @Autowired private WorkerConfig workerConfig; /** * spring application context * only use it for initialization */ @Autowired private SpringApplicationContext springApplicationContext; /** * alert model netty remote server */ private AlertClientService alertClientService; @Autowired private RetryReportTaskStatusThread retryReportTaskStatusThread; @Autowired private WorkerManagerThread workerManagerThread; /** * worker server startup * * worker server not use web service * @param args arguments */ public static void main(String[] args) { Thread.currentThread().setName(Constants.THREAD_NAME_WORKER_SERVER); new SpringApplicationBuilder(WorkerServer.class).web(WebApplicationType.NONE).run(args); } /** * worker server run */ @PostConstruct public void run() { try { logger.info("start worker server..."); //init remoting server NettyServerConfig serverConfig = new NettyServerConfig(); serverConfig.setListenPort(workerConfig.getListenPort()); this.nettyRemotingServer = new NettyRemotingServer(serverConfig); this.nettyRemotingServer.registerProcessor(CommandType.TASK_EXECUTE_REQUEST, new TaskExecuteProcessor()); this.nettyRemotingServer.registerProcessor(CommandType.TASK_KILL_REQUEST, new TaskKillProcessor()); this.nettyRemotingServer.registerProcessor(CommandType.DB_TASK_ACK, new DBTaskAckProcessor()); this.nettyRemotingServer.registerProcessor(CommandType.DB_TASK_RESPONSE, new DBTaskResponseProcessor()); this.nettyRemotingServer.start(); this.workerRegistry.getZookeeperRegistryCenter().setStoppable(this); Set<String> workerZkPaths = this.workerRegistry.getWorkerZkPaths(); this.workerRegistry.getZookeeperRegistryCenter().getRegisterOperator().handleDeadServer(workerZkPaths, ZKNodeType.WORKER, Constants.DELETE_ZK_OP); // worker registry this.workerRegistry.registry(); // retry report task status this.retryReportTaskStatusThread.start(); } catch (Exception e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } // task execute manager this.workerManagerThread.start(); // retry report task status this.retryReportTaskStatusThread.start(); /** * register hooks, which are called before the process exits */ Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { if (Stopper.isRunning()) { close("shutdownHook"); } } })); } public void close(String cause) { try { //execute only once if (Stopper.isStopped()) { return; } logger.info("worker server is stopping ..., cause : {}", cause); // set stop signal is true Stopper.stop(); try { //thread sleep 3 seconds for thread quitely stop Thread.sleep(3000L); } catch (Exception e) { logger.warn("thread sleep exception", e); } this.nettyRemotingServer.close(); this.workerRegistry.unRegistry(); this.alertClientService.close(); } catch (Exception e) { logger.error("worker server stop exception ", e); } finally { System.exit(-1); } } @Override public void stop(String cause) { close(cause); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,955
[Bug][Worker] Worker cannot start and alertClientService NullPointerException
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Start worker server 2. See error This issue is introduce by #4626 **Expected behavior** Bug fixed. **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/4902714/109948515-5e9c0300-7d15-11eb-96e6-361036ab58a0.png) ``` org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:na] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:na] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) [classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) [classes/:na] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) [classes/:na] 2021-03-04 17:23:03.016 ERROR 86498 --- [ Worker-Server] o.a.d.server.worker.WorkerServer : org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:na] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) ~[classes/:na] Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:na] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:na] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:na] ... 26 common frames omitted 17:23:03.036 [Worker-Server] ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workerServer': Invocation of init method failed; nested exception is java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) [classes/:?] Caused by: java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:137) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Caused by: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:?] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:?] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:?] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:?] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Exception in thread "Worker-Server" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workerServer': Invocation of init method failed; nested exception is java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) Caused by: java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:137) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ... 16 more Caused by: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ... 23 more Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ... 26 more ``` **Which version of Dolphin Scheduler:** -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4955
https://github.com/apache/dolphinscheduler/pull/4956
01b71f1a0d49b57e8ccbd296d1d4b466ab362c7c
8c68e2c60b50c76c5aacf36b03a107213d2d0a0a
"2021-03-04T10:15:24Z"
java
"2021-03-05T01:50:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
/* * 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.dolphinscheduler.server.zk; import static org.apache.dolphinscheduler.common.Constants.SLEEP_TIME_MILLIS; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.ZKNodeType; import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.common.thread.ThreadUtils; import org.apache.dolphinscheduler.common.utils.NetUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.remote.utils.Host; import org.apache.dolphinscheduler.server.builder.TaskExecutionContextBuilder; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.server.master.registry.MasterRegistry; import org.apache.dolphinscheduler.server.utils.ProcessUtils; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.zk.AbstractZKClient; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.recipes.cache.TreeCacheEvent; import org.apache.curator.framework.recipes.locks.InterProcessMutex; import java.util.Date; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * zookeeper master client * <p> * single instance */ @Component public class ZKMasterClient extends AbstractZKClient { /** * logger */ private static final Logger logger = LoggerFactory.getLogger(ZKMasterClient.class); /** * process service */ @Autowired private ProcessService processService; /** * master registry */ @Autowired private MasterRegistry masterRegistry; public void start() { InterProcessMutex mutex = null; try { // create distributed lock with the root node path of the lock space as /dolphinscheduler/lock/failover/master String znodeLock = getMasterStartUpLockPath(); mutex = new InterProcessMutex(getZkClient(), znodeLock); mutex.acquire(); // Master registry masterRegistry.registry(); String registPath = this.masterRegistry.getMasterPath(); masterRegistry.getZookeeperRegistryCenter().getRegisterOperator().handleDeadServer(registPath, ZKNodeType.MASTER, Constants.DELETE_ZK_OP); // init system znode this.initSystemZNode(); while (!checkZKNodeExists(NetUtils.getHost(), ZKNodeType.MASTER)) { ThreadUtils.sleep(SLEEP_TIME_MILLIS); } // self tolerant if (getActiveMasterNum() == 1) { removeZKNodePath(null, ZKNodeType.MASTER, true); removeZKNodePath(null, ZKNodeType.WORKER, true); } registerListener(); } catch (Exception e) { logger.error("master start up exception", e); } finally { releaseMutex(mutex); } } @Override public void close() { super.close(); masterRegistry.unRegistry(); } /** * handle path events that this class cares about * * @param client zkClient * @param event path event * @param path zk path */ @Override protected void dataChanged(CuratorFramework client, TreeCacheEvent event, String path) { //monitor master if (path.startsWith(getZNodeParentPath(ZKNodeType.MASTER) + Constants.SINGLE_SLASH)) { handleMasterEvent(event, path); } else if (path.startsWith(getZNodeParentPath(ZKNodeType.WORKER) + Constants.SINGLE_SLASH)) { //monitor worker handleWorkerEvent(event, path); } } /** * remove zookeeper node path * * @param path zookeeper node path * @param zkNodeType zookeeper node type * @param failover is failover */ private void removeZKNodePath(String path, ZKNodeType zkNodeType, boolean failover) { logger.info("{} node deleted : {}", zkNodeType.toString(), path); InterProcessMutex mutex = null; try { String failoverPath = getFailoverLockPath(zkNodeType); // create a distributed lock mutex = new InterProcessMutex(getZkClient(), failoverPath); mutex.acquire(); String serverHost = null; if (StringUtils.isNotEmpty(path)) { serverHost = getHostByEventDataPath(path); if (StringUtils.isEmpty(serverHost)) { logger.error("server down error: unknown path: {}", path); return; } // handle dead server handleDeadServer(path, zkNodeType, Constants.ADD_ZK_OP); } //failover server if (failover) { failoverServerWhenDown(serverHost, zkNodeType); } } catch (Exception e) { logger.error("{} server failover failed.", zkNodeType.toString()); logger.error("failover exception ", e); } finally { releaseMutex(mutex); } } /** * failover server when server down * * @param serverHost server host * @param zkNodeType zookeeper node type * @throws Exception exception */ private void failoverServerWhenDown(String serverHost, ZKNodeType zkNodeType) throws Exception { if (StringUtils.isEmpty(serverHost)) { return; } switch (zkNodeType) { case MASTER: failoverMaster(serverHost); break; case WORKER: failoverWorker(serverHost, true); break; default: break; } } /** * get failover lock path * * @param zkNodeType zookeeper node type * @return fail over lock path */ private String getFailoverLockPath(ZKNodeType zkNodeType) { switch (zkNodeType) { case MASTER: return getMasterFailoverLockPath(); case WORKER: return getWorkerFailoverLockPath(); default: return ""; } } /** * monitor master * * @param event event * @param path path */ public void handleMasterEvent(TreeCacheEvent event, String path) { switch (event.getType()) { case NODE_ADDED: logger.info("master node added : {}", path); break; case NODE_REMOVED: removeZKNodePath(path, ZKNodeType.MASTER, true); break; default: break; } } /** * monitor worker * * @param event event * @param path path */ public void handleWorkerEvent(TreeCacheEvent event, String path) { switch (event.getType()) { case NODE_ADDED: logger.info("worker node added : {}", path); break; case NODE_REMOVED: logger.info("worker node deleted : {}", path); removeZKNodePath(path, ZKNodeType.WORKER, true); break; default: break; } } /** * task needs failover if task start before worker starts * * @param taskInstance task instance * @return true if task instance need fail over */ private boolean checkTaskInstanceNeedFailover(TaskInstance taskInstance) throws Exception { boolean taskNeedFailover = true; //now no host will execute this task instance,so no need to failover the task if (taskInstance.getHost() == null) { return false; } // if the worker node exists in zookeeper, we must check the task starts after the worker if (checkZKNodeExists(taskInstance.getHost(), ZKNodeType.WORKER)) { //if task start after worker starts, there is no need to failover the task. if (checkTaskAfterWorkerStart(taskInstance)) { taskNeedFailover = false; } } return taskNeedFailover; } /** * check task start after the worker server starts. * * @param taskInstance task instance * @return true if task instance start time after worker server start date */ private boolean checkTaskAfterWorkerStart(TaskInstance taskInstance) { if (StringUtils.isEmpty(taskInstance.getHost())) { return false; } Date workerServerStartDate = null; List<Server> workerServers = getServersList(ZKNodeType.WORKER); for (Server workerServer : workerServers) { if (taskInstance.getHost().equals(workerServer.getHost() + Constants.COLON + workerServer.getPort())) { workerServerStartDate = workerServer.getCreateTime(); break; } } if (workerServerStartDate != null) { return taskInstance.getStartTime().after(workerServerStartDate); } return false; } /** * failover worker tasks * <p> * 1. kill yarn job if there are yarn jobs in tasks. * 2. change task state from running to need failover. * 3. failover all tasks when workerHost is null * * @param workerHost worker host * @param needCheckWorkerAlive need check worker alive * @throws Exception exception */ private void failoverWorker(String workerHost, boolean needCheckWorkerAlive) throws Exception { workerHost = Host.of(workerHost).getAddress(); logger.info("start worker[{}] failover ...", workerHost); List<TaskInstance> needFailoverTaskInstanceList = processService.queryNeedFailoverTaskInstances(workerHost); for (TaskInstance taskInstance : needFailoverTaskInstanceList) { if (needCheckWorkerAlive) { if (!checkTaskInstanceNeedFailover(taskInstance)) { continue; } } ProcessInstance processInstance = processService.findProcessInstanceDetailById(taskInstance.getProcessInstanceId()); if (processInstance != null) { taskInstance.setProcessInstance(processInstance); } TaskExecutionContext taskExecutionContext = TaskExecutionContextBuilder.get() .buildTaskInstanceRelatedInfo(taskInstance) .buildProcessInstanceRelatedInfo(processInstance) .create(); // only kill yarn job if exists , the local thread has exited ProcessUtils.killYarnJob(taskExecutionContext); taskInstance.setState(ExecutionStatus.NEED_FAULT_TOLERANCE); processService.saveTaskInstance(taskInstance); } logger.info("end worker[{}] failover ...", workerHost); } /** * failover master tasks * * @param masterHost master host */ private void failoverMaster(String masterHost) { logger.info("start master failover ..."); List<ProcessInstance> needFailoverProcessInstanceList = processService.queryNeedFailoverProcessInstances(masterHost); logger.info("failover process list size:{} ", needFailoverProcessInstanceList.size()); //updateProcessInstance host is null and insert into command for (ProcessInstance processInstance : needFailoverProcessInstanceList) { logger.info("failover process instance id: {} host:{}", processInstance.getId(), processInstance.getHost()); if (Constants.NULL.equals(processInstance.getHost())) { continue; } processService.processNeedFailoverProcessInstances(processInstance); } logger.info("master failover end"); } public InterProcessMutex blockAcquireMutex() throws Exception { InterProcessMutex mutex = new InterProcessMutex(getZkClient(), getMasterLockPath()); mutex.acquire(); return mutex; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,955
[Bug][Worker] Worker cannot start and alertClientService NullPointerException
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Start worker server 2. See error This issue is introduce by #4626 **Expected behavior** Bug fixed. **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/4902714/109948515-5e9c0300-7d15-11eb-96e6-361036ab58a0.png) ``` org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:na] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:na] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) [classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) [classes/:na] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) [classes/:na] 2021-03-04 17:23:03.016 ERROR 86498 --- [ Worker-Server] o.a.d.server.worker.WorkerServer : org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:na] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) ~[classes/:na] Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:na] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:na] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:na] ... 26 common frames omitted 17:23:03.036 [Worker-Server] ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workerServer': Invocation of init method failed; nested exception is java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) [classes/:?] Caused by: java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:137) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Caused by: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:?] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:?] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:?] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:?] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Exception in thread "Worker-Server" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workerServer': Invocation of init method failed; nested exception is java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) Caused by: java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:137) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ... 16 more Caused by: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ... 23 more Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ... 26 more ``` **Which version of Dolphin Scheduler:** -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4955
https://github.com/apache/dolphinscheduler/pull/4956
01b71f1a0d49b57e8ccbd296d1d4b466ab362c7c
8c68e2c60b50c76c5aacf36b03a107213d2d0a0a
"2021-03-04T10:15:24Z"
java
"2021-03-05T01:50:49Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/ZookeeperOperator.java
/* * 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.dolphinscheduler.service.zk; import static org.apache.dolphinscheduler.common.utils.Preconditions.checkNotNull; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.service.exceptions.ServiceException; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.CuratorFrameworkFactory; import org.apache.curator.framework.api.ACLProvider; import org.apache.curator.framework.state.ConnectionState; import org.apache.curator.retry.ExponentialBackoffRetry; import org.apache.curator.utils.CloseableUtils; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.ZooDefs; import org.apache.zookeeper.data.ACL; import org.apache.zookeeper.data.Stat; import java.nio.charset.StandardCharsets; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * zk base operator */ @Component public class ZookeeperOperator implements InitializingBean { private final Logger logger = LoggerFactory.getLogger(ZookeeperOperator.class); @Autowired private ZookeeperConfig zookeeperConfig; protected CuratorFramework zkClient; @Override public void afterPropertiesSet() throws Exception { this.zkClient = buildClient(); initStateListener(); treeCacheStart(); } /** * this method is for sub class, */ protected void registerListener() { // Used by sub class } protected void treeCacheStart() { // Used by sub class } public void initStateListener() { checkNotNull(zkClient); zkClient.getConnectionStateListenable().addListener((client, newState) -> { if (newState == ConnectionState.LOST) { logger.error("connection lost from zookeeper"); } else if (newState == ConnectionState.RECONNECTED) { logger.info("reconnected to zookeeper"); } else if (newState == ConnectionState.SUSPENDED) { logger.warn("connection SUSPENDED to zookeeper"); } }); } private CuratorFramework buildClient() { logger.info("zookeeper registry center init, server lists is: {}.", zookeeperConfig.getServerList()); CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder().ensembleProvider(new DefaultEnsembleProvider(checkNotNull(zookeeperConfig.getServerList(), "zookeeper quorum can't be null"))) .retryPolicy(new ExponentialBackoffRetry(zookeeperConfig.getBaseSleepTimeMs(), zookeeperConfig.getMaxRetries(), zookeeperConfig.getMaxSleepMs())); //these has default value if (0 != zookeeperConfig.getSessionTimeoutMs()) { builder.sessionTimeoutMs(zookeeperConfig.getSessionTimeoutMs()); } if (0 != zookeeperConfig.getConnectionTimeoutMs()) { builder.connectionTimeoutMs(zookeeperConfig.getConnectionTimeoutMs()); } if (StringUtils.isNotBlank(zookeeperConfig.getDigest())) { builder.authorization("digest", zookeeperConfig.getDigest().getBytes(StandardCharsets.UTF_8)).aclProvider(new ACLProvider() { @Override public List<ACL> getDefaultAcl() { return ZooDefs.Ids.CREATOR_ALL_ACL; } @Override public List<ACL> getAclForPath(final String path) { return ZooDefs.Ids.CREATOR_ALL_ACL; } }); } zkClient = builder.build(); zkClient.start(); try { zkClient.blockUntilConnected(); } catch (final Exception ex) { throw new ServiceException(ex); } return zkClient; } public String get(final String key) { try { return new String(zkClient.getData().forPath(key), StandardCharsets.UTF_8); } catch (Exception ex) { logger.error("get key : {}", key, ex); } return null; } public List<String> getChildrenKeys(final String key) { List<String> values; try { values = zkClient.getChildren().forPath(key); return values; } catch (InterruptedException ex) { logger.error("getChildrenKeys key : {} InterruptedException", key); throw new IllegalStateException(ex); } catch (Exception ex) { logger.error("getChildrenKeys key : {}", key, ex); throw new ServiceException(ex); } } public boolean hasChildren(final String key) { Stat stat; try { stat = zkClient.checkExists().forPath(key); return stat.getNumChildren() >= 1; } catch (Exception ex) { throw new IllegalStateException(ex); } } public boolean isExisted(final String key) { try { return zkClient.checkExists().forPath(key) != null; } catch (Exception ex) { logger.error("isExisted key : {}", key, ex); } return false; } public void persist(final String key, final String value) { try { if (!isExisted(key)) { zkClient.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT).forPath(key, value.getBytes(StandardCharsets.UTF_8)); } else { update(key, value); } } catch (Exception ex) { logger.error("persist key : {} , value : {}", key, value, ex); } } public void update(final String key, final String value) { try { zkClient.inTransaction().check().forPath(key).and().setData().forPath(key, value.getBytes(StandardCharsets.UTF_8)).and().commit(); } catch (Exception ex) { logger.error("update key : {} , value : {}", key, value, ex); } } public void persistEphemeral(final String key, final String value) { try { if (isExisted(key)) { try { zkClient.delete().deletingChildrenIfNeeded().forPath(key); } catch (KeeperException.NoNodeException ignore) { //NOP } } zkClient.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(key, value.getBytes(StandardCharsets.UTF_8)); } catch (final Exception ex) { logger.error("persistEphemeral key : {} , value : {}", key, value, ex); } } public void persistEphemeral(String key, String value, boolean overwrite) { try { if (overwrite) { persistEphemeral(key, value); } else { if (!isExisted(key)) { zkClient.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(key, value.getBytes(StandardCharsets.UTF_8)); } } } catch (final Exception ex) { logger.error("persistEphemeral key : {} , value : {}, overwrite : {}", key, value, overwrite, ex); } } public void persistEphemeralSequential(final String key, String value) { try { zkClient.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL_SEQUENTIAL).forPath(key, value.getBytes(StandardCharsets.UTF_8)); } catch (final Exception ex) { logger.error("persistEphemeralSequential key : {}", key, ex); } } public void remove(final String key) { try { if (isExisted(key)) { zkClient.delete().deletingChildrenIfNeeded().forPath(key); } } catch (KeeperException.NoNodeException ignore) { //NOP } catch (final Exception ex) { logger.error("remove key : {}", key, ex); } } public CuratorFramework getZkClient() { return zkClient; } public ZookeeperConfig getZookeeperConfig() { return zookeeperConfig; } public void close() { CloseableUtils.closeQuietly(zkClient); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,955
[Bug][Worker] Worker cannot start and alertClientService NullPointerException
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Start worker server 2. See error This issue is introduce by #4626 **Expected behavior** Bug fixed. **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/4902714/109948515-5e9c0300-7d15-11eb-96e6-361036ab58a0.png) ``` org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:na] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:na] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) [classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) [classes/:na] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) [classes/:na] 2021-03-04 17:23:03.016 ERROR 86498 --- [ Worker-Server] o.a.d.server.worker.WorkerServer : org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:na] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:na] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) ~[spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) ~[classes/:na] Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:na] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:na] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:na] ... 26 common frames omitted 17:23:03.036 [Worker-Server] ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workerServer': Invocation of init method failed; nested exception is java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) [spring-boot-2.1.17.RELEASE.jar:2.1.17.RELEASE] at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) [classes/:?] Caused by: java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:137) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Caused by: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:?] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) ~[zookeeper-3.4.14.jar:3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) ~[curator-client-4.3.0.jar:?] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) ~[curator-client-4.3.0.jar:?] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.3.0.jar:4.3.0] at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) ~[classes/:?] at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) ~[classes/:?] at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ~[classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE] ... 16 more Exception in thread "Worker-Server" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workerServer': Invocation of init method failed; nested exception is java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:139) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:413) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1761) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) at org.apache.dolphinscheduler.server.worker.WorkerServer.main(WorkerServer.java:105) Caused by: java.lang.RuntimeException: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:137) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ... 16 more Caused by: org.apache.dolphinscheduler.service.exceptions.ServiceException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:148) at org.apache.dolphinscheduler.service.zk.RegisterOperator.removeDeadServerByHost(RegisterOperator.java:61) at org.apache.dolphinscheduler.service.zk.RegisterOperator.handleDeadServer(RegisterOperator.java:138) at org.apache.dolphinscheduler.server.worker.WorkerServer.run(WorkerServer.java:129) ... 23 more Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/dead-servers at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:141) ... 26 more ``` **Which version of Dolphin Scheduler:** -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4955
https://github.com/apache/dolphinscheduler/pull/4956
01b71f1a0d49b57e8ccbd296d1d4b466ab362c7c
8c68e2c60b50c76c5aacf36b03a107213d2d0a0a
"2021-03-04T10:15:24Z"
java
"2021-03-05T01:50:49Z"
dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/zk/RegisterOperatorTest.java
/* * 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.dolphinscheduler.service.zk; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ZKNodeType; import java.util.concurrent.TimeUnit; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; /** * register operator test */ @RunWith(MockitoJUnitRunner.Silent.class) public class RegisterOperatorTest { private static ZKServer zkServer; @InjectMocks private RegisterOperator registerOperator; @Mock private ZookeeperConfig zookeeperConfig; private static final String DS_ROOT = "/dolphinscheduler"; private static final String MASTER_NODE = "127.0.0.1:5678"; @Before public void before() { new Thread(() -> { if (zkServer == null) { zkServer = new ZKServer(); } zkServer.startLocalZkServer(2185); }).start(); } @Test public void testAfterPropertiesSet() throws Exception { TimeUnit.SECONDS.sleep(10); Mockito.when(zookeeperConfig.getServerList()).thenReturn("127.0.0.1:2185"); Mockito.when(zookeeperConfig.getBaseSleepTimeMs()).thenReturn(100); Mockito.when(zookeeperConfig.getMaxRetries()).thenReturn(10); Mockito.when(zookeeperConfig.getMaxSleepMs()).thenReturn(30000); Mockito.when(zookeeperConfig.getSessionTimeoutMs()).thenReturn(60000); Mockito.when(zookeeperConfig.getConnectionTimeoutMs()).thenReturn(30000); Mockito.when(zookeeperConfig.getDigest()).thenReturn(""); Mockito.when(zookeeperConfig.getDsRoot()).thenReturn(DS_ROOT); Mockito.when(zookeeperConfig.getMaxWaitTime()).thenReturn(30000); registerOperator.afterPropertiesSet(); Assert.assertNotNull(registerOperator.getZkClient()); } @After public void after() { if (zkServer != null) { zkServer.stop(); } } @Test public void testGetDeadZNodeParentPath() throws Exception { testAfterPropertiesSet(); String path = registerOperator.getDeadZNodeParentPath(); Assert.assertEquals(DS_ROOT + Constants.ZOOKEEPER_DOLPHINSCHEDULER_DEAD_SERVERS, path); } @Test public void testHandleDeadServer() throws Exception { testAfterPropertiesSet(); registerOperator.handleDeadServer(MASTER_NODE, ZKNodeType.MASTER,Constants.ADD_ZK_OP); String path = registerOperator.getDeadZNodeParentPath(); Assert.assertTrue(registerOperator.getChildrenKeys(path).contains(String.format("%s_%s",Constants.MASTER_PREFIX,MASTER_NODE))); } @Test public void testRemoveDeadServerByHost() throws Exception { testAfterPropertiesSet(); String path = registerOperator.getDeadZNodeParentPath(); registerOperator.handleDeadServer(MASTER_NODE, ZKNodeType.MASTER,Constants.ADD_ZK_OP); Assert.assertTrue(registerOperator.getChildrenKeys(path).contains(String.format("%s_%s",Constants.MASTER_PREFIX,MASTER_NODE))); registerOperator.removeDeadServerByHost(MASTER_NODE,Constants.MASTER_PREFIX); Assert.assertFalse(registerOperator.getChildrenKeys(path).contains(String.format("%s_%s",Constants.MASTER_PREFIX,MASTER_NODE))); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,705
[Bug][API] KeeperException$NoNodeException
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Start an initial DB and ZK, run `CreateDolphinScheduler` to import sql data 2. Start UI and API, DO NOT start master and worker 3. Click 'Create process' 4. Drag a task icon to dag editor 5. See error **Expected behavior** Exception can be captured and friendly information can be prompted in UI. **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/4902714/107109032-d04c7280-6877-11eb-9cb9-910c8f5d61dd.png) API log: ``` [ERROR] 2021-02-06 12:25:08.744 org.apache.dolphinscheduler.service.zk.ZookeeperOperator:[138] - getChildrenKeys key : /dolphinscheduler/nodes/worker org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/nodes/worker at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:132) at org.apache.dolphinscheduler.api.service.WorkerGroupService.getWorkerGroups(WorkerGroupService.java:132) at org.apache.dolphinscheduler.api.service.WorkerGroupService.queryAllGroup(WorkerGroupService.java:113) at org.apache.dolphinscheduler.api.controller.WorkerGroupController.queryAllWorkerGroups(WorkerGroupController.java:103) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:867) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623) at com.github.xiaoymin.swaggerbootstrapui.filter.SecurityBasicAuthFilter.doFilter(SecurityBasicAuthFilter.java:84) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at com.github.xiaoymin.swaggerbootstrapui.filter.ProductionSecurityFilter.doFilter(ProductionSecurityFilter.java:53) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:753) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:502) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683) at java.lang.Thread.run(Thread.java:748) [ERROR] 2021-02-06 12:25:08.749 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[45] - 查询worker分组失败 java.lang.RuntimeException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/nodes/worker at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:139) at org.apache.dolphinscheduler.api.service.WorkerGroupService.getWorkerGroups(WorkerGroupService.java:132) at org.apache.dolphinscheduler.api.service.WorkerGroupService.queryAllGroup(WorkerGroupService.java:113) at org.apache.dolphinscheduler.api.controller.WorkerGroupController.queryAllWorkerGroups(WorkerGroupController.java:103) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:867) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623) at com.github.xiaoymin.swaggerbootstrapui.filter.SecurityBasicAuthFilter.doFilter(SecurityBasicAuthFilter.java:84) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at com.github.xiaoymin.swaggerbootstrapui.filter.ProductionSecurityFilter.doFilter(ProductionSecurityFilter.java:53) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:753) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:502) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/nodes/worker at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:132) ... 71 common frames omitted ``` **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4705
https://github.com/apache/dolphinscheduler/pull/4961
e851ec13671af7d68792cc134175c4a5d6c01f20
8112f5bcb5c27a2b48fbfff2fe9a5c6595b0273d
"2021-02-06T04:35:45Z"
java
"2021-03-05T13:34:54Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
/* * 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.dolphinscheduler.api.service.impl; import static org.apache.dolphinscheduler.common.Constants.DEFAULT_WORKER_GROUP; import static org.apache.dolphinscheduler.common.Constants.SLASH; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.WorkerGroupService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.entity.WorkerGroup; import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; import org.apache.dolphinscheduler.remote.utils.Host; import org.apache.dolphinscheduler.service.zk.ZookeeperCachedOperator; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * worker group service impl */ @Service public class WorkerGroupServiceImpl extends BaseServiceImpl implements WorkerGroupService { private static final String NO_NODE_EXCEPTION_REGEX = "KeeperException$NoNodeException"; @Autowired protected ZookeeperCachedOperator zookeeperCachedOperator; @Autowired ProcessInstanceMapper processInstanceMapper; /** * query worker group paging * * @param loginUser login user * @param pageNo page number * @param searchVal search value * @param pageSize page size * @return worker group list page */ @Override public Map<String, Object> queryAllGroupPaging(User loginUser, Integer pageNo, Integer pageSize, String searchVal) { // list from index int fromIndex = (pageNo - 1) * pageSize; // list to index int toIndex = (pageNo - 1) * pageSize + pageSize; Map<String, Object> result = new HashMap<>(); if (isNotAdmin(loginUser, result)) { return result; } List<WorkerGroup> workerGroups = getWorkerGroups(true); List<WorkerGroup> resultDataList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(workerGroups)) { List<WorkerGroup> searchValDataList = new ArrayList<>(); if (StringUtils.isNotEmpty(searchVal)) { for (WorkerGroup workerGroup : workerGroups) { if (workerGroup.getName().contains(searchVal)) { searchValDataList.add(workerGroup); } } } else { searchValDataList = workerGroups; } if (searchValDataList.size() < pageSize) { toIndex = (pageNo - 1) * pageSize + searchValDataList.size(); } resultDataList = searchValDataList.subList(fromIndex, toIndex); } PageInfo<WorkerGroup> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotalCount(resultDataList.size()); pageInfo.setLists(resultDataList); result.put(Constants.DATA_LIST, pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * query all worker group * * @return all worker group list */ @Override public Map<String, Object> queryAllGroup() { Map<String, Object> result = new HashMap<>(); List<WorkerGroup> workerGroups = getWorkerGroups(false); Set<String> availableWorkerGroupSet = workerGroups.stream() .map(WorkerGroup::getName) .collect(Collectors.toSet()); result.put(Constants.DATA_LIST, availableWorkerGroupSet); putMsg(result, Status.SUCCESS); return result; } /** * get worker groups * * @param isPaging whether paging * @return WorkerGroup list */ private List<WorkerGroup> getWorkerGroups(boolean isPaging) { String workerPath = zookeeperCachedOperator.getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_WORKERS; List<WorkerGroup> workerGroups = new ArrayList<>(); List<String> workerGroupList; try { workerGroupList = zookeeperCachedOperator.getChildrenKeys(workerPath); } catch (Exception e) { if (e.getMessage().contains(NO_NODE_EXCEPTION_REGEX)) { if (isPaging) { return workerGroups; } //ignore noNodeException return Default WorkerGroup wg = new WorkerGroup(); wg.setName(DEFAULT_WORKER_GROUP); workerGroups.add(wg); return workerGroups; } else { throw e; } } for (String workerGroup : workerGroupList) { String workerGroupPath = workerPath + SLASH + workerGroup; List<String> childrenNodes = zookeeperCachedOperator.getChildrenKeys(workerGroupPath); if (CollectionUtils.isEmpty(childrenNodes)) { continue; } String timeStamp = childrenNodes.get(0); for (int i = 0; i < childrenNodes.size(); i++) { childrenNodes.set(i, Host.of(childrenNodes.get(i)).getAddressAndWeight()); } WorkerGroup wg = new WorkerGroup(); wg.setName(workerGroup); if (isPaging) { wg.setIpList(childrenNodes); String registeredIpValue = zookeeperCachedOperator.get(workerGroupPath + SLASH + timeStamp); wg.setCreateTime(DateUtils.stringToDate(registeredIpValue.split(",")[6])); wg.setUpdateTime(DateUtils.stringToDate(registeredIpValue.split(",")[7])); } workerGroups.add(wg); } return workerGroups; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,705
[Bug][API] KeeperException$NoNodeException
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior, for example: 1. Start an initial DB and ZK, run `CreateDolphinScheduler` to import sql data 2. Start UI and API, DO NOT start master and worker 3. Click 'Create process' 4. Drag a task icon to dag editor 5. See error **Expected behavior** Exception can be captured and friendly information can be prompted in UI. **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/4902714/107109032-d04c7280-6877-11eb-9cb9-910c8f5d61dd.png) API log: ``` [ERROR] 2021-02-06 12:25:08.744 org.apache.dolphinscheduler.service.zk.ZookeeperOperator:[138] - getChildrenKeys key : /dolphinscheduler/nodes/worker org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/nodes/worker at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:132) at org.apache.dolphinscheduler.api.service.WorkerGroupService.getWorkerGroups(WorkerGroupService.java:132) at org.apache.dolphinscheduler.api.service.WorkerGroupService.queryAllGroup(WorkerGroupService.java:113) at org.apache.dolphinscheduler.api.controller.WorkerGroupController.queryAllWorkerGroups(WorkerGroupController.java:103) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:867) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623) at com.github.xiaoymin.swaggerbootstrapui.filter.SecurityBasicAuthFilter.doFilter(SecurityBasicAuthFilter.java:84) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at com.github.xiaoymin.swaggerbootstrapui.filter.ProductionSecurityFilter.doFilter(ProductionSecurityFilter.java:53) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:753) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:502) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683) at java.lang.Thread.run(Thread.java:748) [ERROR] 2021-02-06 12:25:08.749 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[45] - 查询worker分组失败 java.lang.RuntimeException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/nodes/worker at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:139) at org.apache.dolphinscheduler.api.service.WorkerGroupService.getWorkerGroups(WorkerGroupService.java:132) at org.apache.dolphinscheduler.api.service.WorkerGroupService.queryAllGroup(WorkerGroupService.java:113) at org.apache.dolphinscheduler.api.controller.WorkerGroupController.queryAllWorkerGroups(WorkerGroupController.java:103) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:867) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623) at com.github.xiaoymin.swaggerbootstrapui.filter.SecurityBasicAuthFilter.doFilter(SecurityBasicAuthFilter.java:84) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at com.github.xiaoymin.swaggerbootstrapui.filter.ProductionSecurityFilter.doFilter(ProductionSecurityFilter.java:53) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:753) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:502) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /dolphinscheduler/nodes/worker at org.apache.zookeeper.KeeperException.create(KeeperException.java:114) at org.apache.zookeeper.KeeperException.create(KeeperException.java:54) at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1659) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) at org.apache.dolphinscheduler.service.zk.ZookeeperOperator.getChildrenKeys(ZookeeperOperator.java:132) ... 71 common frames omitted ``` **Which version of Dolphin Scheduler:** -[1.3.x] -[dev] **Additional context** Add any other context about the problem here. **Requirement or improvement** - Please describe about your requirements or improvement suggestions.
https://github.com/apache/dolphinscheduler/issues/4705
https://github.com/apache/dolphinscheduler/pull/4961
e851ec13671af7d68792cc134175c4a5d6c01f20
8112f5bcb5c27a2b48fbfff2fe9a5c6595b0273d
"2021-02-06T04:35:45Z"
java
"2021-03-05T13:34:54Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkerGroupServiceTest.java
/* * 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.dolphinscheduler.api.service; import org.apache.dolphinscheduler.api.service.impl.WorkerGroupServiceImpl; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.entity.WorkerGroup; import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; import org.apache.dolphinscheduler.service.zk.ZookeeperCachedOperator; import org.apache.dolphinscheduler.service.zk.ZookeeperConfig; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; /** * worker group service test */ @RunWith(MockitoJUnitRunner.class) public class WorkerGroupServiceTest { @InjectMocks private WorkerGroupServiceImpl workerGroupService; @Mock private ProcessInstanceMapper processInstanceMapper; @Mock private ZookeeperCachedOperator zookeeperCachedOperator; @Before public void init() { ZookeeperConfig zookeeperConfig = new ZookeeperConfig(); zookeeperConfig.setDsRoot("/dolphinscheduler_qzw"); Mockito.when(zookeeperCachedOperator.getZookeeperConfig()).thenReturn(zookeeperConfig); String workerPath = zookeeperCachedOperator.getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_WORKERS; List<String> workerGroupStrList = new ArrayList<>(); workerGroupStrList.add("default"); workerGroupStrList.add("test"); Mockito.when(zookeeperCachedOperator.getChildrenKeys(workerPath)).thenReturn(workerGroupStrList); List<String> defaultIpList = new ArrayList<>(); defaultIpList.add("192.168.220.188:1234:100:1234567"); defaultIpList.add("192.168.220.189:1234:100:1234567"); Mockito.when(zookeeperCachedOperator.getChildrenKeys(workerPath + "/default")).thenReturn(defaultIpList); Mockito.when(zookeeperCachedOperator.get(workerPath + "/default" + "/" + defaultIpList.get(0))).thenReturn("0.01,0.17,0.03,25.83,8.0,1.0,2020-07-21 11:17:59,2020-07-21 14:39:20,0,13238"); } /** * query worker group paging */ @Test public void testQueryAllGroupPaging() { User user = new User(); // general user add user.setUserType(UserType.ADMIN_USER); Map<String, Object> result = workerGroupService.queryAllGroupPaging(user, 1, 10, null); PageInfo<WorkerGroup> pageInfo = (PageInfo) result.get(Constants.DATA_LIST); Assert.assertEquals(pageInfo.getLists().size(), 1); } @Test public void testQueryAllGroup() throws Exception { Map<String, Object> result = workerGroupService.queryAllGroup(); Set<String> workerGroups = (Set<String>) result.get(Constants.DATA_LIST); Assert.assertEquals(workerGroups.size(), 1); } /** * get processInstances */ private List<ProcessInstance> getProcessInstanceList() { List<ProcessInstance> processInstances = new ArrayList<>(); processInstances.add(new ProcessInstance()); return processInstances; } @Test public void testQueryAllGroupWithNoNodeException() { String workerPath = zookeeperCachedOperator.getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_WORKERS; Mockito.when(zookeeperCachedOperator.getChildrenKeys(workerPath)).thenThrow(new RuntimeException("KeeperException$NoNodeException")); Map<String, Object> result = workerGroupService.queryAllGroup(); Set<String> workerGroups = (Set<String>) result.get(Constants.DATA_LIST); Assert.assertEquals(1, workerGroups.size()); Assert.assertEquals("default", workerGroups.toArray()[0]); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,972
[Improvement][Worker] yarn kill job after kinit (kerberos)
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** After yarn kerberos authentication is enabled, kerberos TGT needs to be initialized when yarn kill is executed yarn 开启kerberos认证之后,执行yarn kill 的时候需要初始化kerberos TGT **Which version of DolphinScheduler:** -[1.3.*]
https://github.com/apache/dolphinscheduler/issues/4972
https://github.com/apache/dolphinscheduler/pull/4973
fd581af72675b6c71ee46bba2a393091e6643b90
c3f43a19242c3cb4538372f02e7eaf83b971ab1e
"2021-03-05T14:09:19Z"
java
"2021-03-08T12:17:28Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
/* * 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.dolphinscheduler.server.utils; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.CommonUtils; import org.apache.dolphinscheduler.common.utils.FileUtils; import org.apache.dolphinscheduler.common.utils.HadoopUtils; import org.apache.dolphinscheduler.common.utils.LoggerUtils; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.remote.utils.Host; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.service.log.LogClientService; import java.io.File; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * mainly used to get the start command line of a process. */ public class ProcessUtils { /** * logger */ private static final Logger logger = LoggerFactory.getLogger(ProcessUtils.class); /** * Initialization regularization, solve the problem of pre-compilation performance, * avoid the thread safety problem of multi-thread operation */ private static final Pattern MACPATTERN = Pattern.compile("-[+|-]-\\s(\\d+)"); /** * Expression of PID recognition in Windows scene */ private static final Pattern WINDOWSATTERN = Pattern.compile("(\\d+)"); private static final String LOCAL_PROCESS_EXEC = "jdk.lang.Process.allowAmbiguousCommands"; /** * build command line characters. * * @param commandList command list * @return command */ public static String buildCommandStr(List<String> commandList) { String cmdstr; String[] cmd = commandList.toArray(new String[0]); SecurityManager security = System.getSecurityManager(); boolean allowAmbiguousCommands = isAllowAmbiguousCommands(security); if (allowAmbiguousCommands) { String executablePath = new File(cmd[0]).getPath(); if (needsEscaping(VERIFICATION_LEGACY, executablePath)) { executablePath = quoteString(executablePath); } cmdstr = createCommandLine( VERIFICATION_LEGACY, executablePath, cmd); } else { String executablePath; try { executablePath = getExecutablePath(cmd[0]); } catch (IllegalArgumentException e) { StringBuilder join = new StringBuilder(); for (String s : cmd) { join.append(s).append(' '); } cmd = getTokensFromCommand(join.toString()); executablePath = getExecutablePath(cmd[0]); // Check new executable name once more if (security != null) { security.checkExec(executablePath); } } cmdstr = createCommandLine( isShellFile(executablePath) ? VERIFICATION_CMD_BAT : VERIFICATION_WIN32, quoteString(executablePath), cmd); } return cmdstr; } /** * check is allow ambiguous commands * * @param security security manager * @return allow ambiguous command flag */ private static boolean isAllowAmbiguousCommands(SecurityManager security) { boolean allowAmbiguousCommands = false; if (security == null) { allowAmbiguousCommands = true; String value = System.getProperty(LOCAL_PROCESS_EXEC); if (value != null) { allowAmbiguousCommands = !Constants.STRING_FALSE.equalsIgnoreCase(value); } } return allowAmbiguousCommands; } /** * get executable path. * * @param path path * @return executable path */ private static String getExecutablePath(String path) { boolean pathIsQuoted = isQuoted(true, path, "Executable name has embedded quote, split the arguments"); File fileToRun = new File(pathIsQuoted ? path.substring(1, path.length() - 1) : path); return fileToRun.getPath(); } /** * whether is shell file. * * @param executablePath executable path * @return true if endsWith .CMD or .BAT */ private static boolean isShellFile(String executablePath) { String upPath = executablePath.toUpperCase(); return (upPath.endsWith(".CMD") || upPath.endsWith(".BAT")); } /** * quote string. * * @param arg argument * @return format arg */ private static String quoteString(String arg) { return '"' + arg + '"'; } /** * get tokens from command. * * @param command command * @return token string array */ private static String[] getTokensFromCommand(String command) { ArrayList<String> matchList = new ArrayList<>(8); Matcher regexMatcher = LazyPattern.PATTERN.matcher(command); while (regexMatcher.find()) { matchList.add(regexMatcher.group()); } return matchList.toArray(new String[0]); } /** * Lazy Pattern. */ private static class LazyPattern { /** * Escape-support version: * "(\")((?:\\\\\\1|.)+?)\\1|([^\\s\"]+)"; */ private static final Pattern PATTERN = Pattern.compile("[^\\s\"]+|\"[^\"]*\""); } /** * verification cmd bat. */ private static final int VERIFICATION_CMD_BAT = 0; /** * verification win32. */ private static final int VERIFICATION_WIN32 = 1; /** * verification legacy. */ private static final int VERIFICATION_LEGACY = 2; /** * escape verification. */ private static final char[][] ESCAPE_VERIFICATION = {{' ', '\t', '<', '>', '&', '|', '^'}, {' ', '\t', '<', '>'}, {' ', '\t'}}; /** * create command line. * * @param verificationType verification type * @param executablePath executable path * @param cmd cmd * @return command line */ private static String createCommandLine(int verificationType, final String executablePath, final String[] cmd) { StringBuilder cmdbuf = new StringBuilder(80); cmdbuf.append(executablePath); for (int i = 1; i < cmd.length; ++i) { cmdbuf.append(' '); String s = cmd[i]; if (needsEscaping(verificationType, s)) { cmdbuf.append('"').append(s); if ((verificationType != VERIFICATION_CMD_BAT) && s.endsWith("\\")) { cmdbuf.append('\\'); } cmdbuf.append('"'); } else { cmdbuf.append(s); } } return cmdbuf.toString(); } /** * whether is quoted. * * @param noQuotesInside no quotes inside * @param arg arg * @param errorMessage error message * @return boolean */ private static boolean isQuoted(boolean noQuotesInside, String arg, String errorMessage) { int lastPos = arg.length() - 1; if (lastPos >= 1 && arg.charAt(0) == '"' && arg.charAt(lastPos) == '"') { // The argument has already been quoted. if (noQuotesInside && arg.indexOf('"', 1) != lastPos) { // There is ["] inside. throw new IllegalArgumentException(errorMessage); } return true; } if (noQuotesInside && arg.indexOf('"') >= 0) { // There is ["] inside. throw new IllegalArgumentException(errorMessage); } return false; } /** * whether needs escaping. * * @param verificationType verification type * @param arg arg * @return boolean */ private static boolean needsEscaping(int verificationType, String arg) { boolean argIsQuoted = isQuoted((verificationType == VERIFICATION_CMD_BAT), arg, "Argument has embedded quote, use the explicit CMD.EXE call."); if (!argIsQuoted) { char[] testEscape = ESCAPE_VERIFICATION[verificationType]; for (char c : testEscape) { if (arg.indexOf(c) >= 0) { return true; } } } return false; } /** * kill yarn application. * * @param appIds app id list * @param logger logger * @param tenantCode tenant code * @param executePath execute path */ public static void cancelApplication(List<String> appIds, Logger logger, String tenantCode, String executePath) { if (CollectionUtils.isNotEmpty(appIds)) { for (String appId : appIds) { try { ExecutionStatus applicationStatus = HadoopUtils.getInstance().getApplicationStatus(appId); if (!applicationStatus.typeIsFinished()) { String commandFile = String .format("%s/%s.kill", executePath, appId); String cmd = "yarn application -kill " + appId; execYarnKillCommand(logger, tenantCode, appId, commandFile, cmd); } } catch (Exception e) { logger.error(String.format("Get yarn application app id [%s] status failed: [%s]", appId, e.getMessage())); } } } } /** * build kill command for yarn application * * @param logger logger * @param tenantCode tenant code * @param appId app id * @param commandFile command file * @param cmd cmd */ private static void execYarnKillCommand(Logger logger, String tenantCode, String appId, String commandFile, String cmd) { try { StringBuilder sb = new StringBuilder(); sb.append("#!/bin/sh\n"); sb.append("BASEDIR=$(cd `dirname $0`; pwd)\n"); sb.append("cd $BASEDIR\n"); if (CommonUtils.getSystemEnvPath() != null) { sb.append("source ").append(CommonUtils.getSystemEnvPath()).append("\n"); } sb.append("\n\n"); sb.append(cmd); File f = new File(commandFile); if (!f.exists()) { FileUtils.writeStringToFile(new File(commandFile), sb.toString(), StandardCharsets.UTF_8); } String runCmd = String.format("%s %s", Constants.SH, commandFile); runCmd = OSUtils.getSudoCmd(tenantCode, runCmd); logger.info("kill cmd:{}", runCmd); OSUtils.exeCmd(runCmd); } catch (Exception e) { logger.error(String.format("Kill yarn application app id [%s] failed: [%s]", appId, e.getMessage())); } } /** * kill tasks according to different task types. * * @param taskExecutionContext taskExecutionContext */ public static void kill(TaskExecutionContext taskExecutionContext) { try { int processId = taskExecutionContext.getProcessId(); if (processId == 0) { logger.error("process kill failed, process id :{}, task id:{}", processId, taskExecutionContext.getTaskInstanceId()); return; } String cmd = String.format("kill -9 %s", getPidsStr(processId)); cmd = OSUtils.getSudoCmd(taskExecutionContext.getTenantCode(), cmd); logger.info("process id:{}, cmd:{}", processId, cmd); OSUtils.exeCmd(cmd); // find log and kill yarn job killYarnJob(taskExecutionContext); } catch (Exception e) { logger.error("kill task failed", e); } } /** * get pids str. * * @param processId process id * @return pids pid String * @throws Exception exception */ public static String getPidsStr(int processId) throws Exception { StringBuilder sb = new StringBuilder(); Matcher mat = null; // pstree pid get sub pids if (OSUtils.isMacOS()) { String pids = OSUtils.exeCmd(String.format("%s -sp %d", Constants.PSTREE, processId)); if (null != pids) { mat = MACPATTERN.matcher(pids); } } else { String pids = OSUtils.exeCmd(String.format("%s -p %d", Constants.PSTREE, processId)); mat = WINDOWSATTERN.matcher(pids); } if (null != mat) { while (mat.find()) { sb.append(mat.group(1)).append(" "); } } return sb.toString().trim(); } /** * find logs and kill yarn tasks. * * @param taskExecutionContext taskExecutionContext */ public static void killYarnJob(TaskExecutionContext taskExecutionContext) { try { Thread.sleep(Constants.SLEEP_TIME_MILLIS); LogClientService logClient = null; String log; try { logClient = new LogClientService(); log = logClient.viewLog(Host.of(taskExecutionContext.getHost()).getIp(), Constants.RPC_PORT, taskExecutionContext.getLogPath()); } finally { if (logClient != null) { logClient.close(); } } if (StringUtils.isNotEmpty(log)) { List<String> appIds = LoggerUtils.getAppIds(log, logger); String workerDir = taskExecutionContext.getExecutePath(); if (StringUtils.isEmpty(workerDir)) { logger.error("task instance work dir is empty"); throw new RuntimeException("task instance work dir is empty"); } if (CollectionUtils.isNotEmpty(appIds)) { cancelApplication(appIds, logger, taskExecutionContext.getTenantCode(), taskExecutionContext.getExecutePath()); } } } catch (Exception e) { logger.error("kill yarn job failure", e); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,972
[Improvement][Worker] yarn kill job after kinit (kerberos)
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** After yarn kerberos authentication is enabled, kerberos TGT needs to be initialized when yarn kill is executed yarn 开启kerberos认证之后,执行yarn kill 的时候需要初始化kerberos TGT **Which version of DolphinScheduler:** -[1.3.*]
https://github.com/apache/dolphinscheduler/issues/4972
https://github.com/apache/dolphinscheduler/pull/4973
fd581af72675b6c71ee46bba2a393091e6643b90
c3f43a19242c3cb4538372f02e7eaf83b971ab1e
"2021-03-05T14:09:19Z"
java
"2021-03-08T12:17:28Z"
dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/utils/ProcessUtilsTest.java
/* * 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.dolphinscheduler.server.utils; import static org.powermock.api.mockito.PowerMockito.when; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.utils.HadoopUtils; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import java.util.ArrayList; import java.util.List; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @RunWith(PowerMockRunner.class) @PrepareForTest({System.class, OSUtils.class, HadoopUtils.class}) public class ProcessUtilsTest { private static final Logger logger = LoggerFactory.getLogger(ProcessUtils.class); @Before public void setUp() { MockitoAnnotations.initMocks(this); } @Test public void getPidsStr() throws Exception { int processId = 1; String pidList = ProcessUtils.getPidsStr(processId); Assert.assertNotEquals("The child process of process 1 should not be empty", pidList, ""); PowerMockito.mockStatic(OSUtils.class); when(OSUtils.isMacOS()).thenReturn(true); when(OSUtils.exeCmd(String.format("%s -p %d", Constants.PSTREE, processId))).thenReturn(null); String pidListMac = ProcessUtils.getPidsStr(processId); Assert.assertEquals("", pidListMac); } @Test public void testBuildCommandStr() { List<String> commands = new ArrayList<>(); commands.add("sudo"); commands.add("-u"); commands.add("tenantCode"); //allowAmbiguousCommands false Assert.assertEquals("sudo -u tenantCode", ProcessUtils.buildCommandStr(commands)); //quota commands.clear(); commands.add("\"sudo\""); Assert.assertEquals("\"sudo\"", ProcessUtils.buildCommandStr(commands)); //allowAmbiguousCommands true commands.clear(); commands.add("sudo"); System.setProperty("jdk.lang.Process.allowAmbiguousCommands", "false"); Assert.assertEquals("\"sudo\"", ProcessUtils.buildCommandStr(commands)); } @Test public void testKill() { //get taskExecutionContext TaskExecutionContext taskExecutionContext = new TaskExecutionContext(); //process id eq 0 taskExecutionContext.setProcessId(0); ProcessUtils.kill(taskExecutionContext); //process id not eq 0 taskExecutionContext.setProcessId(1); PowerMockito.mockStatic(OSUtils.class); try { when(OSUtils.exeCmd(String.format("%s -sp %d", Constants.PSTREE, 1))).thenReturn("1111"); when(OSUtils.exeCmd(String.format("%s -p %d", Constants.PSTREE, 1))).thenReturn("1111"); when(OSUtils.exeCmd("sudo -u tenantCode kill -9")).thenReturn("1111"); } catch (Exception e) { e.printStackTrace(); } taskExecutionContext.setHost("127.0.0.1:8888"); taskExecutionContext.setLogPath("/log/1.log"); taskExecutionContext.setTenantCode("tenantCode"); ProcessUtils.kill(taskExecutionContext); Assert.assertEquals(1, taskExecutionContext.getProcessId()); } @Test public void testCancelApplication() { List<String> appIds = new ArrayList<>(); appIds.add("application_1585532379175_228491"); appIds.add("application_1598885606600_3677"); String tenantCode = "dev"; String executePath = "/ds-exec/1/1/1"; ExecutionStatus running = ExecutionStatus.RUNNING_EXECUTION; PowerMockito.mockStatic(HadoopUtils.class); HadoopUtils hadoop = HadoopUtils.getInstance(); try { PowerMockito.whenNew(HadoopUtils.class).withAnyArguments().thenReturn(hadoop); } catch (Exception e) { e.printStackTrace(); } try { when(hadoop.getApplicationStatus("application_1585532379175_228491")).thenReturn(running); when(hadoop.getApplicationStatus("application_1598885606600_3677")).thenReturn(running); } catch (Exception e) { e.printStackTrace(); ProcessUtils.cancelApplication(appIds, logger, tenantCode, executePath); } Assert.assertNotNull(appIds); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,963
[Bug][Dao] Mybtis Mapper used foreach syntax to traverse collections and the collection was empty
**Describe the bug** Mybtis Mapper used foreach syntax to traverse collections and the collection was empty **Screenshots** ![image](https://user-images.githubusercontent.com/37063904/110100105-003a5780-7ddd-11eb-8a37-71fcd7713108.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4963
https://github.com/apache/dolphinscheduler/pull/4964
89c9b517409279e551683aafa130eff50bdad091
d13fab7497c999483e7ffe19beec5c6da089c2f3
"2021-03-05T10:02:58Z"
java
"2021-03-09T01:44:11Z"
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/DataSourceMapper.xml
<?xml version="1.0" encoding="UTF-8" ?> <!-- ~ 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. --> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="org.apache.dolphinscheduler.dao.mapper.DataSourceMapper"> <sql id="baseSql"> id, name, note, type, user_id, connection_params, create_time, update_time </sql> <select id="queryDataSourceByType" resultType="org.apache.dolphinscheduler.dao.entity.DataSource"> select <include refid="baseSql"/> from t_ds_datasource where type=#{type} <if test="userId != 0"> and id in (select datasource_id from t_ds_relation_datasource_user where user_id=#{userId} union select id as datasource_id from t_ds_datasource where user_id=#{userId} ) </if> </select> <select id="selectPaging" resultType="org.apache.dolphinscheduler.dao.entity.DataSource"> select d.id, d.name, d.note, d.type, d.user_id, connection_params, d.create_time, d.update_time , u.user_name as user_name from t_ds_datasource d join t_ds_user u on d.user_id = u.id where 1 =1 <if test="userId != 0"> and d.id in (select datasource_id from t_ds_relation_datasource_user where user_id=#{userId} union select id as datasource_id from t_ds_datasource where user_id=#{userId} ) </if> <if test="name != null and name != ''"> and name like concat ('%', #{name}, '%') </if> order by update_time desc </select> <select id="queryDataSourceByName" resultType="org.apache.dolphinscheduler.dao.entity.DataSource"> select <include refid="baseSql"/> from t_ds_datasource where name=#{name} </select> <select id="queryAuthedDatasource" resultType="org.apache.dolphinscheduler.dao.entity.DataSource"> select ds.id, ds.name, ds.note, ds.type, ds.user_id, ds.connection_params, ds.create_time, ds.update_time from t_ds_datasource ds, t_ds_relation_datasource_user rel where ds.id = rel.datasource_id AND rel.user_id = #{userId} </select> <select id="queryDatasourceExceptUserId" resultType="org.apache.dolphinscheduler.dao.entity.DataSource"> select <include refid="baseSql"/> from t_ds_datasource where user_id <![CDATA[ <> ]]> #{userId} </select> <select id="listAllDataSourceByType" resultType="org.apache.dolphinscheduler.dao.entity.DataSource"> select <include refid="baseSql"/> from t_ds_datasource where type = #{type} </select> <select id="listAuthorizedDataSource" resultType="org.apache.dolphinscheduler.dao.entity.DataSource"> select <include refid="baseSql"/> from t_ds_datasource where id in (select datasource_id from t_ds_relation_datasource_user where user_id=#{userId} union select id as datasource_id from t_ds_datasource where user_id=#{userId}) <if test="dataSourceIds != null and dataSourceIds != ''"> and id in <foreach collection="dataSourceIds" item="i" open="(" close=")" separator=","> #{i} </foreach> </if> </select> </mapper>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,963
[Bug][Dao] Mybtis Mapper used foreach syntax to traverse collections and the collection was empty
**Describe the bug** Mybtis Mapper used foreach syntax to traverse collections and the collection was empty **Screenshots** ![image](https://user-images.githubusercontent.com/37063904/110100105-003a5780-7ddd-11eb-8a37-71fcd7713108.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4963
https://github.com/apache/dolphinscheduler/pull/4964
89c9b517409279e551683aafa130eff50bdad091
d13fab7497c999483e7ffe19beec5c6da089c2f3
"2021-03-05T10:02:58Z"
java
"2021-03-09T01:44:11Z"
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml
<?xml version="1.0" encoding="UTF-8" ?> <!-- ~ 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. --> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper"> <sql id="baseSql"> id, name, process_definition_id, state, recovery, start_time, end_time, run_times,host, command_type, command_param, task_depend_type, max_try_times, failure_strategy, warning_type, warning_group_id, schedule_time, command_start_time, global_params, process_instance_json, flag, update_time, is_sub_process, executor_id, locations, connects, history_cmd, dependence_schedule_times, process_instance_priority, worker_group, timeout, tenant_id, var_pool </sql> <select id="queryDetailById" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select <include refid="baseSql"/> from t_ds_process_instance where id = #{processId} </select> <select id="queryByHostAndStatus" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select <include refid="baseSql"/> from t_ds_process_instance where 1=1 <if test="host != null and host != ''"> and host=#{host} </if> and state in <foreach collection="states" item="i" open="(" close=")" separator=","> #{i} </foreach> order by id asc </select> <select id="queryTopNProcessInstance" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select <include refid="baseSql"/> from t_ds_process_instance where state = #{status} and start_time between #{startTime} and #{endTime} order by end_time-start_time desc limit #{size} </select> <select id="queryByTenantIdAndStatus" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select <include refid="baseSql"/> from t_ds_process_instance where 1=1 <if test="tenantId != -1"> and tenant_id =#{tenantId} </if> and state in <foreach collection="states" item="i" open="(" close=")" separator=","> #{i} </foreach> order by id asc </select> <select id="queryByWorkerGroupIdAndStatus" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select <include refid="baseSql"/> from t_ds_process_instance where 1=1 <if test="workerGroupId != -1"> and worker_group_id =#{workerGroupId} </if> and state in <foreach collection="states" item="i" open="(" close=")" separator=","> #{i} </foreach> order by id asc </select> <select id="queryProcessInstanceListPaging" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select instance.id, instance.process_definition_id, instance.command_type, instance.executor_id, instance.name, instance.state, instance.schedule_time, instance.start_time, instance.end_time, instance.run_times, instance.recovery, instance.host from t_ds_process_instance instance join t_ds_process_definition define ON instance.process_definition_id = define.id where instance.is_sub_process=0 and define.project_id = #{projectId} <if test="processDefinitionId != 0"> and instance.process_definition_id = #{processDefinitionId} </if> <if test="searchVal != null and searchVal != ''"> and instance.name like concat('%', #{searchVal}, '%') </if> <if test="startTime != null "> and instance.start_time > #{startTime} and instance.start_time <![CDATA[ <=]]> #{endTime} </if> <if test="states != null and states != ''"> and instance.state in <foreach collection="states" index="index" item="i" open="(" separator="," close=")"> #{i} </foreach> </if> <if test="host != null and host != ''"> and instance.host like concat('%', #{host}, '%') </if> <if test="executorId != 0"> and instance.executor_id = #{executorId} </if> order by instance.start_time desc </select> <update id="setFailoverByHostAndStateArray"> update t_ds_process_instance set host=null where host =#{host} and state in <foreach collection="states" index="index" item="i" open="(" close=")" separator=","> #{i} </foreach> </update> <update id="updateProcessInstanceByState"> update t_ds_process_instance set state = #{destState} where state = #{originState} </update> <update id="updateProcessInstanceByTenantId"> update t_ds_process_instance set tenant_id = #{destTenantId} where tenant_id = #{originTenantId} </update> <update id="updateProcessInstanceByWorkerGroupId"> update t_ds_process_instance set worker_group_id = #{destWorkerGroupId} where worker_group_id = #{originWorkerGroupId} </update> <select id="countInstanceStateByUser" resultType="org.apache.dolphinscheduler.dao.entity.ExecuteStatusCount"> select t.state, count(0) as count from t_ds_process_instance t join t_ds_process_definition d on d.id=t.process_definition_id join t_ds_project p on p.id=d.project_id where 1 = 1 and t.is_sub_process = 0 <if test="startTime != null and endTime != null"> and t.start_time <![CDATA[ >= ]]> #{startTime} and t.start_time <![CDATA[ <= ]]> #{endTime} </if> <if test="projectIds != null and projectIds.length != 0"> and p.id in <foreach collection="projectIds" index="index" item="i" open="(" close=")" separator=","> #{i} </foreach> </if> group by t.state </select> <select id="queryByProcessDefineId" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select <include refid="baseSql"/> from t_ds_process_instance where process_definition_id=#{processDefinitionId} order by start_time desc limit #{size} </select> <select id="queryLastSchedulerProcess" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select <include refid="baseSql"/> from t_ds_process_instance where process_definition_id=#{processDefinitionId} <if test="startTime!=null and endTime != null "> and schedule_time <![CDATA[ >= ]]> #{startTime} and schedule_time <![CDATA[ <= ]]> #{endTime} </if> order by end_time desc limit 1 </select> <select id="queryLastRunningProcess" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select <include refid="baseSql"/> from t_ds_process_instance where process_definition_id=#{processDefinitionId} <if test="states !=null and states.length != 0"> and state in <foreach collection="states" item="i" index="index" open="(" separator="," close=")"> #{i} </foreach> </if> <if test="startTime!=null and endTime != null "> and (schedule_time <![CDATA[ >= ]]> #{startTime} and schedule_time <![CDATA[ <= ]]> #{endTime} or start_time <![CDATA[ >= ]]> #{startTime} and start_time <![CDATA[ <= ]]> #{endTime}) </if> order by start_time desc limit 1 </select> <select id="queryLastManualProcess" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select <include refid="baseSql"/> from t_ds_process_instance where process_definition_id=#{processDefinitionId} and schedule_time is null <if test="startTime!=null and endTime != null "> and start_time <![CDATA[ >= ]]> #{startTime} and start_time <![CDATA[ <= ]]> #{endTime} </if> order by end_time desc limit 1 </select> <select id="queryByProcessDefineIdAndStatus" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select <include refid="baseSql"/> from t_ds_process_instance where process_definition_id=#{processDefinitionId} and state in <foreach collection="states" item="i" open="(" close=")" separator=","> #{i} </foreach> order by id asc </select> <update id="updateGlobalParamsById"> update t_ds_process_instance set global_params = #{globalParams} where id = #{id} </update> </mapper>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,963
[Bug][Dao] Mybtis Mapper used foreach syntax to traverse collections and the collection was empty
**Describe the bug** Mybtis Mapper used foreach syntax to traverse collections and the collection was empty **Screenshots** ![image](https://user-images.githubusercontent.com/37063904/110100105-003a5780-7ddd-11eb-8a37-71fcd7713108.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4963
https://github.com/apache/dolphinscheduler/pull/4964
89c9b517409279e551683aafa130eff50bdad091
d13fab7497c999483e7ffe19beec5c6da089c2f3
"2021-03-05T10:02:58Z"
java
"2021-03-09T01:44:11Z"
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceMapper.xml
<?xml version="1.0" encoding="UTF-8" ?> <!-- ~ 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. --> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="org.apache.dolphinscheduler.dao.mapper.ResourceMapper"> <sql id="baseSql"> id, alias, file_name, description, user_id, type, size, create_time, update_time, pid, full_name, is_directory </sql> <sql id="baseSqlV2"> ${alias}.id, ${alias}.alias, ${alias}.file_name, ${alias}.description, ${alias}.user_id, ${alias}.type, ${alias}.size, ${alias}.create_time, ${alias}.update_time, ${alias}.pid, ${alias}.full_name, ${alias}.is_directory </sql> <select id="queryResourceList" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSql"/> from t_ds_resources where 1= 1 <if test="fullName != null and fullName != ''"> and full_name = #{fullName} </if> <if test="type != -1"> and type = #{type} </if> <if test="userId != 0"> and user_id = #{userId} </if> </select> <select id="queryResourceListAuthored" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSql"/> from t_ds_resources where 1 = 1 <if test="type != -1"> and type=#{type} </if> <if test="userId != 0 and perm != 0"> and id in (select resources_id from t_ds_relation_resources_user where user_id=#{userId} and perm=#{perm} union select id as resources_id from t_ds_resources where user_id=#{userId}) </if> <if test="userId != 0 and perm == 0"> and id in (select resources_id from t_ds_relation_resources_user where user_id=#{userId} union select id as resources_id from t_ds_resources where user_id=#{userId}) </if> </select> <select id="queryResourcePaging" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select d.id, d.alias, d.file_name, d.description, d.user_id, d.type, d.size, d.create_time, d.update_time, d.pid, d.full_name, d.is_directory, u.user_name as user_name from t_ds_resources d join t_ds_user u on d.user_id = u.id where d.type=#{type} and d.pid=#{id} <if test="userId != 0"> and d.id in (select resources_id from t_ds_relation_resources_user where user_id=#{userId} union select id as resources_id from t_ds_resources where user_id=#{userId}) </if> <if test="searchVal != null and searchVal != ''"> and d.alias like concat('%', #{searchVal}, '%') </if> order by d.update_time desc </select> <select id="queryAuthorizedResourceList" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSqlV2"> <property name="alias" value="r"/> </include> from t_ds_resources r,t_ds_relation_resources_user rel where r.id = rel.resources_id AND rel.user_id = #{userId} and perm=7 </select> <select id="queryResourceExceptUserId" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSql"/> from t_ds_resources where user_id <![CDATA[ <> ]]> #{userId} </select> <select id="queryTenantCodeByResourceName" resultType="java.lang.String"> select tenant_code from t_ds_tenant t, t_ds_user u, t_ds_resources res where t.id = u.tenant_id and u.id = res.user_id and res.type=#{resType} and res.full_name= #{resName} </select> <select id="listAuthorizedResource" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSql"/> from t_ds_resources where type=0 and id in (select resources_id from t_ds_relation_resources_user where user_id=#{userId} and perm=7 union select id as resources_id from t_ds_resources where user_id=#{userId}) <if test="resNames != null and resNames != ''"> and full_name in <foreach collection="resNames" item="i" open="(" close=")" separator=","> #{i} </foreach> </if> </select> <select id="listAuthorizedResourceById" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSql"/> from t_ds_resources where id in (select resources_id from t_ds_relation_resources_user where user_id=#{userId} and perm=7 union select id as resources_id from t_ds_resources where user_id=#{userId}) <if test="resIds != null and resIds != ''"> and id in <foreach collection="resIds" item="i" open="(" close=")" separator=","> #{i} </foreach> </if> </select> <delete id="deleteIds" parameterType="java.lang.Integer"> delete from t_ds_resources where id in <foreach collection="resIds" item="i" open="(" close=")" separator=","> #{i} </foreach> </delete> <select id="listChildren" resultType="java.lang.Integer"> select id from t_ds_resources where pid = #{direcotyId} </select> <select id="queryResource" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSql"/> from t_ds_resources where type = #{type} and full_name = #{fullName} </select> <update id="batchUpdateResource" parameterType="java.util.List"> <foreach collection="resourceList" item="resource" index="index" open="" close="" separator=";"> update t_ds_resources <set> full_name=#{resource.fullName}, update_time=#{resource.updateTime} </set> <where> id=#{resource.id} </where> </foreach> </update> <select id="listResourceByIds" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSql"/> from t_ds_resources where id in <foreach collection="resIds" item="i" open="(" close=")" separator=","> #{i} </foreach> </select> </mapper>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,963
[Bug][Dao] Mybtis Mapper used foreach syntax to traverse collections and the collection was empty
**Describe the bug** Mybtis Mapper used foreach syntax to traverse collections and the collection was empty **Screenshots** ![image](https://user-images.githubusercontent.com/37063904/110100105-003a5780-7ddd-11eb-8a37-71fcd7713108.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4963
https://github.com/apache/dolphinscheduler/pull/4964
89c9b517409279e551683aafa130eff50bdad091
d13fab7497c999483e7ffe19beec5c6da089c2f3
"2021-03-05T10:02:58Z"
java
"2021-03-09T01:44:11Z"
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapper.xml
<?xml version="1.0" encoding="UTF-8" ?> <!-- ~ 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. --> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="org.apache.dolphinscheduler.dao.mapper.UdfFuncMapper"> <sql id="baseSql"> ${alias}.id, ${alias}.user_id, ${alias}.func_name, ${alias}.class_name, ${alias}.type, ${alias}.arg_types, ${alias}.database, ${alias}.description, ${alias}.resource_id, ${alias}.resource_name, ${alias}.create_time, ${alias}.update_time </sql> <select id="selectUdfById" resultType="org.apache.dolphinscheduler.dao.entity.UdfFunc"> select <include refid="baseSql"> <property name="alias" value="udf"/> </include> from t_ds_udfs udf where id = #{id} </select> <select id="queryUdfByIdStr" resultType="org.apache.dolphinscheduler.dao.entity.UdfFunc"> select <include refid="baseSql"> <property name="alias" value="udf"/> </include> from t_ds_udfs udf where 1 = 1 <if test="ids != null and ids != ''"> and udf.id in <foreach collection="ids" item="i" open="(" close=")" separator=","> #{i} </foreach> </if> <if test="funcNames != null and funcNames != ''"> and udf.func_name = #{funcNames} </if> order by udf.id asc </select> <select id="queryUdfFuncPaging" resultType="org.apache.dolphinscheduler.dao.entity.UdfFunc"> select <include refid="baseSql"> <property name="alias" value="udf"/> </include> from t_ds_udfs udf where 1=1 <if test="searchVal!= null and searchVal != ''"> and udf.func_name like concat('%', #{searchVal}, '%') </if> <if test="userId != 0"> and udf.id in ( select udf_id from t_ds_relation_udfs_user where user_id=#{userId} union select id as udf_id from t_ds_udfs where user_id=#{userId}) </if> order by udf.create_time desc </select> <select id="getUdfFuncByType" resultType="org.apache.dolphinscheduler.dao.entity.UdfFunc"> select <include refid="baseSql"> <property name="alias" value="udf"/> </include> from t_ds_udfs udf where udf.type=#{type} <if test="userId != 0"> and udf.id in ( select udf_id from t_ds_relation_udfs_user where user_id=#{userId} union select id as udf_id from t_ds_udfs where user_id=#{userId}) </if> </select> <select id="queryUdfFuncExceptUserId" resultType="org.apache.dolphinscheduler.dao.entity.UdfFunc"> select <include refid="baseSql"> <property name="alias" value="udf"/> </include> from t_ds_udfs udf where udf.user_id <![CDATA[ <> ]]> #{userId} </select> <select id="queryAuthedUdfFunc" resultType="org.apache.dolphinscheduler.dao.entity.UdfFunc"> SELECT <include refid="baseSql"> <property name="alias" value="udf"/> </include> from t_ds_udfs udf,t_ds_relation_udfs_user rel WHERE udf.id = rel.udf_id AND rel.user_id = #{userId} </select> <select id="listAuthorizedUdfFunc" resultType="org.apache.dolphinscheduler.dao.entity.UdfFunc"> select <include refid="baseSql"> <property name="alias" value="udf"/> </include> from t_ds_udfs udf where udf.id in (select udf_id from t_ds_relation_udfs_user where user_id=#{userId} union select id as udf_id from t_ds_udfs where user_id=#{userId}) <if test="udfIds != null and udfIds != ''"> and udf.id in <foreach collection="udfIds" item="i" open="(" close=")" separator=","> #{i} </foreach> </if> </select> <select id="listUdfByResourceId" resultType="org.apache.dolphinscheduler.dao.entity.UdfFunc"> select <include refid="baseSql"> <property name="alias" value="udf"/> </include> from t_ds_udfs udf where 1=1 <if test="resourceIds != null and resourceIds != ''"> and udf.resource_id in <foreach collection="resourceIds" item="i" open="(" close=")" separator=","> #{i} </foreach> </if> </select> <select id="listAuthorizedUdfByResourceId" resultType="org.apache.dolphinscheduler.dao.entity.UdfFunc"> select <include refid="baseSql"> <property name="alias" value="udf"/> </include> from t_ds_udfs udf where udf.id in (select udf_id from t_ds_relation_udfs_user where user_id=#{userId} union select id as udf_id from t_ds_udfs where user_id=#{userId}) <if test="resourceIds != null and resourceIds != ''"> and udf.resource_id in <foreach collection="resourceIds" item="i" open="(" close=")" separator=","> #{i} </foreach> </if> </select> <update id="batchUpdateUdfFunc" parameterType="java.util.List"> <foreach collection="udfFuncList" item="udf" index="index" open="" close="" separator=";"> update t_ds_udfs <set> resource_name=#{udf.resourceName}, update_time=#{udf.updateTime} </set> <where> id=#{udf.id} </where> </foreach> </update> </mapper>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,960
[Feature][Spark] Support spark name
**Describe the feature** Support spark name, which is common option **Is your feature request related to a problem? Please describe.** No. **Describe the solution you'd like** I will implement this feature
https://github.com/apache/dolphinscheduler/issues/4960
https://github.com/apache/dolphinscheduler/pull/4959
0ac0f31548ef8bfe9a968663db11fd3e09d0bf2d
e74932cfc21c95d7824cd55dd3cb6e441e2b8305
"2021-03-04T17:04:42Z"
java
"2021-03-09T04:51:35Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
/* * 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.dolphinscheduler.common; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import java.util.regex.Pattern; /** * Constants */ public final class Constants { private Constants() { throw new UnsupportedOperationException("Construct Constants"); } /** * quartz config */ public static final String ORG_QUARTZ_JOBSTORE_DRIVERDELEGATECLASS = "org.quartz.jobStore.driverDelegateClass"; public static final String ORG_QUARTZ_SCHEDULER_INSTANCENAME = "org.quartz.scheduler.instanceName"; public static final String ORG_QUARTZ_SCHEDULER_INSTANCEID = "org.quartz.scheduler.instanceId"; public static final String ORG_QUARTZ_SCHEDULER_MAKESCHEDULERTHREADDAEMON = "org.quartz.scheduler.makeSchedulerThreadDaemon"; public static final String ORG_QUARTZ_JOBSTORE_USEPROPERTIES = "org.quartz.jobStore.useProperties"; public static final String ORG_QUARTZ_THREADPOOL_CLASS = "org.quartz.threadPool.class"; public static final String ORG_QUARTZ_THREADPOOL_THREADCOUNT = "org.quartz.threadPool.threadCount"; public static final String ORG_QUARTZ_THREADPOOL_MAKETHREADSDAEMONS = "org.quartz.threadPool.makeThreadsDaemons"; public static final String ORG_QUARTZ_THREADPOOL_THREADPRIORITY = "org.quartz.threadPool.threadPriority"; public static final String ORG_QUARTZ_JOBSTORE_CLASS = "org.quartz.jobStore.class"; public static final String ORG_QUARTZ_JOBSTORE_TABLEPREFIX = "org.quartz.jobStore.tablePrefix"; public static final String ORG_QUARTZ_JOBSTORE_ISCLUSTERED = "org.quartz.jobStore.isClustered"; public static final String ORG_QUARTZ_JOBSTORE_MISFIRETHRESHOLD = "org.quartz.jobStore.misfireThreshold"; public static final String ORG_QUARTZ_JOBSTORE_CLUSTERCHECKININTERVAL = "org.quartz.jobStore.clusterCheckinInterval"; public static final String ORG_QUARTZ_JOBSTORE_ACQUIRETRIGGERSWITHINLOCK = "org.quartz.jobStore.acquireTriggersWithinLock"; public static final String ORG_QUARTZ_JOBSTORE_DATASOURCE = "org.quartz.jobStore.dataSource"; public static final String ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS = "org.quartz.dataSource.myDs.connectionProvider.class"; /** * quartz config default value */ public static final String QUARTZ_TABLE_PREFIX = "QRTZ_"; public static final String QUARTZ_MISFIRETHRESHOLD = "60000"; public static final String QUARTZ_CLUSTERCHECKININTERVAL = "5000"; public static final String QUARTZ_DATASOURCE = "myDs"; public static final String QUARTZ_THREADCOUNT = "25"; public static final String QUARTZ_THREADPRIORITY = "5"; public static final String QUARTZ_INSTANCENAME = "DolphinScheduler"; public static final String QUARTZ_INSTANCEID = "AUTO"; public static final String QUARTZ_ACQUIRETRIGGERSWITHINLOCK = "true"; /** * common properties path */ public static final String COMMON_PROPERTIES_PATH = "/common.properties"; /** * fs.defaultFS */ public static final String FS_DEFAULTFS = "fs.defaultFS"; /** * fs s3a endpoint */ public static final String FS_S3A_ENDPOINT = "fs.s3a.endpoint"; /** * fs s3a access key */ public static final String FS_S3A_ACCESS_KEY = "fs.s3a.access.key"; /** * fs s3a secret key */ public static final String FS_S3A_SECRET_KEY = "fs.s3a.secret.key"; /** * yarn.resourcemanager.ha.rm.ids */ public static final String YARN_RESOURCEMANAGER_HA_RM_IDS = "yarn.resourcemanager.ha.rm.ids"; public static final String YARN_RESOURCEMANAGER_HA_XX = "xx"; /** * yarn.application.status.address */ public static final String YARN_APPLICATION_STATUS_ADDRESS = "yarn.application.status.address"; /** * yarn.job.history.status.address */ public static final String YARN_JOB_HISTORY_STATUS_ADDRESS = "yarn.job.history.status.address"; /** * hdfs configuration * hdfs.root.user */ public static final String HDFS_ROOT_USER = "hdfs.root.user"; /** * hdfs/s3 configuration * resource.upload.path */ public static final String RESOURCE_UPLOAD_PATH = "resource.upload.path"; /** * data basedir path */ public static final String DATA_BASEDIR_PATH = "data.basedir.path"; /** * dolphinscheduler.env.path */ public static final String DOLPHINSCHEDULER_ENV_PATH = "dolphinscheduler.env.path"; /** * environment properties default path */ public static final String ENV_PATH = "env/dolphinscheduler_env.sh"; /** * python home */ public static final String PYTHON_HOME = "PYTHON_HOME"; /** * resource.view.suffixs */ public static final String RESOURCE_VIEW_SUFFIXS = "resource.view.suffixs"; public static final String RESOURCE_VIEW_SUFFIXS_DEFAULT_VALUE = "txt,log,sh,bat,conf,cfg,py,java,sql,xml,hql,properties,json,yml,yaml,ini,js"; /** * development.state */ public static final String DEVELOPMENT_STATE = "development.state"; public static final String DEVELOPMENT_STATE_DEFAULT_VALUE = "true"; /** * string true */ public static final String STRING_TRUE = "true"; /** * string false */ public static final String STRING_FALSE = "false"; /** * resource storage type */ public static final String RESOURCE_STORAGE_TYPE = "resource.storage.type"; /** * MasterServer directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_MASTERS = "/nodes/master"; /** * WorkerServer directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_WORKERS = "/nodes/worker"; /** * all servers directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_DEAD_SERVERS = "/dead-servers"; /** * MasterServer lock directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_MASTERS = "/lock/masters"; /** * MasterServer failover directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_MASTERS = "/lock/failover/masters"; /** * WorkerServer failover directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_WORKERS = "/lock/failover/workers"; /** * MasterServer startup failover runing and fault tolerance process */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_STARTUP_MASTERS = "/lock/failover/startup-masters"; /** * comma , */ public static final String COMMA = ","; /** * slash / */ public static final String SLASH = "/"; /** * COLON : */ public static final String COLON = ":"; /** * SPACE " " */ public static final String SPACE = " "; /** * SINGLE_SLASH / */ public static final String SINGLE_SLASH = "/"; /** * DOUBLE_SLASH // */ public static final String DOUBLE_SLASH = "//"; /** * SINGLE_QUOTES "'" */ public static final String SINGLE_QUOTES = "'"; /** * DOUBLE_QUOTES "\"" */ public static final String DOUBLE_QUOTES = "\""; /** * SEMICOLON ; */ public static final String SEMICOLON = ";"; /** * EQUAL SIGN */ public static final String EQUAL_SIGN = "="; /** * AT SIGN */ public static final String AT_SIGN = "@"; public static final String WORKER_MAX_CPULOAD_AVG = "worker.max.cpuload.avg"; public static final String WORKER_RESERVED_MEMORY = "worker.reserved.memory"; public static final String MASTER_MAX_CPULOAD_AVG = "master.max.cpuload.avg"; public static final String MASTER_RESERVED_MEMORY = "master.reserved.memory"; /** * date format of yyyy-MM-dd HH:mm:ss */ public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; /** * date format of yyyyMMddHHmmss */ public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; /** * date format of yyyyMMddHHmmssSSS */ public static final String YYYYMMDDHHMMSSSSS = "yyyyMMddHHmmssSSS"; /** * http connect time out */ public static final int HTTP_CONNECT_TIMEOUT = 60 * 1000; /** * http connect request time out */ public static final int HTTP_CONNECTION_REQUEST_TIMEOUT = 60 * 1000; /** * httpclient soceket time out */ public static final int SOCKET_TIMEOUT = 60 * 1000; /** * http header */ public static final String HTTP_HEADER_UNKNOWN = "unKnown"; /** * http X-Forwarded-For */ public static final String HTTP_X_FORWARDED_FOR = "X-Forwarded-For"; /** * http X-Real-IP */ public static final String HTTP_X_REAL_IP = "X-Real-IP"; /** * UTF-8 */ public static final String UTF_8 = "UTF-8"; /** * user name regex */ public static final Pattern REGEX_USER_NAME = Pattern.compile("^[a-zA-Z0-9._-]{3,39}$"); /** * email regex */ public static final Pattern REGEX_MAIL_NAME = Pattern.compile("^([a-z0-9A-Z]+[_|\\-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"); /** * read permission */ public static final int READ_PERMISSION = 2 * 1; /** * write permission */ public static final int WRITE_PERMISSION = 2 * 2; /** * execute permission */ public static final int EXECUTE_PERMISSION = 1; /** * default admin permission */ public static final int DEFAULT_ADMIN_PERMISSION = 7; /** * all permissions */ public static final int ALL_PERMISSIONS = READ_PERMISSION | WRITE_PERMISSION | EXECUTE_PERMISSION; /** * max task timeout */ public static final int MAX_TASK_TIMEOUT = 24 * 3600; /** * master cpu load */ public static final int DEFAULT_MASTER_CPU_LOAD = Runtime.getRuntime().availableProcessors() * 2; /** * master reserved memory */ public static final double DEFAULT_MASTER_RESERVED_MEMORY = OSUtils.totalMemorySize() / 10; /** * worker cpu load */ public static final int DEFAULT_WORKER_CPU_LOAD = Runtime.getRuntime().availableProcessors() * 2; /** * worker reserved memory */ public static final double DEFAULT_WORKER_RESERVED_MEMORY = OSUtils.totalMemorySize() / 10; /** * default log cache rows num,output when reach the number */ public static final int DEFAULT_LOG_ROWS_NUM = 4 * 16; /** * log flush interval?output when reach the interval */ public static final int DEFAULT_LOG_FLUSH_INTERVAL = 1000; /** * time unit secong to minutes */ public static final int SEC_2_MINUTES_TIME_UNIT = 60; /*** * * rpc port */ public static final int RPC_PORT = 50051; /*** * alert rpc port */ public static final int ALERT_RPC_PORT = 50052; /** * forbid running task */ public static final String FLOWNODE_RUN_FLAG_FORBIDDEN = "FORBIDDEN"; /** * datasource configuration path */ public static final String DATASOURCE_PROPERTIES = "/datasource.properties"; public static final String TASK_RECORD_URL = "task.record.datasource.url"; public static final String TASK_RECORD_FLAG = "task.record.flag"; public static final String TASK_RECORD_USER = "task.record.datasource.username"; public static final String TASK_RECORD_PWD = "task.record.datasource.password"; public static final String DEFAULT = "Default"; public static final String USER = "user"; public static final String PASSWORD = "password"; public static final String XXXXXX = "******"; public static final String NULL = "NULL"; public static final String THREAD_NAME_MASTER_SERVER = "Master-Server"; public static final String THREAD_NAME_WORKER_SERVER = "Worker-Server"; public static final String TASK_RECORD_TABLE_HIVE_LOG = "eamp_hive_log_hd"; public static final String TASK_RECORD_TABLE_HISTORY_HIVE_LOG = "eamp_hive_hist_log_hd"; /** * command parameter keys */ public static final String CMD_PARAM_RECOVER_PROCESS_ID_STRING = "ProcessInstanceId"; public static final String CMD_PARAM_RECOVERY_START_NODE_STRING = "StartNodeIdList"; public static final String CMD_PARAM_RECOVERY_WAITING_THREAD = "WaitingThreadInstanceId"; public static final String CMD_PARAM_SUB_PROCESS = "processInstanceId"; public static final String CMD_PARAM_EMPTY_SUB_PROCESS = "0"; public static final String CMD_PARAM_SUB_PROCESS_PARENT_INSTANCE_ID = "parentProcessInstanceId"; public static final String CMD_PARAM_SUB_PROCESS_DEFINE_ID = "processDefinitionId"; public static final String CMD_PARAM_START_NODE_NAMES = "StartNodeNameList"; public static final String CMD_PARAM_START_PARAMS = "StartParams"; /** * complement data start date */ public static final String CMDPARAM_COMPLEMENT_DATA_START_DATE = "complementStartDate"; /** * complement data end date */ public static final String CMDPARAM_COMPLEMENT_DATA_END_DATE = "complementEndDate"; /** * hadoop configuration */ public static final String HADOOP_RM_STATE_ACTIVE = "ACTIVE"; public static final String HADOOP_RM_STATE_STANDBY = "STANDBY"; public static final String HADOOP_RESOURCE_MANAGER_HTTPADDRESS_PORT = "resource.manager.httpaddress.port"; /** * data source config */ public static final String SPRING_DATASOURCE_DRIVER_CLASS_NAME = "spring.datasource.driver-class-name"; public static final String SPRING_DATASOURCE_URL = "spring.datasource.url"; public static final String SPRING_DATASOURCE_USERNAME = "spring.datasource.username"; public static final String SPRING_DATASOURCE_PASSWORD = "spring.datasource.password"; public static final String SPRING_DATASOURCE_VALIDATION_QUERY_TIMEOUT = "spring.datasource.validationQueryTimeout"; public static final String SPRING_DATASOURCE_INITIAL_SIZE = "spring.datasource.initialSize"; public static final String SPRING_DATASOURCE_MIN_IDLE = "spring.datasource.minIdle"; public static final String SPRING_DATASOURCE_MAX_ACTIVE = "spring.datasource.maxActive"; public static final String SPRING_DATASOURCE_MAX_WAIT = "spring.datasource.maxWait"; public static final String SPRING_DATASOURCE_TIME_BETWEEN_EVICTION_RUNS_MILLIS = "spring.datasource.timeBetweenEvictionRunsMillis"; public static final String SPRING_DATASOURCE_TIME_BETWEEN_CONNECT_ERROR_MILLIS = "spring.datasource.timeBetweenConnectErrorMillis"; public static final String SPRING_DATASOURCE_MIN_EVICTABLE_IDLE_TIME_MILLIS = "spring.datasource.minEvictableIdleTimeMillis"; public static final String SPRING_DATASOURCE_VALIDATION_QUERY = "spring.datasource.validationQuery"; public static final String SPRING_DATASOURCE_TEST_WHILE_IDLE = "spring.datasource.testWhileIdle"; public static final String SPRING_DATASOURCE_TEST_ON_BORROW = "spring.datasource.testOnBorrow"; public static final String SPRING_DATASOURCE_TEST_ON_RETURN = "spring.datasource.testOnReturn"; public static final String SPRING_DATASOURCE_POOL_PREPARED_STATEMENTS = "spring.datasource.poolPreparedStatements"; public static final String SPRING_DATASOURCE_DEFAULT_AUTO_COMMIT = "spring.datasource.defaultAutoCommit"; public static final String SPRING_DATASOURCE_KEEP_ALIVE = "spring.datasource.keepAlive"; public static final String SPRING_DATASOURCE_MAX_POOL_PREPARED_STATEMENT_PER_CONNECTION_SIZE = "spring.datasource.maxPoolPreparedStatementPerConnectionSize"; public static final String DEVELOPMENT = "development"; public static final String QUARTZ_PROPERTIES_PATH = "quartz.properties"; /** * sleep time */ public static final int SLEEP_TIME_MILLIS = 1000; /** * heartbeat for zk info length */ public static final int HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH = 10; /** * hadoop params * jar */ public static final String JAR = "jar"; /** * hadoop */ public static final String HADOOP = "hadoop"; /** * -D parameter */ public static final String D = "-D"; /** * -D mapreduce.job.queuename=ququename */ public static final String MR_QUEUE = "mapreduce.job.queuename"; /** * spark params constant */ public static final String MASTER = "--master"; public static final String DEPLOY_MODE = "--deploy-mode"; /** * --class CLASS_NAME */ public static final String MAIN_CLASS = "--class"; /** * --driver-cores NUM */ public static final String DRIVER_CORES = "--driver-cores"; /** * --driver-memory MEM */ public static final String DRIVER_MEMORY = "--driver-memory"; /** * --num-executors NUM */ public static final String NUM_EXECUTORS = "--num-executors"; /** * --executor-cores NUM */ public static final String EXECUTOR_CORES = "--executor-cores"; /** * --executor-memory MEM */ public static final String EXECUTOR_MEMORY = "--executor-memory"; /** * --queue QUEUE */ public static final String SPARK_QUEUE = "--queue"; /** * exit code success */ public static final int EXIT_CODE_SUCCESS = 0; /** * exit code kill */ public static final int EXIT_CODE_KILL = 137; /** * exit code failure */ public static final int EXIT_CODE_FAILURE = -1; /** * date format of yyyyMMdd */ public static final String PARAMETER_FORMAT_DATE = "yyyyMMdd"; /** * date format of yyyyMMddHHmmss */ public static final String PARAMETER_FORMAT_TIME = "yyyyMMddHHmmss"; /** * system date(yyyyMMddHHmmss) */ public static final String PARAMETER_DATETIME = "system.datetime"; /** * system date(yyyymmdd) today */ public static final String PARAMETER_CURRENT_DATE = "system.biz.curdate"; /** * system date(yyyymmdd) yesterday */ public static final String PARAMETER_BUSINESS_DATE = "system.biz.date"; /** * ACCEPTED */ public static final String ACCEPTED = "ACCEPTED"; /** * SUCCEEDED */ public static final String SUCCEEDED = "SUCCEEDED"; /** * NEW */ public static final String NEW = "NEW"; /** * NEW_SAVING */ public static final String NEW_SAVING = "NEW_SAVING"; /** * SUBMITTED */ public static final String SUBMITTED = "SUBMITTED"; /** * FAILED */ public static final String FAILED = "FAILED"; /** * KILLED */ public static final String KILLED = "KILLED"; /** * RUNNING */ public static final String RUNNING = "RUNNING"; /** * underline "_" */ public static final String UNDERLINE = "_"; /** * quartz job prifix */ public static final String QUARTZ_JOB_PRIFIX = "job"; /** * quartz job group prifix */ public static final String QUARTZ_JOB_GROUP_PRIFIX = "jobgroup"; /** * projectId */ public static final String PROJECT_ID = "projectId"; /** * processId */ public static final String SCHEDULE_ID = "scheduleId"; /** * schedule */ public static final String SCHEDULE = "schedule"; /** * application regex */ public static final String APPLICATION_REGEX = "application_\\d+_\\d+"; public static final String PID = OSUtils.isWindows() ? "handle" : "pid"; /** * month_begin */ public static final String MONTH_BEGIN = "month_begin"; /** * add_months */ public static final String ADD_MONTHS = "add_months"; /** * month_end */ public static final String MONTH_END = "month_end"; /** * week_begin */ public static final String WEEK_BEGIN = "week_begin"; /** * week_end */ public static final String WEEK_END = "week_end"; /** * timestamp */ public static final String TIMESTAMP = "timestamp"; public static final char SUBTRACT_CHAR = '-'; public static final char ADD_CHAR = '+'; public static final char MULTIPLY_CHAR = '*'; public static final char DIVISION_CHAR = '/'; public static final char LEFT_BRACE_CHAR = '('; public static final char RIGHT_BRACE_CHAR = ')'; public static final String ADD_STRING = "+"; public static final String MULTIPLY_STRING = "*"; public static final String DIVISION_STRING = "/"; public static final String LEFT_BRACE_STRING = "("; public static final char P = 'P'; public static final char N = 'N'; public static final String SUBTRACT_STRING = "-"; public static final String GLOBAL_PARAMS = "globalParams"; public static final String LOCAL_PARAMS = "localParams"; public static final String LOCAL_PARAMS_LIST = "localParamsList"; public static final String SUBPROCESS_INSTANCE_ID = "subProcessInstanceId"; public static final String PROCESS_INSTANCE_STATE = "processInstanceState"; public static final String PARENT_WORKFLOW_INSTANCE = "parentWorkflowInstance"; public static final String TASK_TYPE = "taskType"; public static final String TASK_LIST = "taskList"; public static final String RWXR_XR_X = "rwxr-xr-x"; public static final String QUEUE = "queue"; public static final String QUEUE_NAME = "queueName"; public static final int LOG_QUERY_SKIP_LINE_NUMBER = 0; public static final int LOG_QUERY_LIMIT = 4096; /** * master/worker server use for zk */ public static final String MASTER_PREFIX = "master"; public static final String WORKER_PREFIX = "worker"; public static final String DELETE_ZK_OP = "delete"; public static final String ADD_ZK_OP = "add"; public static final String ALIAS = "alias"; public static final String CONTENT = "content"; public static final String DEPENDENT_SPLIT = ":||"; public static final String DEPENDENT_ALL = "ALL"; /** * preview schedule execute count */ public static final int PREVIEW_SCHEDULE_EXECUTE_COUNT = 5; /** * kerberos */ public static final String KERBEROS = "kerberos"; /** * kerberos expire time */ public static final String KERBEROS_EXPIRE_TIME = "kerberos.expire.time"; /** * java.security.krb5.conf */ public static final String JAVA_SECURITY_KRB5_CONF = "java.security.krb5.conf"; /** * java.security.krb5.conf.path */ public static final String JAVA_SECURITY_KRB5_CONF_PATH = "java.security.krb5.conf.path"; /** * hadoop.security.authentication */ public static final String HADOOP_SECURITY_AUTHENTICATION = "hadoop.security.authentication"; /** * hadoop.security.authentication */ public static final String HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE = "hadoop.security.authentication.startup.state"; /** * com.amazonaws.services.s3.enableV4 */ public static final String AWS_S3_V4 = "com.amazonaws.services.s3.enableV4"; /** * loginUserFromKeytab user */ public static final String LOGIN_USER_KEY_TAB_USERNAME = "login.user.keytab.username"; /** * default worker group id */ public static final int DEFAULT_WORKER_ID = -1; /** * loginUserFromKeytab path */ public static final String LOGIN_USER_KEY_TAB_PATH = "login.user.keytab.path"; /** * task log info format */ public static final String TASK_LOG_INFO_FORMAT = "TaskLogInfo-%s"; /** * hive conf */ public static final String HIVE_CONF = "hiveconf:"; /** * flink */ public static final String FLINK_YARN_CLUSTER = "yarn-cluster"; public static final String FLINK_RUN_MODE = "-m"; public static final String FLINK_YARN_SLOT = "-ys"; public static final String FLINK_APP_NAME = "-ynm"; public static final String FLINK_QUEUE = "-yqu"; public static final String FLINK_TASK_MANAGE = "-yn"; public static final String FLINK_JOB_MANAGE_MEM = "-yjm"; public static final String FLINK_TASK_MANAGE_MEM = "-ytm"; public static final String FLINK_MAIN_CLASS = "-c"; public static final String FLINK_PARALLELISM = "-p"; public static final String FLINK_SHUTDOWN_ON_ATTACHED_EXIT = "-sae"; public static final int[] NOT_TERMINATED_STATES = new int[] { ExecutionStatus.SUBMITTED_SUCCESS.ordinal(), ExecutionStatus.RUNNING_EXECUTION.ordinal(), ExecutionStatus.DELAY_EXECUTION.ordinal(), ExecutionStatus.READY_PAUSE.ordinal(), ExecutionStatus.READY_STOP.ordinal(), ExecutionStatus.NEED_FAULT_TOLERANCE.ordinal(), ExecutionStatus.WAITTING_THREAD.ordinal(), ExecutionStatus.WAITTING_DEPEND.ordinal() }; /** * status */ public static final String STATUS = "status"; /** * message */ public static final String MSG = "msg"; /** * data total */ public static final String COUNT = "count"; /** * page size */ public static final String PAGE_SIZE = "pageSize"; /** * current page no */ public static final String PAGE_NUMBER = "pageNo"; /** * */ public static final String DATA_LIST = "data"; public static final String TOTAL_LIST = "totalList"; public static final String CURRENT_PAGE = "currentPage"; public static final String TOTAL_PAGE = "totalPage"; public static final String TOTAL = "total"; /** * workflow */ public static final String WORKFLOW_LIST = "workFlowList"; public static final String WORKFLOW_RELATION_LIST = "workFlowRelationList"; /** * session user */ public static final String SESSION_USER = "session.user"; public static final String SESSION_ID = "sessionId"; public static final String PASSWORD_DEFAULT = "******"; /** * locale */ public static final String LOCALE_LANGUAGE = "language"; /** * driver */ public static final String ORG_POSTGRESQL_DRIVER = "org.postgresql.Driver"; public static final String COM_MYSQL_JDBC_DRIVER = "com.mysql.jdbc.Driver"; public static final String ORG_APACHE_HIVE_JDBC_HIVE_DRIVER = "org.apache.hive.jdbc.HiveDriver"; public static final String COM_CLICKHOUSE_JDBC_DRIVER = "ru.yandex.clickhouse.ClickHouseDriver"; public static final String COM_ORACLE_JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver"; public static final String COM_SQLSERVER_JDBC_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; public static final String COM_DB2_JDBC_DRIVER = "com.ibm.db2.jcc.DB2Driver"; public static final String COM_PRESTO_JDBC_DRIVER = "com.facebook.presto.jdbc.PrestoDriver"; /** * database type */ public static final String MYSQL = "MYSQL"; public static final String POSTGRESQL = "POSTGRESQL"; public static final String HIVE = "HIVE"; public static final String SPARK = "SPARK"; public static final String CLICKHOUSE = "CLICKHOUSE"; public static final String ORACLE = "ORACLE"; public static final String SQLSERVER = "SQLSERVER"; public static final String DB2 = "DB2"; public static final String PRESTO = "PRESTO"; /** * jdbc url */ public static final String JDBC_MYSQL = "jdbc:mysql://"; public static final String JDBC_POSTGRESQL = "jdbc:postgresql://"; public static final String JDBC_HIVE_2 = "jdbc:hive2://"; public static final String JDBC_CLICKHOUSE = "jdbc:clickhouse://"; public static final String JDBC_ORACLE_SID = "jdbc:oracle:thin:@"; public static final String JDBC_ORACLE_SERVICE_NAME = "jdbc:oracle:thin:@//"; public static final String JDBC_SQLSERVER = "jdbc:sqlserver://"; public static final String JDBC_DB2 = "jdbc:db2://"; public static final String JDBC_PRESTO = "jdbc:presto://"; public static final String ADDRESS = "address"; public static final String DATABASE = "database"; public static final String JDBC_URL = "jdbcUrl"; public static final String PRINCIPAL = "principal"; public static final String OTHER = "other"; public static final String ORACLE_DB_CONNECT_TYPE = "connectType"; public static final String KERBEROS_KRB5_CONF_PATH = "javaSecurityKrb5Conf"; public static final String KERBEROS_KEY_TAB_USERNAME = "loginUserKeytabUsername"; public static final String KERBEROS_KEY_TAB_PATH = "loginUserKeytabPath"; /** * session timeout */ public static final int SESSION_TIME_OUT = 7200; public static final int MAX_FILE_SIZE = 1024 * 1024 * 1024; public static final String UDF = "UDF"; public static final String CLASS = "class"; public static final String RECEIVERS = "receivers"; public static final String RECEIVERS_CC = "receiversCc"; /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))"; /** * default worker group */ public static final String DEFAULT_WORKER_GROUP = "default"; public static final Integer TASK_INFO_LENGTH = 5; /** * new * schedule time */ public static final String PARAMETER_SHECDULE_TIME = "schedule.time"; /** * authorize writable perm */ public static final int AUTHORIZE_WRITABLE_PERM = 7; /** * authorize readable perm */ public static final int AUTHORIZE_READABLE_PERM = 4; /** * plugin configurations */ public static final String PLUGIN_JAR_SUFFIX = ".jar"; public static final int NORMAL_NODE_STATUS = 0; public static final int ABNORMAL_NODE_STATUS = 1; public static final String START_TIME = "start time"; public static final String END_TIME = "end time"; public static final String START_END_DATE = "startDate,endDate"; /** * system line separator */ public static final String SYSTEM_LINE_SEPARATOR = System.getProperty("line.separator"); /** * net system properties */ public static final String DOLPHIN_SCHEDULER_PREFERRED_NETWORK_INTERFACE = "dolphin.scheduler.network.interface.preferred"; public static final String EXCEL_SUFFIX_XLS = ".xls"; /** * datasource encryption salt */ public static final String DATASOURCE_ENCRYPTION_SALT_DEFAULT = "!@#$%^&*"; public static final String DATASOURCE_ENCRYPTION_ENABLE = "datasource.encryption.enable"; public static final String DATASOURCE_ENCRYPTION_SALT = "datasource.encryption.salt"; /** * Network IP gets priority, default inner outer */ public static final String NETWORK_PRIORITY_STRATEGY = "dolphin.scheduler.network.priority.strategy"; /** * exec shell scripts */ public static final String SH = "sh"; /** * pstree, get pud and sub pid */ public static final String PSTREE = "pstree"; /** * docker & kubernetes */ public static final boolean DOCKER_MODE = StringUtils.isNotEmpty(System.getenv("DOCKER")); public static final boolean KUBERNETES_MODE = StringUtils.isNotEmpty(System.getenv("KUBERNETES_SERVICE_HOST")) && StringUtils.isNotEmpty(System.getenv("KUBERNETES_SERVICE_PORT")); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,960
[Feature][Spark] Support spark name
**Describe the feature** Support spark name, which is common option **Is your feature request related to a problem? Please describe.** No. **Describe the solution you'd like** I will implement this feature
https://github.com/apache/dolphinscheduler/issues/4960
https://github.com/apache/dolphinscheduler/pull/4959
0ac0f31548ef8bfe9a968663db11fd3e09d0bf2d
e74932cfc21c95d7824cd55dd3cb6e441e2b8305
"2021-03-04T17:04:42Z"
java
"2021-03-09T04:51:35Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/spark/SparkParameters.java
/* * 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.dolphinscheduler.common.task.spark; import org.apache.dolphinscheduler.common.enums.ProgramType; import org.apache.dolphinscheduler.common.process.ResourceInfo; import org.apache.dolphinscheduler.common.task.AbstractParameters; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import java.util.ArrayList; import java.util.List; /** * spark parameters */ public class SparkParameters extends AbstractParameters { /** * major jar */ private ResourceInfo mainJar; /** * major class */ private String mainClass; /** * deploy mode */ private String deployMode; /** * arguments */ private String mainArgs; /** * driver-cores Number of cores used by the driver, only in cluster mode */ private int driverCores; /** * driver-memory Memory for driver */ private String driverMemory; /** * num-executors Number of executors to launch */ private int numExecutors; /** * executor-cores Number of cores per executor */ private int executorCores; /** * Memory per executor */ private String executorMemory; /** * resource list */ private List<ResourceInfo> resourceList = new ArrayList<>(); /** * The YARN queue to submit to */ private String queue; /** * other arguments */ private String others; /** * program type * 0 JAVA,1 SCALA,2 PYTHON */ private ProgramType programType; /** * spark version */ private String sparkVersion; public ResourceInfo getMainJar() { return mainJar; } public void setMainJar(ResourceInfo mainJar) { this.mainJar = mainJar; } public String getMainClass() { return mainClass; } public void setMainClass(String mainClass) { this.mainClass = mainClass; } public String getDeployMode() { return deployMode; } public void setDeployMode(String deployMode) { this.deployMode = deployMode; } public String getMainArgs() { return mainArgs; } public void setMainArgs(String mainArgs) { this.mainArgs = mainArgs; } public int getDriverCores() { return driverCores; } public void setDriverCores(int driverCores) { this.driverCores = driverCores; } public String getDriverMemory() { return driverMemory; } public void setDriverMemory(String driverMemory) { this.driverMemory = driverMemory; } public int getNumExecutors() { return numExecutors; } public void setNumExecutors(int numExecutors) { this.numExecutors = numExecutors; } public int getExecutorCores() { return executorCores; } public void setExecutorCores(int executorCores) { this.executorCores = executorCores; } public String getExecutorMemory() { return executorMemory; } public void setExecutorMemory(String executorMemory) { this.executorMemory = executorMemory; } public String getQueue() { return queue; } public void setQueue(String queue) { this.queue = queue; } public List<ResourceInfo> getResourceList() { return resourceList; } public void setResourceList(List<ResourceInfo> resourceList) { this.resourceList = resourceList; } public String getOthers() { return others; } public void setOthers(String others) { this.others = others; } public ProgramType getProgramType() { return programType; } public void setProgramType(ProgramType programType) { this.programType = programType; } public String getSparkVersion() { return sparkVersion; } public void setSparkVersion(String sparkVersion) { this.sparkVersion = sparkVersion; } @Override public boolean checkParameters() { return mainJar != null && programType != null; } @Override public List<ResourceInfo> getResourceFilesList() { if (mainJar != null && !resourceList.contains(mainJar)) { resourceList.add(mainJar); } return resourceList; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,960
[Feature][Spark] Support spark name
**Describe the feature** Support spark name, which is common option **Is your feature request related to a problem? Please describe.** No. **Describe the solution you'd like** I will implement this feature
https://github.com/apache/dolphinscheduler/issues/4960
https://github.com/apache/dolphinscheduler/pull/4959
0ac0f31548ef8bfe9a968663db11fd3e09d0bf2d
e74932cfc21c95d7824cd55dd3cb6e441e2b8305
"2021-03-04T17:04:42Z"
java
"2021-03-09T04:51:35Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/FlinkArgsUtils.java
/* * 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.dolphinscheduler.server.utils; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ProgramType; import org.apache.dolphinscheduler.common.process.ResourceInfo; import org.apache.dolphinscheduler.common.task.flink.FlinkParameters; import org.apache.dolphinscheduler.common.utils.StringUtils; import java.util.ArrayList; import java.util.List; /** * flink args utils */ public class FlinkArgsUtils { private static final String LOCAL_DEPLOY_MODE = "local"; private static final String FLINK_VERSION_BEFORE_1_10 = "<1.10"; /** * build args * @param param flink parameters * @return argument list */ public static List<String> buildArgs(FlinkParameters param) { List<String> args = new ArrayList<>(); String deployMode = "cluster"; String tmpDeployMode = param.getDeployMode(); if (StringUtils.isNotEmpty(tmpDeployMode)) { deployMode = tmpDeployMode; } String others = param.getOthers(); if (!LOCAL_DEPLOY_MODE.equals(deployMode)) { args.add(Constants.FLINK_RUN_MODE); //-m args.add(Constants.FLINK_YARN_CLUSTER); //yarn-cluster int slot = param.getSlot(); if (slot > 0) { args.add(Constants.FLINK_YARN_SLOT); args.add(String.format("%d", slot)); //-ys } String appName = param.getAppName(); if (StringUtils.isNotEmpty(appName)) { //-ynm args.add(Constants.FLINK_APP_NAME); args.add(ArgsUtils.escape(appName)); } // judge flink version, the parameter -yn has removed from flink 1.10 String flinkVersion = param.getFlinkVersion(); if (flinkVersion == null || FLINK_VERSION_BEFORE_1_10.equals(flinkVersion)) { int taskManager = param.getTaskManager(); if (taskManager > 0) { //-yn args.add(Constants.FLINK_TASK_MANAGE); args.add(String.format("%d", taskManager)); } } String jobManagerMemory = param.getJobManagerMemory(); if (StringUtils.isNotEmpty(jobManagerMemory)) { args.add(Constants.FLINK_JOB_MANAGE_MEM); args.add(jobManagerMemory); //-yjm } String taskManagerMemory = param.getTaskManagerMemory(); if (StringUtils.isNotEmpty(taskManagerMemory)) { // -ytm args.add(Constants.FLINK_TASK_MANAGE_MEM); args.add(taskManagerMemory); } if (StringUtils.isEmpty(others) || !others.contains(Constants.FLINK_QUEUE)) { String queue = param.getQueue(); if (StringUtils.isNotEmpty(queue)) { // -yqu args.add(Constants.FLINK_QUEUE); args.add(queue); } } } int parallelism = param.getParallelism(); if (parallelism > 0) { args.add(Constants.FLINK_PARALLELISM); args.add(String.format("%d", parallelism)); // -p } // If the job is submitted in attached mode, perform a best-effort cluster shutdown when the CLI is terminated abruptly // The task status will be synchronized with the cluster job status args.add(Constants.FLINK_SHUTDOWN_ON_ATTACHED_EXIT); // -sae // -s -yqu -yat -yD -D if (StringUtils.isNotEmpty(others)) { args.add(others); } ProgramType programType = param.getProgramType(); String mainClass = param.getMainClass(); if (programType != null && programType != ProgramType.PYTHON && StringUtils.isNotEmpty(mainClass)) { args.add(Constants.FLINK_MAIN_CLASS); //-c args.add(param.getMainClass()); //main class } ResourceInfo mainJar = param.getMainJar(); if (mainJar != null) { args.add(mainJar.getRes()); } String mainArgs = param.getMainArgs(); if (StringUtils.isNotEmpty(mainArgs)) { args.add(mainArgs); } return args; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,960
[Feature][Spark] Support spark name
**Describe the feature** Support spark name, which is common option **Is your feature request related to a problem? Please describe.** No. **Describe the solution you'd like** I will implement this feature
https://github.com/apache/dolphinscheduler/issues/4960
https://github.com/apache/dolphinscheduler/pull/4959
0ac0f31548ef8bfe9a968663db11fd3e09d0bf2d
e74932cfc21c95d7824cd55dd3cb6e441e2b8305
"2021-03-04T17:04:42Z"
java
"2021-03-09T04:51:35Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/SparkArgsUtils.java
/* * 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.dolphinscheduler.server.utils; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ProgramType; import org.apache.dolphinscheduler.common.process.ResourceInfo; import org.apache.dolphinscheduler.common.task.spark.SparkParameters; import org.apache.dolphinscheduler.common.utils.StringUtils; import java.util.ArrayList; import java.util.List; /** * spark args utils */ public class SparkArgsUtils { private static final String SPARK_CLUSTER = "cluster"; private static final String SPARK_LOCAL = "local"; private static final String SPARK_ON_YARN = "yarn"; /** * build args * * @param param param * @return argument list */ public static List<String> buildArgs(SparkParameters param) { List<String> args = new ArrayList<>(); String deployMode = SPARK_CLUSTER; args.add(Constants.MASTER); if (StringUtils.isNotEmpty(param.getDeployMode())) { deployMode = param.getDeployMode(); } if (!SPARK_LOCAL.equals(deployMode)) { args.add(SPARK_ON_YARN); args.add(Constants.DEPLOY_MODE); } args.add(param.getDeployMode()); ProgramType type = param.getProgramType(); String mainClass = param.getMainClass(); if (type != null && type != ProgramType.PYTHON && StringUtils.isNotEmpty(mainClass)) { args.add(Constants.MAIN_CLASS); args.add(mainClass); } int driverCores = param.getDriverCores(); if (driverCores != 0) { args.add(Constants.DRIVER_CORES); args.add(String.format("%d", driverCores)); } String driverMemory = param.getDriverMemory(); if (StringUtils.isNotEmpty(driverMemory)) { args.add(Constants.DRIVER_MEMORY); args.add(driverMemory); } int numExecutors = param.getNumExecutors(); if (numExecutors != 0) { args.add(Constants.NUM_EXECUTORS); args.add(String.format("%d", numExecutors)); } int executorCores = param.getExecutorCores(); if (executorCores != 0) { args.add(Constants.EXECUTOR_CORES); args.add(String.format("%d", executorCores)); } String executorMemory = param.getExecutorMemory(); if (StringUtils.isNotEmpty(executorMemory)) { args.add(Constants.EXECUTOR_MEMORY); args.add(executorMemory); } // --files --conf --libjar ... String others = param.getOthers(); String queue = param.getQueue(); if (StringUtils.isNotEmpty(others)) { if (!others.contains(Constants.SPARK_QUEUE) && StringUtils.isNotEmpty(queue)) { args.add(Constants.SPARK_QUEUE); args.add(queue); } args.add(others); } else if (StringUtils.isNotEmpty(queue)) { args.add(Constants.SPARK_QUEUE); args.add(queue); } ResourceInfo mainJar = param.getMainJar(); if (mainJar != null) { args.add(mainJar.getRes()); } String mainArgs = param.getMainArgs(); if (StringUtils.isNotEmpty(mainArgs)) { args.add(mainArgs); } return args; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,960
[Feature][Spark] Support spark name
**Describe the feature** Support spark name, which is common option **Is your feature request related to a problem? Please describe.** No. **Describe the solution you'd like** I will implement this feature
https://github.com/apache/dolphinscheduler/issues/4960
https://github.com/apache/dolphinscheduler/pull/4959
0ac0f31548ef8bfe9a968663db11fd3e09d0bf2d
e74932cfc21c95d7824cd55dd3cb6e441e2b8305
"2021-03-04T17:04:42Z"
java
"2021-03-09T04:51:35Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/mr/MapReduceTask.java
/* * 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.dolphinscheduler.server.worker.task.mr; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.ProgramType; import org.apache.dolphinscheduler.common.process.Property; import org.apache.dolphinscheduler.common.process.ResourceInfo; import org.apache.dolphinscheduler.common.task.AbstractParameters; import org.apache.dolphinscheduler.common.task.mr.MapreduceParameters; import org.apache.dolphinscheduler.common.utils.*; import org.apache.dolphinscheduler.common.utils.ParameterUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.dao.entity.Resource; import org.apache.dolphinscheduler.server.utils.ParamUtils; import org.apache.dolphinscheduler.server.worker.task.AbstractYarnTask; import org.slf4j.Logger; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * mapreduce task */ public class MapReduceTask extends AbstractYarnTask { /** * mapreduce parameters */ private MapreduceParameters mapreduceParameters; /** * taskExecutionContext */ private TaskExecutionContext taskExecutionContext; /** * constructor * @param taskExecutionContext taskExecutionContext * @param logger logger */ public MapReduceTask(TaskExecutionContext taskExecutionContext, Logger logger) { super(taskExecutionContext, logger); this.taskExecutionContext = taskExecutionContext; } @Override public void init() { logger.info("mapreduce task params {}", taskExecutionContext.getTaskParams()); this.mapreduceParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), MapreduceParameters.class); // check parameters if (!mapreduceParameters.checkParameters()) { throw new RuntimeException("mapreduce task params is not valid"); } mapreduceParameters.setQueue(taskExecutionContext.getQueue()); setMainJarName(); // replace placeholder Map<String, Property> paramsMap = ParamUtils.convert(ParamUtils.getUserDefParamsMap(taskExecutionContext.getDefinedParams()), taskExecutionContext.getDefinedParams(), mapreduceParameters.getLocalParametersMap(), CommandType.of(taskExecutionContext.getCmdTypeIfComplement()), taskExecutionContext.getScheduleTime()); if (paramsMap != null){ String args = ParameterUtils.convertParameterPlaceholders(mapreduceParameters.getMainArgs(), ParamUtils.convert(paramsMap)); mapreduceParameters.setMainArgs(args); if(mapreduceParameters.getProgramType() != null && mapreduceParameters.getProgramType() == ProgramType.PYTHON){ String others = ParameterUtils.convertParameterPlaceholders(mapreduceParameters.getOthers(), ParamUtils.convert(paramsMap)); mapreduceParameters.setOthers(others); } } } /** * build command * @return command * @throws Exception exception */ @Override protected String buildCommand() throws Exception { List<String> parameterList = buildParameters(mapreduceParameters); String command = ParameterUtils.convertParameterPlaceholders(String.join(" ", parameterList), taskExecutionContext.getDefinedParams()); logger.info("mapreduce task command: {}", command); return command; } @Override protected void setMainJarName() { // main jar ResourceInfo mainJar = mapreduceParameters.getMainJar(); if (mainJar != null) { int resourceId = mainJar.getId(); String resourceName; if (resourceId == 0) { resourceName = mainJar.getRes(); } else { Resource resource = processService.getResourceById(mapreduceParameters.getMainJar().getId()); if (resource == null) { logger.error("resource id: {} not exist", resourceId); throw new RuntimeException(String.format("resource id: %d not exist", resourceId)); } resourceName = resource.getFullName().replaceFirst("/", ""); } mainJar.setRes(resourceName); mapreduceParameters.setMainJar(mainJar); } } @Override public AbstractParameters getParameters() { return mapreduceParameters; } /** * build parameters * @param mapreduceParameters mapreduce parameters * @return parameter list */ private List<String> buildParameters(MapreduceParameters mapreduceParameters){ List<String> result = new ArrayList<>(); result.add(Constants.HADOOP); // main jar if(mapreduceParameters.getMainJar()!= null){ result.add(Constants.JAR); result.add(mapreduceParameters.getMainJar().getRes()); } // main class if(!ProgramType.PYTHON.equals(mapreduceParameters.getProgramType()) && StringUtils.isNotEmpty(mapreduceParameters.getMainClass())){ result.add(mapreduceParameters.getMainClass()); } // others if (StringUtils.isNotEmpty(mapreduceParameters.getOthers())) { String others = mapreduceParameters.getOthers(); if (!others.contains(Constants.MR_QUEUE) && StringUtils.isNotEmpty(mapreduceParameters.getQueue())) { result.add(String.format("%s %s=%s", Constants.D, Constants.MR_QUEUE, mapreduceParameters.getQueue())); } result.add(mapreduceParameters.getOthers()); }else if (StringUtils.isNotEmpty(mapreduceParameters.getQueue())) { result.add(String.format("%s %s=%s", Constants.D, Constants.MR_QUEUE, mapreduceParameters.getQueue())); } // command args if(StringUtils.isNotEmpty(mapreduceParameters.getMainArgs())){ result.add(mapreduceParameters.getMainArgs()); } return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,960
[Feature][Spark] Support spark name
**Describe the feature** Support spark name, which is common option **Is your feature request related to a problem? Please describe.** No. **Describe the solution you'd like** I will implement this feature
https://github.com/apache/dolphinscheduler/issues/4960
https://github.com/apache/dolphinscheduler/pull/4959
0ac0f31548ef8bfe9a968663db11fd3e09d0bf2d
e74932cfc21c95d7824cd55dd3cb6e441e2b8305
"2021-03-04T17:04:42Z"
java
"2021-03-09T04:51:35Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/spark/SparkTask.java
/* * 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.dolphinscheduler.server.worker.task.spark; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.SparkVersion; import org.apache.dolphinscheduler.common.process.Property; import org.apache.dolphinscheduler.common.process.ResourceInfo; import org.apache.dolphinscheduler.common.task.AbstractParameters; import org.apache.dolphinscheduler.common.task.spark.SparkParameters; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.ParameterUtils; import org.apache.dolphinscheduler.dao.entity.Resource; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.server.utils.ParamUtils; import org.apache.dolphinscheduler.server.utils.SparkArgsUtils; import org.apache.dolphinscheduler.server.worker.task.AbstractYarnTask; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.slf4j.Logger; /** * spark task */ public class SparkTask extends AbstractYarnTask { /** * spark1 command */ private static final String SPARK1_COMMAND = "${SPARK_HOME1}/bin/spark-submit"; /** * spark2 command */ private static final String SPARK2_COMMAND = "${SPARK_HOME2}/bin/spark-submit"; /** * spark parameters */ private SparkParameters sparkParameters; /** * taskExecutionContext */ private final TaskExecutionContext sparkTaskExecutionContext; public SparkTask(TaskExecutionContext taskExecutionContext, Logger logger) { super(taskExecutionContext, logger); this.sparkTaskExecutionContext = taskExecutionContext; } @Override public void init() { logger.info("spark task params {}", sparkTaskExecutionContext.getTaskParams()); sparkParameters = JSONUtils.parseObject(sparkTaskExecutionContext.getTaskParams(), SparkParameters.class); if (null == sparkParameters) { logger.error("Spark params is null"); return; } if (!sparkParameters.checkParameters()) { throw new RuntimeException("spark task params is not valid"); } sparkParameters.setQueue(sparkTaskExecutionContext.getQueue()); setMainJarName(); } /** * create command * * @return command */ @Override protected String buildCommand() { List<String> args = new ArrayList<>(); //spark version String sparkCommand = SPARK2_COMMAND; if (SparkVersion.SPARK1.name().equals(sparkParameters.getSparkVersion())) { sparkCommand = SPARK1_COMMAND; } args.add(sparkCommand); // other parameters args.addAll(SparkArgsUtils.buildArgs(sparkParameters)); // replace placeholder Map<String, Property> paramsMap = ParamUtils.convert(ParamUtils.getUserDefParamsMap(sparkTaskExecutionContext.getDefinedParams()), sparkTaskExecutionContext.getDefinedParams(), sparkParameters.getLocalParametersMap(), CommandType.of(sparkTaskExecutionContext.getCmdTypeIfComplement()), sparkTaskExecutionContext.getScheduleTime()); String command = null; if (null != paramsMap) { command = ParameterUtils.convertParameterPlaceholders(String.join(" ", args), ParamUtils.convert(paramsMap)); } logger.info("spark task command: {}", command); return command; } @Override protected void setMainJarName() { // main jar ResourceInfo mainJar = sparkParameters.getMainJar(); if (null == mainJar) { throw new RuntimeException("Spark task jar params is null"); } int resourceId = mainJar.getId(); String resourceName; if (resourceId == 0) { resourceName = mainJar.getRes(); } else { Resource resource = processService.getResourceById(sparkParameters.getMainJar().getId()); if (resource == null) { logger.error("resource id: {} not exist", resourceId); throw new RuntimeException(String.format("resource id: %d not exist", resourceId)); } resourceName = resource.getFullName().replaceFirst("/", ""); } mainJar.setRes(resourceName); sparkParameters.setMainJar(mainJar); } @Override public AbstractParameters getParameters() { return sparkParameters; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,960
[Feature][Spark] Support spark name
**Describe the feature** Support spark name, which is common option **Is your feature request related to a problem? Please describe.** No. **Describe the solution you'd like** I will implement this feature
https://github.com/apache/dolphinscheduler/issues/4960
https://github.com/apache/dolphinscheduler/pull/4959
0ac0f31548ef8bfe9a968663db11fd3e09d0bf2d
e74932cfc21c95d7824cd55dd3cb6e441e2b8305
"2021-03-04T17:04:42Z"
java
"2021-03-09T04:51:35Z"
dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/utils/FlinkArgsUtilsTest.java
/* * 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.dolphinscheduler.server.utils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; import org.apache.dolphinscheduler.common.enums.ProgramType; import org.apache.dolphinscheduler.common.process.ResourceInfo; import org.apache.dolphinscheduler.common.task.flink.FlinkParameters; import java.util.List; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Test FlinkArgsUtils */ public class FlinkArgsUtilsTest { private static final Logger logger = LoggerFactory.getLogger(FlinkArgsUtilsTest.class); public String mode = "cluster"; public int slot = 2; public int parallelism = 3; public String appName = "testFlink"; public int taskManager = 4; public String taskManagerMemory = "2G"; public String jobManagerMemory = "4G"; public ProgramType programType = ProgramType.JAVA; public String mainClass = "com.test"; public ResourceInfo mainJar = null; public String mainArgs = "testArgs --input file:///home"; public String queue = "queue1"; public String others = "-s hdfs:///flink/savepoint-1537"; public String flinkVersion = "<1.10"; @Before public void setUp() throws Exception { ResourceInfo main = new ResourceInfo(); main.setRes("testflink-1.0.0-SNAPSHOT.jar"); mainJar = main; } /** * Test buildArgs */ @Test public void testBuildArgs() { //Define params FlinkParameters param = new FlinkParameters(); param.setDeployMode(mode); param.setMainClass(mainClass); param.setAppName(appName); param.setSlot(slot); param.setParallelism(parallelism); param.setTaskManager(taskManager); param.setJobManagerMemory(jobManagerMemory); param.setTaskManagerMemory(taskManagerMemory); param.setMainJar(mainJar); param.setProgramType(programType); param.setMainArgs(mainArgs); param.setQueue(queue); param.setOthers(others); param.setFlinkVersion(flinkVersion); //Invoke buildArgs List<String> result = FlinkArgsUtils.buildArgs(param); for (String s : result) { logger.info(s); } //Expected values and order assertEquals(22, result.size()); assertEquals("-m", result.get(0)); assertEquals("yarn-cluster", result.get(1)); assertEquals("-ys", result.get(2)); assertSame(Integer.valueOf(result.get(3)),slot); assertEquals("-ynm",result.get(4)); assertEquals(result.get(5),appName); assertEquals("-yn", result.get(6)); assertSame(Integer.valueOf(result.get(7)),taskManager); assertEquals("-yjm", result.get(8)); assertEquals(result.get(9),jobManagerMemory); assertEquals("-ytm", result.get(10)); assertEquals(result.get(11),taskManagerMemory); assertEquals("-yqu", result.get(12)); assertEquals(result.get(13),queue); assertEquals("-p", result.get(14)); assertSame(Integer.valueOf(result.get(15)),parallelism); assertEquals("-sae", result.get(16)); assertEquals(result.get(17),others); assertEquals("-c", result.get(18)); assertEquals(result.get(19),mainClass); assertEquals(result.get(20),mainJar.getRes()); assertEquals(result.get(21),mainArgs); //Others param without -yqu FlinkParameters param1 = new FlinkParameters(); param1.setQueue(queue); param1.setDeployMode(mode); result = FlinkArgsUtils.buildArgs(param1); assertEquals(5, result.size()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,960
[Feature][Spark] Support spark name
**Describe the feature** Support spark name, which is common option **Is your feature request related to a problem? Please describe.** No. **Describe the solution you'd like** I will implement this feature
https://github.com/apache/dolphinscheduler/issues/4960
https://github.com/apache/dolphinscheduler/pull/4959
0ac0f31548ef8bfe9a968663db11fd3e09d0bf2d
e74932cfc21c95d7824cd55dd3cb6e441e2b8305
"2021-03-04T17:04:42Z"
java
"2021-03-09T04:51:35Z"
dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/utils/SparkArgsUtilsTest.java
/* * 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.dolphinscheduler.server.utils; import org.apache.dolphinscheduler.common.enums.ProgramType; import org.apache.dolphinscheduler.common.process.ResourceInfo; import org.apache.dolphinscheduler.common.task.spark.SparkParameters; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; /** * Test SparkArgsUtils */ public class SparkArgsUtilsTest { private static final Logger logger = LoggerFactory.getLogger(SparkArgsUtilsTest.class); public String mode = "cluster"; public String mainClass = "com.test"; public ResourceInfo mainJar = null; public String mainArgs = "partitions=2"; public String driverMemory = "2G"; public String executorMemory = "4G"; public ProgramType programType = ProgramType.JAVA; public int driverCores = 2; public int executorCores = 6; public String sparkVersion = "SPARK1"; public int numExecutors = 4; public String queue = "queue1"; @Before public void setUp() throws Exception { ResourceInfo main = new ResourceInfo(); main.setRes("testspark-1.0.0-SNAPSHOT.jar"); mainJar = main; } /** * Test buildArgs */ @Test public void testBuildArgs() { //Define params SparkParameters param = new SparkParameters(); param.setDeployMode(mode); param.setMainClass(mainClass); param.setDriverCores(driverCores); param.setDriverMemory(driverMemory); param.setExecutorCores(executorCores); param.setExecutorMemory(executorMemory); param.setMainJar(mainJar); param.setNumExecutors(numExecutors); param.setProgramType(programType); param.setSparkVersion(sparkVersion); param.setMainArgs(mainArgs); param.setQueue(queue); //Invoke buildArgs List<String> result = SparkArgsUtils.buildArgs(param); for (String s : result) { logger.info(s); } //Expected values and order assertEquals(result.size(),20); assertEquals(result.get(0),"--master"); assertEquals(result.get(1),"yarn"); assertEquals(result.get(2),"--deploy-mode"); assertEquals(result.get(3),mode); assertEquals(result.get(4),"--class"); assertEquals(result.get(5),mainClass); assertEquals(result.get(6),"--driver-cores"); assertSame(Integer.valueOf(result.get(7)),driverCores); assertEquals(result.get(8),"--driver-memory"); assertEquals(result.get(9),driverMemory); assertEquals(result.get(10),"--num-executors"); assertSame(Integer.valueOf(result.get(11)),numExecutors); assertEquals(result.get(12),"--executor-cores"); assertSame(Integer.valueOf(result.get(13)),executorCores); assertEquals(result.get(14),"--executor-memory"); assertEquals(result.get(15),executorMemory); assertEquals(result.get(16),"--queue"); assertEquals(result.get(17),queue); assertEquals(result.get(18),mainJar.getRes()); assertEquals(result.get(19),mainArgs); //Others param without --queue SparkParameters param1 = new SparkParameters(); param1.setOthers("--files xxx/hive-site.xml"); param1.setQueue(queue); result = SparkArgsUtils.buildArgs(param1); assertEquals(result.size(),7); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,960
[Feature][Spark] Support spark name
**Describe the feature** Support spark name, which is common option **Is your feature request related to a problem? Please describe.** No. **Describe the solution you'd like** I will implement this feature
https://github.com/apache/dolphinscheduler/issues/4960
https://github.com/apache/dolphinscheduler/pull/4959
0ac0f31548ef8bfe9a968663db11fd3e09d0bf2d
e74932cfc21c95d7824cd55dd3cb6e441e2b8305
"2021-03-04T17:04:42Z"
java
"2021-03-09T04:51:35Z"
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue
/* * 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. */ <template> <div class="spark-model"> <m-list-box> <div slot="text">{{$t('Program Type')}}</div> <div slot="content"> <el-select style="width: 130px;" size="small" v-model="programType" :disabled="isDetails"> <el-option v-for="city in programTypeList" :key="city.code" :value="city.code" :label="city.code"> </el-option> </el-select> </div> </m-list-box> <m-list-box> <div slot="text">{{$t('Spark Version')}}</div> <div slot="content"> <el-select style="width: 130px;" size="small" v-model="sparkVersion" :disabled="isDetails"> <el-option v-for="city in sparkVersionList" :key="city.code" :value="city.code" :label="city.code"> </el-option> </el-select> </div> </m-list-box> <m-list-box v-if="programType !== 'PYTHON'"> <div slot="text">{{$t('Main Class')}}</div> <div slot="content"> <el-input :disabled="isDetails" type="input" size="small" v-model="mainClass" :placeholder="$t('Please enter main class')"> </el-input> </div> </m-list-box> <m-list-box> <div slot="text">{{$t('Main Jar Package')}}</div> <div slot="content"> <treeselect v-model="mainJar" maxHeight="200" :options="mainJarLists" :disable-branch-nodes="true" :normalizer="normalizer" :disabled="isDetails" :placeholder="$t('Please enter main jar package')"> <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName }}</div> </treeselect> </div> </m-list-box> <m-list-box> <div slot="text">{{$t('Deploy Mode')}}</div> <div slot="content"> <el-radio-group v-model="deployMode" size="small"> <el-radio :label="'cluster'" :disabled="isDetails"></el-radio> <el-radio :label="'client'" :disabled="isDetails"></el-radio> <el-radio :label="'local'" :disabled="isDetails"></el-radio> </el-radio-group> </div> </m-list-box> <m-list-4-box> <div slot="text">{{$t('Driver Cores')}}</div> <div slot="content"> <el-input :disabled="isDetails" type="input" size="small" v-model="driverCores" :placeholder="$t('Please enter Driver cores')"> </el-input> </div> <div slot="text-2">{{$t('Driver Memory')}}</div> <div slot="content-2"> <el-input :disabled="isDetails" type="input" size="small" v-model="driverMemory" :placeholder="$t('Please enter Driver memory')"> </el-input> </div> </m-list-4-box> <m-list-4-box> <div slot="text">{{$t('Executor Number')}}</div> <div slot="content"> <el-input :disabled="isDetails" type="input" size="small" v-model="numExecutors" :placeholder="$t('Please enter Executor number')"> </el-input> </div> <div slot="text-2">{{$t('Executor Memory')}}</div> <div slot="content-2"> <el-input :disabled="isDetails" type="input" size="small" v-model="executorMemory" :placeholder="$t('Please enter Executor memory')"> </el-input> </div> </m-list-4-box> <m-list-4-box> <div slot="text">{{$t('Executor Cores')}}</div> <div slot="content"> <el-input :disabled="isDetails" type="input" size="small" v-model="executorCores" :placeholder="$t('Please enter Executor cores')"> </el-input> </div> </m-list-4-box> <m-list-box> <div slot="text">{{$t('Main Arguments')}}</div> <div slot="content"> <el-input :autosize="{minRows:2}" :disabled="isDetails" type="textarea" size="small" v-model="mainArgs" :placeholder="$t('Please enter main arguments')"> </el-input> </div> </m-list-box> <m-list-box> <div slot="text">{{$t('Option Parameters')}}</div> <div slot="content"> <el-input :disabled="isDetails" :autosize="{minRows:2}" type="textarea" size="small" v-model="others" :placeholder="$t('Please enter option parameters')"> </el-input> </div> </m-list-box> <m-list-box> <div slot="text">{{$t('Resources')}}</div> <div slot="content"> <treeselect v-model="resourceList" :multiple="true" maxHeight="200" :options="mainJarList" :normalizer="normalizer" :value-consists-of="valueConsistsOf" :disabled="isDetails" :placeholder="$t('Please select resources')"> <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName }}</div> </treeselect> </div> </m-list-box> <m-list-box> <div slot="text">{{$t('Custom Parameters')}}</div> <div slot="content"> <m-local-params ref="refLocalParams" @on-local-params="_onLocalParams" :udp-list="localParams" :hide="false"> </m-local-params> </div> </m-list-box> </div> </template> <script> import _ from 'lodash' import i18n from '@/module/i18n' import mLocalParams from './_source/localParams' import mListBox from './_source/listBox' import mList4Box from './_source/list4Box' import Treeselect from '@riophae/vue-treeselect' import '@riophae/vue-treeselect/dist/vue-treeselect.css' import disabledState from '@/module/mixin/disabledState' export default { name: 'spark', data () { return { valueConsistsOf: 'LEAF_PRIORITY', // Main function class mainClass: '', // Master jar package mainJar: null, // Master jar package(List) mainJarLists: [], mainJarList: [], // Deployment method deployMode: 'cluster', // Resource(list) resourceList: [], // Cache ResourceList cacheResourceList: [], // Custom function localParams: [], // Driver cores driverCores: 1, // Driver memory driverMemory: '512M', // Executor number numExecutors: 2, // Executor memory executorMemory: '2G', // Executor cores executorCores: 2, // Main arguments mainArgs: '', // Option parameters others: '', // Program type programType: 'SCALA', // Program type(List) programTypeList: [{ code: 'JAVA' }, { code: 'SCALA' }, { code: 'PYTHON' }], // Spark version sparkVersion: 'SPARK2', // Spark version(LIst) sparkVersionList: [{ code: 'SPARK2' }, { code: 'SPARK1' }], normalizer (node) { return { label: node.name } }, allNoResources: [], noRes: [] } }, props: { backfillItem: Object }, mixins: [disabledState], methods: { /** * getResourceId */ marjarId (name) { this.store.dispatch('dag/getResourceId', { type: 'FILE', fullName: '/' + name }).then(res => { this.mainJar = res.id }).catch(e => { this.$message.error(e.msg || '') }) }, /** * return localParams */ _onLocalParams (a) { this.localParams = a }, /** * return resourceList */ _onResourcesData (a) { this.resourceList = a }, /** * cache resourceList */ _onCacheResourcesData (a) { this.cacheResourceList = a }, diGuiTree (item) { // Recursive convenience tree structure item.forEach(item => { item.children === '' || item.children === undefined || item.children === null || item.children.length === 0 ? this.operationTree(item) : this.diGuiTree(item.children) }) }, operationTree (item) { if (item.dirctory) { item.isDisabled = true } delete item.children }, searchTree (element, id) { // 根据id查找节点 if (element.id === id) { return element } else if (element.children !== null) { let i let result = null for (i = 0; result === null && i < element.children.length; i++) { result = this.searchTree(element.children[i], id) } return result } return null }, dataProcess (backResource) { let isResourceId = [] let resourceIdArr = [] if (this.resourceList.length > 0) { this.resourceList.forEach(v => { this.mainJarList.forEach(v1 => { if (this.searchTree(v1, v)) { isResourceId.push(this.searchTree(v1, v)) } }) }) resourceIdArr = isResourceId.map(item => { return item.id }) Array.prototype.diff = function (a) { return this.filter(function (i) { return a.indexOf(i) < 0 }) } let diffSet = this.resourceList.diff(resourceIdArr) let optionsCmp = [] if (diffSet.length > 0) { diffSet.forEach(item => { backResource.forEach(item1 => { if (item === item1.id || item === item1.res) { optionsCmp.push(item1) } }) }) } let noResources = [{ id: -1, name: $t('Unauthorized or deleted resources'), fullName: '/' + $t('Unauthorized or deleted resources'), children: [] }] if (optionsCmp.length > 0) { this.allNoResources = optionsCmp optionsCmp = optionsCmp.map(item => { return { id: item.id, name: item.name, fullName: item.res } }) optionsCmp.forEach(item => { item.isNew = true }) noResources[0].children = optionsCmp this.mainJarList = this.mainJarList.concat(noResources) } } }, /** * verification */ _verification () { if (this.programType !== 'PYTHON' && !this.mainClass) { this.$message.warning(`${i18n.$t('Please enter main class')}`) return false } if (!this.mainJar) { this.$message.warning(`${i18n.$t('Please enter main jar package')}`) return false } if (!this.driverCores) { this.$message.warning(`${i18n.$t('Please enter Driver cores')}`) return false } if (!Number.isInteger(parseInt(this.driverCores))) { this.$message.warning(`${i18n.$t('Core number should be positive integer')}`) return false } if (!this.driverMemory) { this.$message.warning(`${i18n.$t('Please enter Driver memory')}`) return false } if (!Number.isInteger(parseInt(this.driverMemory))) { this.$message.warning(`${i18n.$t('Memory should be a positive integer')}`) return false } if (!this.executorCores) { this.$message.warning(`${i18n.$t('Please enter Executor cores')}`) return false } if (!Number.isInteger(parseInt(this.executorCores))) { this.$message.warning(`${i18n.$t('Core number should be positive integer')}`) return false } if (!this.executorMemory) { this.$message.warning(`${i18n.$t('Please enter Executor memory')}`) return false } if (!Number.isInteger(parseInt(this.executorMemory))) { this.$message.warning(`${i18n.$t('Memory should be a positive integer')}`) return false } if (!this.numExecutors) { this.$message.warning(`${i18n.$t('Please enter Executor number')}`) return false } if (!Number.isInteger(parseInt(this.numExecutors))) { this.$message.warning(`${i18n.$t('The Executor number should be a positive integer')}`) return false } // noRes if (this.noRes.length > 0) { this.$message.warning(`${i18n.$t('Please delete all non-existent resources')}`) return false } // localParams Subcomponent verification if (!this.$refs.refLocalParams._verifProp()) { return false } // Process resourcelist let dataProcessing = _.map(this.resourceList, v => { return { id: v } }) // storage this.$emit('on-params', { mainClass: this.mainClass, mainJar: { id: this.mainJar }, deployMode: this.deployMode, resourceList: dataProcessing, localParams: this.localParams, driverCores: this.driverCores, driverMemory: this.driverMemory, numExecutors: this.numExecutors, executorMemory: this.executorMemory, executorCores: this.executorCores, mainArgs: this.mainArgs, others: this.others, programType: this.programType, sparkVersion: this.sparkVersion }) return true } }, watch: { // Listening type programType (type) { if (type === 'PYTHON') { this.mainClass = '' } }, // Watch the cacheParams cacheParams (val) { this.$emit('on-cache-params', val) }, resourceIdArr (arr) { let result = [] arr.forEach(item => { this.allNoResources.forEach(item1 => { if (item.id === item1.id) { // resultBool = true result.push(item1) } }) }) this.noRes = result } }, computed: { resourceIdArr () { let isResourceId = [] let resourceIdArr = [] if (this.resourceList.length > 0) { this.resourceList.forEach(v => { this.mainJarList.forEach(v1 => { if (this.searchTree(v1, v)) { isResourceId.push(this.searchTree(v1, v)) } }) }) resourceIdArr = isResourceId.map(item => { return { id: item.id, name: item.name, res: item.fullName } }) } return resourceIdArr }, cacheParams () { return { mainClass: this.mainClass, mainJar: { id: this.mainJar }, deployMode: this.deployMode, resourceList: this.resourceIdArr, localParams: this.localParams, driverCores: this.driverCores, driverMemory: this.driverMemory, numExecutors: this.numExecutors, executorMemory: this.executorMemory, executorCores: this.executorCores, mainArgs: this.mainArgs, others: this.others, programType: this.programType, sparkVersion: this.sparkVersion } } }, created () { let item = this.store.state.dag.resourcesListS let items = this.store.state.dag.resourcesListJar this.diGuiTree(item) this.diGuiTree(items) this.mainJarList = item this.mainJarLists = items let o = this.backfillItem // Non-null objects represent backfill if (!_.isEmpty(o)) { this.mainClass = o.params.mainClass || '' if (o.params.mainJar.res) { this.marjarId(o.params.mainJar.res) } else if (o.params.mainJar.res === '') { this.mainJar = '' } else { this.mainJar = o.params.mainJar.id || '' } this.deployMode = o.params.deployMode || '' this.driverCores = o.params.driverCores || 1 this.driverMemory = o.params.driverMemory || '512M' this.numExecutors = o.params.numExecutors || 2 this.executorMemory = o.params.executorMemory || '2G' this.executorCores = o.params.executorCores || 2 this.mainArgs = o.params.mainArgs || '' this.others = o.params.others this.programType = o.params.programType || 'SCALA' this.sparkVersion = o.params.sparkVersion || 'SPARK2' // backfill resourceList let backResource = o.params.resourceList || [] let resourceList = o.params.resourceList || [] if (resourceList.length) { _.map(resourceList, v => { if (!v.id) { this.store.dispatch('dag/getResourceId', { type: 'FILE', fullName: '/' + v.res }).then(res => { this.resourceList.push(res.id) this.dataProcess(backResource) }).catch(e => { this.resourceList.push(v.res) this.dataProcess(backResource) }) } else { this.resourceList.push(v.id) this.dataProcess(backResource) } }) this.cacheResourceList = resourceList } // backfill localParams let localParams = o.params.localParams || [] if (localParams.length) { this.localParams = localParams } } }, mounted () { }, components: { mLocalParams, mListBox, mList4Box, Treeselect } } </script>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,032
[Improvement][Alert] Support send emial attachment
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** When send a email attachment,I got this exception as following: javax.mail.MessagingException: IOException while sending message at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1365) at javax.mail.Transport.send0(Transport.java:255) at javax.mail.Transport.send(Transport.java:124) at org.apache.dolphinscheduler.plugin.alert.email.MailSender.attachContent(MailSender.java:345) at org.apache.dolphinscheduler.plugin.alert.email.MailSender.attachment(MailSender.java:257) at org.apache.dolphinscheduler.plugin.alert.email.MailSender.sendMails(MailSender.java:207) at org.apache.dolphinscheduler.plugin.alert.email.MailSender.sendMails(MailSender.java:143) at org.apache.dolphinscheduler.plugin.alert.email.EmailAlertChannel.process(EmailAlertChannel.java:45) at org.apache.dolphinscheduler.alert.runner.AlertSender.alertResultHandler(AlertSender.java:162) at org.apache.dolphinscheduler.alert.runner.AlertSender.run(AlertSender.java:87) at org.apache.dolphinscheduler.alert.AlertServer.runSender(AlertServer.java:134) at org.apache.dolphinscheduler.alert.AlertServer.start(AlertServer.java:146) at org.apache.dolphinscheduler.alert.AlertServer.main(AlertServer.java:159) Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; boundary="----=_Part_0_1231696346.1615378906068" at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:896) at javax.activation.DataHandler.writeTo(DataHandler.java:317) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ... 12 common frames omitted **What are the current deficiencies and the benefits of improvement** - The dev current only support table and text format email content,but not attachment format **Which version of DolphinScheduler:** -[dev] **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5032
https://github.com/apache/dolphinscheduler/pull/5033
9a3ae4839641d23f32057715ab1e88619d8dfdf8
3769066803803e7f97b1083eff12b1d6f8486771
"2021-03-11T03:13:48Z"
java
"2021-03-11T03:35:25Z"
dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java
/* * 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.dolphinscheduler.plugin.alert.email; import static java.util.Objects.requireNonNull; import org.apache.dolphinscheduler.plugin.alert.email.exception.AlertEmailException; import org.apache.dolphinscheduler.plugin.alert.email.template.AlertTemplate; import org.apache.dolphinscheduler.plugin.alert.email.template.DefaultHTMLTemplate; import org.apache.dolphinscheduler.spi.alert.AlertConstants; import org.apache.dolphinscheduler.spi.alert.AlertResult; import org.apache.dolphinscheduler.spi.alert.ShowType; import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.mail.EmailException; import org.apache.commons.mail.HtmlEmail; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import javax.mail.internet.MimeUtility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.sun.mail.smtp.SMTPProvider; /** * mail utils */ public class MailSender { public static final Logger logger = LoggerFactory.getLogger(MailSender.class); private List<String> receivers; private List<String> receiverCcs; private String mailProtocol = "SMTP"; private String mailSmtpHost; private String mailSmtpPort; private String mailSenderEmail; private String enableSmtpAuth; private String mailUser; private String mailPasswd; private String mailUseStartTLS; private String mailUseSSL; private String xlsFilePath; private String sslTrust; private String showType; private AlertTemplate alertTemplate; private String mustNotNull = "must not be null"; public MailSender(Map<String, String> config) { String receiversConfig = config.get(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS); if (receiversConfig == null || "".equals(receiversConfig)) { throw new AlertEmailException(MailParamsConstants.PLUGIN_DEFAULT_EMAIL_RECEIVERS + mustNotNull); } receivers = Arrays.asList(receiversConfig.split(",")); String receiverCcsConfig = config.get(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS); receiverCcs = new ArrayList<>(); if (receiverCcsConfig != null && !"".equals(receiverCcsConfig)) { receiverCcs = Arrays.asList(receiverCcsConfig.split(",")); } mailSmtpHost = config.get(MailParamsConstants.NAME_MAIL_SMTP_HOST); requireNonNull(mailSmtpHost, MailParamsConstants.MAIL_SMTP_HOST + mustNotNull); mailSmtpPort = config.get(MailParamsConstants.NAME_MAIL_SMTP_PORT); requireNonNull(mailSmtpPort, MailParamsConstants.MAIL_SMTP_PORT + mustNotNull); mailSenderEmail = config.get(MailParamsConstants.NAME_MAIL_SENDER); requireNonNull(mailSenderEmail, MailParamsConstants.MAIL_SENDER + mustNotNull); enableSmtpAuth = config.get(MailParamsConstants.NAME_MAIL_SMTP_AUTH); mailUser = config.get(MailParamsConstants.NAME_MAIL_USER); requireNonNull(mailUser, MailParamsConstants.MAIL_USER + mustNotNull); mailPasswd = config.get(MailParamsConstants.NAME_MAIL_PASSWD); requireNonNull(mailPasswd, MailParamsConstants.MAIL_PASSWD + mustNotNull); mailUseStartTLS = config.get(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE); requireNonNull(mailUseStartTLS, MailParamsConstants.MAIL_SMTP_STARTTLS_ENABLE + mustNotNull); mailUseSSL = config.get(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE); requireNonNull(mailUseSSL, MailParamsConstants.MAIL_SMTP_SSL_ENABLE + mustNotNull); sslTrust = config.get(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST); requireNonNull(sslTrust, MailParamsConstants.MAIL_SMTP_SSL_TRUST + mustNotNull); showType = config.get(AlertConstants.SHOW_TYPE); requireNonNull(showType, AlertConstants.SHOW_TYPE + mustNotNull); xlsFilePath = config.get(EmailConstants.XLS_FILE_PATH); if (StringUtils.isBlank(xlsFilePath)) { xlsFilePath = "/tmp/xls"; } alertTemplate = new DefaultHTMLTemplate(); } /** * send mail to receivers * * @param title title * @param content content */ public AlertResult sendMails(String title, String content) { return sendMails(this.receivers, this.receiverCcs, title, content); } /** * send mail to receivers * * @param title email title * @param content email content */ public AlertResult sendMailsToReceiverOnly(String title, String content) { return sendMails(this.receivers, null, title, content); } /** * send mail * * @param receivers receivers * @param receiverCcs receiverCcs * @param title title * @param content content */ public AlertResult sendMails(List<String> receivers, List<String> receiverCcs, String title, String content) { AlertResult alertResult = new AlertResult(); alertResult.setStatus("false"); // if there is no receivers && no receiversCc, no need to process if (CollectionUtils.isEmpty(receivers) && CollectionUtils.isEmpty(receiverCcs)) { return alertResult; } receivers.removeIf(StringUtils::isEmpty); if (showType.equals(ShowType.TABLE.getDescp()) || showType.equals(ShowType.TEXT.getDescp())) { // send email HtmlEmail email = new HtmlEmail(); try { Session session = getSession(); email.setMailSession(session); email.setFrom(mailSenderEmail); email.setCharset(EmailConstants.UTF_8); if (CollectionUtils.isNotEmpty(receivers)) { // receivers mail for (String receiver : receivers) { email.addTo(receiver); } } if (CollectionUtils.isNotEmpty(receiverCcs)) { //cc for (String receiverCc : receiverCcs) { email.addCc(receiverCc); } } // sender mail return getStringObjectMap(title, content, alertResult, email); } catch (Exception e) { handleException(alertResult, e); } } else if (showType.equals(ShowType.ATTACHMENT.getDescp()) || showType.equals(ShowType.TABLEATTACHMENT.getDescp())) { try { String partContent = (showType.equals(ShowType.ATTACHMENT.getDescp()) ? "Please see the attachment " + title + EmailConstants.EXCEL_SUFFIX_XLS : htmlTable(content, false)); attachment(title, content, partContent); alertResult.setStatus("true"); return alertResult; } catch (Exception e) { handleException(alertResult, e); return alertResult; } } return alertResult; } /** * html table content * * @param content the content * @param showAll if show the whole content * @return the html table form */ private String htmlTable(String content, boolean showAll) { return alertTemplate.getMessageFromTemplate(content, ShowType.TABLE, showAll); } /** * html table content * * @param content the content * @return the html table form */ private String htmlTable(String content) { return htmlTable(content, true); } /** * html text content * * @param content the content * @return text in html form */ private String htmlText(String content) { return alertTemplate.getMessageFromTemplate(content, ShowType.TEXT); } /** * send mail as Excel attachment */ private void attachment(String title, String content, String partContent) throws Exception { MimeMessage msg = getMimeMessage(); attachContent(title, content, partContent, msg); } /** * get MimeMessage */ private MimeMessage getMimeMessage() throws MessagingException { // 1. The first step in creating mail: creating session Session session = getSession(); // Setting debug mode, can be turned off session.setDebug(false); // 2. creating mail: Creating a MimeMessage MimeMessage msg = new MimeMessage(session); // 3. set sender msg.setFrom(new InternetAddress(mailSenderEmail)); // 4. set receivers for (String receiver : receivers) { msg.addRecipients(Message.RecipientType.TO, InternetAddress.parse(receiver)); } return msg; } /** * get session * * @return the new Session */ private Session getSession() { Properties props = new Properties(); props.setProperty(MailParamsConstants.MAIL_SMTP_HOST, mailSmtpHost); props.setProperty(MailParamsConstants.MAIL_SMTP_PORT, mailSmtpPort); props.setProperty(MailParamsConstants.MAIL_SMTP_AUTH, enableSmtpAuth); props.setProperty(EmailConstants.MAIL_TRANSPORT_PROTOCOL, mailProtocol); props.setProperty(MailParamsConstants.MAIL_SMTP_STARTTLS_ENABLE, mailUseStartTLS); props.setProperty(MailParamsConstants.MAIL_SMTP_SSL_ENABLE, mailUseSSL); props.setProperty(MailParamsConstants.MAIL_SMTP_SSL_TRUST, sslTrust); Authenticator auth = new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { // mail username and password return new PasswordAuthentication(mailUser, mailPasswd); } }; Session session = Session.getInstance(props, auth); session.addProvider(new SMTPProvider()); return session; } /** * attach content */ private void attachContent(String title, String content, String partContent, MimeMessage msg) throws MessagingException, IOException { /* * set receiverCc */ if (CollectionUtils.isNotEmpty(receiverCcs)) { for (String receiverCc : receiverCcs) { msg.addRecipients(Message.RecipientType.CC, InternetAddress.parse(receiverCc)); } } // set subject msg.setSubject(title); MimeMultipart partList = new MimeMultipart(); // set signature MimeBodyPart part1 = new MimeBodyPart(); part1.setContent(partContent, EmailConstants.TEXT_HTML_CHARSET_UTF_8); // set attach file MimeBodyPart part2 = new MimeBodyPart(); File file = new File(xlsFilePath + EmailConstants.SINGLE_SLASH + title + EmailConstants.EXCEL_SUFFIX_XLS); if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } // make excel file ExcelUtils.genExcelFile(content, title, xlsFilePath); part2.attachFile(file); part2.setFileName(MimeUtility.encodeText(title + EmailConstants.EXCEL_SUFFIX_XLS, EmailConstants.UTF_8, "B")); // add components to collection partList.addBodyPart(part1); partList.addBodyPart(part2); msg.setContent(partList); // 5. send Transport Transport.send(msg); // 6. delete saved file deleteFile(file); } /** * the string object map */ private AlertResult getStringObjectMap(String title, String content, AlertResult alertResult, HtmlEmail email) throws EmailException { /* * the subject of the message to be sent */ email.setSubject(title); /* * to send information, you can use HTML tags in mail content because of the use of HtmlEmail */ if (showType.equals(ShowType.TABLE.getDescp())) { email.setMsg(htmlTable(content)); } else if (showType.equals(ShowType.TEXT.getDescp())) { email.setMsg(htmlText(content)); } // send email.setDebug(true); Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); email.send(); alertResult.setStatus("true"); return alertResult; } /** * file delete * * @param file the file to delete */ public void deleteFile(File file) { if (file.exists()) { if (file.delete()) { logger.info("delete success: {}", file.getAbsolutePath() + file.getName()); } else { logger.info("delete fail: {}", file.getAbsolutePath() + file.getName()); } } else { logger.info("file not exists: {}", file.getAbsolutePath() + file.getName()); } } /** * handle exception */ private void handleException(AlertResult alertResult, Exception e) { logger.error("Send email to {} failed", receivers, e); alertResult.setMessage("Send email to {" + String.join(",", receivers) + "} failed," + e.toString()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,939
[Improvement][worker] Optimize KillYarnJob
When KillYarnJob, determine whether the target host is the local machine, if it is, rpc communication is not required org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor#killYarnJob
https://github.com/apache/dolphinscheduler/issues/4939
https://github.com/apache/dolphinscheduler/pull/4943
beb5adb9855521341e8b88a31440075b9708b852
ea6b1de120cd438b7611b966d396164dec421cbb
"2021-03-03T07:19:13Z"
java
"2021-03-11T14:13:44Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/LoggerUtils.java
/* * 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.dolphinscheduler.common.utils; import org.apache.dolphinscheduler.common.Constants; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.slf4j.Logger; /** * logger utils */ public class LoggerUtils { private LoggerUtils() { throw new UnsupportedOperationException("Construct LoggerUtils"); } /** * rules for extracting application ID */ private static final Pattern APPLICATION_REGEX = Pattern.compile(Constants.APPLICATION_REGEX); /** * Task Logger's prefix */ public static final String TASK_LOGGER_INFO_PREFIX = "TASK"; /** * Task Logger Thread's name */ public static final String TASK_LOGGER_THREAD_NAME = "TaskLogInfo"; /** * Task Logger Thread's name */ public static final String TASK_APPID_LOG_FORMAT = "[taskAppId="; /** * build job id * * @param affix Task Logger's prefix * @param processDefId process define id * @param processInstId process instance id * @param taskId task id * @return task id format */ public static String buildTaskId(String affix, int processDefId, int processInstId, int taskId) { // - [taskAppId=TASK_79_4084_15210] return String.format(" - %s%s-%s-%s-%s]", TASK_APPID_LOG_FORMAT, affix, processDefId, processInstId, taskId); } /** * processing log * get yarn application id list * * @param log log content * @param logger logger * @return app id list */ public static List<String> getAppIds(String log, Logger logger) { List<String> appIds = new ArrayList<>(); Matcher matcher = APPLICATION_REGEX.matcher(log); // analyse logs to get all submit yarn application id while (matcher.find()) { String appId = matcher.group(); if (!appIds.contains(appId)) { logger.info("find app id: {}", appId); appIds.add(appId); } } return appIds; } public static void logError(Optional<Logger> optionalLogger , String error) { optionalLogger.ifPresent((Logger logger) -> logger.error(error)); } public static void logError(Optional<Logger> optionalLogger , Throwable e) { optionalLogger.ifPresent((Logger logger) -> logger.error(e.getMessage(), e)); } public static void logError(Optional<Logger> optionalLogger , String error, Throwable e) { optionalLogger.ifPresent((Logger logger) -> logger.error(error, e)); } public static void logInfo(Optional<Logger> optionalLogger , String info) { optionalLogger.ifPresent((Logger logger) -> logger.info(info)); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,939
[Improvement][worker] Optimize KillYarnJob
When KillYarnJob, determine whether the target host is the local machine, if it is, rpc communication is not required org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor#killYarnJob
https://github.com/apache/dolphinscheduler/issues/4939
https://github.com/apache/dolphinscheduler/pull/4943
beb5adb9855521341e8b88a31440075b9708b852
ea6b1de120cd438b7611b966d396164dec421cbb
"2021-03-03T07:19:13Z"
java
"2021-03-11T14:13:44Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/LoggerUtilsTest.java
/* * 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.dolphinscheduler.common.utils; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; public class LoggerUtilsTest { private Logger logger = LoggerFactory.getLogger(LoggerUtilsTest.class); @Test public void buildTaskId() { String taskId = LoggerUtils.buildTaskId(LoggerUtils.TASK_LOGGER_INFO_PREFIX,79,4084,15210); Assert.assertEquals(" - [taskAppId=TASK-79-4084-15210]", taskId); } @Test public void getAppIds() { List<String> appIdList = LoggerUtils.getAppIds("Running job: application_1_1",logger); Assert.assertEquals("application_1_1", appIdList.get(0)); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,939
[Improvement][worker] Optimize KillYarnJob
When KillYarnJob, determine whether the target host is the local machine, if it is, rpc communication is not required org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor#killYarnJob
https://github.com/apache/dolphinscheduler/issues/4939
https://github.com/apache/dolphinscheduler/pull/4943
beb5adb9855521341e8b88a31440075b9708b852
ea6b1de120cd438b7611b966d396164dec421cbb
"2021-03-03T07:19:13Z"
java
"2021-03-11T14:13:44Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
/* * 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.dolphinscheduler.server.log; import org.apache.dolphinscheduler.common.utils.IOUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.remote.command.Command; import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.command.log.GetLogBytesRequestCommand; import org.apache.dolphinscheduler.remote.command.log.GetLogBytesResponseCommand; import org.apache.dolphinscheduler.remote.command.log.RemoveTaskLogRequestCommand; import org.apache.dolphinscheduler.remote.command.log.RemoveTaskLogResponseCommand; import org.apache.dolphinscheduler.remote.command.log.RollViewLogRequestCommand; import org.apache.dolphinscheduler.remote.command.log.RollViewLogResponseCommand; import org.apache.dolphinscheduler.remote.command.log.ViewLogRequestCommand; import org.apache.dolphinscheduler.remote.command.log.ViewLogResponseCommand; import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Collections; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.Stream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import io.netty.channel.Channel; /** * logger request process logic */ public class LoggerRequestProcessor implements NettyRequestProcessor { private final Logger logger = LoggerFactory.getLogger(LoggerRequestProcessor.class); private final ThreadPoolExecutor executor; public LoggerRequestProcessor() { this.executor = new ThreadPoolExecutor(4, 4, 10, TimeUnit.SECONDS, new LinkedBlockingQueue<>(100)); } @Override public void process(Channel channel, Command command) { logger.info("received command : {}", command); /** * reuqest task log command type */ final CommandType commandType = command.getType(); switch (commandType) { case GET_LOG_BYTES_REQUEST: GetLogBytesRequestCommand getLogRequest = JSONUtils.parseObject( command.getBody(), GetLogBytesRequestCommand.class); byte[] bytes = getFileContentBytes(getLogRequest.getPath()); GetLogBytesResponseCommand getLogResponse = new GetLogBytesResponseCommand(bytes); channel.writeAndFlush(getLogResponse.convert2Command(command.getOpaque())); break; case VIEW_WHOLE_LOG_REQUEST: ViewLogRequestCommand viewLogRequest = JSONUtils.parseObject( command.getBody(), ViewLogRequestCommand.class); String msg = readWholeFileContent(viewLogRequest.getPath()); ViewLogResponseCommand viewLogResponse = new ViewLogResponseCommand(msg); channel.writeAndFlush(viewLogResponse.convert2Command(command.getOpaque())); break; case ROLL_VIEW_LOG_REQUEST: RollViewLogRequestCommand rollViewLogRequest = JSONUtils.parseObject( command.getBody(), RollViewLogRequestCommand.class); List<String> lines = readPartFileContent(rollViewLogRequest.getPath(), rollViewLogRequest.getSkipLineNum(), rollViewLogRequest.getLimit()); StringBuilder builder = new StringBuilder(); for (String line : lines) { builder.append(line + "\r\n"); } RollViewLogResponseCommand rollViewLogRequestResponse = new RollViewLogResponseCommand(builder.toString()); channel.writeAndFlush(rollViewLogRequestResponse.convert2Command(command.getOpaque())); break; case REMOVE_TAK_LOG_REQUEST: RemoveTaskLogRequestCommand removeTaskLogRequest = JSONUtils.parseObject( command.getBody(), RemoveTaskLogRequestCommand.class); String taskLogPath = removeTaskLogRequest.getPath(); File taskLogFile = new File(taskLogPath); Boolean status = true; try { if (taskLogFile.exists()) { status = taskLogFile.delete(); } } catch (Exception e) { status = false; } RemoveTaskLogResponseCommand removeTaskLogResponse = new RemoveTaskLogResponseCommand(status); channel.writeAndFlush(removeTaskLogResponse.convert2Command(command.getOpaque())); break; default: throw new IllegalArgumentException("unknown commandType"); } } public ExecutorService getExecutor() { return this.executor; } /** * get files content bytes,for down load file * * @param filePath file path * @return byte array of file * @throws Exception exception */ private byte[] getFileContentBytes(String filePath) { InputStream in = null; ByteArrayOutputStream bos = null; try { in = new FileInputStream(filePath); bos = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) != -1) { bos.write(buf, 0, len); } return bos.toByteArray(); } catch (IOException e) { logger.error("get file bytes error",e); } finally { IOUtils.closeQuietly(bos); IOUtils.closeQuietly(in); } return new byte[0]; } /** * read part file content,can skip any line and read some lines * * @param filePath file path * @param skipLine skip line * @param limit read lines limit * @return part file content */ private List<String> readPartFileContent(String filePath, int skipLine, int limit) { File file = new File(filePath); if (file.exists() && file.isFile()) { try (Stream<String> stream = Files.lines(Paths.get(filePath))) { return stream.skip(skipLine).limit(limit).collect(Collectors.toList()); } catch (IOException e) { logger.error("read file error",e); } } else { logger.info("file path: {} not exists", filePath); } return Collections.emptyList(); } /** * read whole file content * * @param filePath file path * @return whole file content */ private String readWholeFileContent(String filePath) { BufferedReader br = null; String line; StringBuilder sb = new StringBuilder(); try { br = new BufferedReader(new InputStreamReader(new FileInputStream(filePath))); while ((line = br.readLine()) != null) { sb.append(line + "\r\n"); } return sb.toString(); } catch (IOException e) { logger.error("read file error",e); } finally { IOUtils.closeQuietly(br); } return ""; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,939
[Improvement][worker] Optimize KillYarnJob
When KillYarnJob, determine whether the target host is the local machine, if it is, rpc communication is not required org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor#killYarnJob
https://github.com/apache/dolphinscheduler/issues/4939
https://github.com/apache/dolphinscheduler/pull/4943
beb5adb9855521341e8b88a31440075b9708b852
ea6b1de120cd438b7611b966d396164dec421cbb
"2021-03-03T07:19:13Z"
java
"2021-03-11T14:13:44Z"
dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessorTest.java
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,939
[Improvement][worker] Optimize KillYarnJob
When KillYarnJob, determine whether the target host is the local machine, if it is, rpc communication is not required org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor#killYarnJob
https://github.com/apache/dolphinscheduler/issues/4939
https://github.com/apache/dolphinscheduler/pull/4943
beb5adb9855521341e8b88a31440075b9708b852
ea6b1de120cd438b7611b966d396164dec421cbb
"2021-03-03T07:19:13Z"
java
"2021-03-11T14:13:44Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/log/LogClientService.java
/* * 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.dolphinscheduler.service.log; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.remote.NettyRemotingClient; import org.apache.dolphinscheduler.remote.command.Command; import org.apache.dolphinscheduler.remote.command.log.GetLogBytesRequestCommand; import org.apache.dolphinscheduler.remote.command.log.GetLogBytesResponseCommand; import org.apache.dolphinscheduler.remote.command.log.RemoveTaskLogRequestCommand; import org.apache.dolphinscheduler.remote.command.log.RemoveTaskLogResponseCommand; import org.apache.dolphinscheduler.remote.command.log.RollViewLogRequestCommand; import org.apache.dolphinscheduler.remote.command.log.RollViewLogResponseCommand; import org.apache.dolphinscheduler.remote.command.log.ViewLogRequestCommand; import org.apache.dolphinscheduler.remote.command.log.ViewLogResponseCommand; import org.apache.dolphinscheduler.remote.config.NettyClientConfig; import org.apache.dolphinscheduler.remote.utils.Host; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * log client */ public class LogClientService { private static final Logger logger = LoggerFactory.getLogger(LogClientService.class); private final NettyClientConfig clientConfig; private final NettyRemotingClient client; private volatile boolean isRunning; /** * request time out */ private static final long LOG_REQUEST_TIMEOUT = 10 * 1000L; /** * construct client */ public LogClientService() { this.clientConfig = new NettyClientConfig(); this.clientConfig.setWorkerThreads(4); this.client = new NettyRemotingClient(clientConfig); this.isRunning = true; } /** * close */ public void close() { this.client.close(); this.isRunning = false; logger.info("logger client closed"); } /** * roll view log * * @param host host * @param port port * @param path path * @param skipLineNum skip line number * @param limit limit * @return log content */ public String rollViewLog(String host, int port, String path, int skipLineNum, int limit) { logger.info("roll view log, host : {}, port : {}, path {}, skipLineNum {} ,limit {}", host, port, path, skipLineNum, limit); RollViewLogRequestCommand request = new RollViewLogRequestCommand(path, skipLineNum, limit); String result = ""; final Host address = new Host(host, port); try { Command command = request.convert2Command(); Command response = this.client.sendSync(address, command, LOG_REQUEST_TIMEOUT); if (response != null) { RollViewLogResponseCommand rollReviewLog = JSONUtils.parseObject( response.getBody(), RollViewLogResponseCommand.class); return rollReviewLog.getMsg(); } } catch (Exception e) { logger.error("roll view log error", e); } finally { this.client.closeChannel(address); } return result; } /** * view log * * @param host host * @param port port * @param path path * @return log content */ public String viewLog(String host, int port, String path) { logger.info("view log path {}", path); ViewLogRequestCommand request = new ViewLogRequestCommand(path); String result = ""; final Host address = new Host(host, port); try { Command command = request.convert2Command(); Command response = this.client.sendSync(address, command, LOG_REQUEST_TIMEOUT); if (response != null) { ViewLogResponseCommand viewLog = JSONUtils.parseObject( response.getBody(), ViewLogResponseCommand.class); return viewLog.getMsg(); } } catch (Exception e) { logger.error("view log error", e); } finally { this.client.closeChannel(address); } return result; } /** * get log size * * @param host host * @param port port * @param path log path * @return log content bytes */ public byte[] getLogBytes(String host, int port, String path) { logger.info("log path {}", path); GetLogBytesRequestCommand request = new GetLogBytesRequestCommand(path); byte[] result = null; final Host address = new Host(host, port); try { Command command = request.convert2Command(); Command response = this.client.sendSync(address, command, LOG_REQUEST_TIMEOUT); if (response != null) { GetLogBytesResponseCommand getLog = JSONUtils.parseObject( response.getBody(), GetLogBytesResponseCommand.class); return getLog.getData(); } } catch (Exception e) { logger.error("get log size error", e); } finally { this.client.closeChannel(address); } return result; } /** * remove task log * * @param host host * @param port port * @param path path * @return remove task status */ public Boolean removeTaskLog(String host, int port, String path) { logger.info("log path {}", path); RemoveTaskLogRequestCommand request = new RemoveTaskLogRequestCommand(path); Boolean result = false; final Host address = new Host(host, port); try { Command command = request.convert2Command(); Command response = this.client.sendSync(address, command, LOG_REQUEST_TIMEOUT); if (response != null) { RemoveTaskLogResponseCommand taskLogResponse = JSONUtils.parseObject( response.getBody(), RemoveTaskLogResponseCommand.class); return taskLogResponse.getStatus(); } } catch (Exception e) { logger.error("remove task log error", e); } finally { this.client.closeChannel(address); } return result; } public boolean isRunning() { return isRunning; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,939
[Improvement][worker] Optimize KillYarnJob
When KillYarnJob, determine whether the target host is the local machine, if it is, rpc communication is not required org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor#killYarnJob
https://github.com/apache/dolphinscheduler/issues/4939
https://github.com/apache/dolphinscheduler/pull/4943
beb5adb9855521341e8b88a31440075b9708b852
ea6b1de120cd438b7611b966d396164dec421cbb
"2021-03-03T07:19:13Z"
java
"2021-03-11T14:13:44Z"
dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/log/LogClientServiceTest.java
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,939
[Improvement][worker] Optimize KillYarnJob
When KillYarnJob, determine whether the target host is the local machine, if it is, rpc communication is not required org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor#killYarnJob
https://github.com/apache/dolphinscheduler/issues/4939
https://github.com/apache/dolphinscheduler/pull/4943
beb5adb9855521341e8b88a31440075b9708b852
ea6b1de120cd438b7611b966d396164dec421cbb
"2021-03-03T07:19:13Z"
java
"2021-03-11T14:13:44Z"
pom.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ 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. --> <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"> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.dolphinscheduler</groupId> <artifactId>dolphinscheduler</artifactId> <version>${revision}</version> <packaging>pom</packaging> <name>${project.artifactId}</name> <url>http://dolphinscheduler.apache.org</url> <description>Dolphin Scheduler is a distributed and easy-to-expand visual DAG workflow scheduling system, dedicated to solving the complex dependencies in data processing, making the scheduling system out of the box for data processing. </description> <licenses> <license> <name>Apache License 2.0</name> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> <distribution>repo</distribution> </license> </licenses> <scm> <connection>scm:git:https://github.com/apache/incubator-dolphinscheduler.git</connection> <developerConnection>scm:git:https://github.com/apache/incubator-dolphinscheduler.git</developerConnection> <url>https://github.com/apache/incubator-dolphinscheduler</url> <tag>HEAD</tag> </scm> <mailingLists> <mailingList> <name>DolphinScheduler Developer List</name> <post>dev@dolphinscheduler.incubator.apache.org</post> <subscribe>dev-subscribe@dolphinscheduler.incubator.apache.org</subscribe> <unsubscribe>dev-unsubscribe@dolphinscheduler.incubator.apache.org</unsubscribe> </mailingList> </mailingLists> <parent> <groupId>org.apache</groupId> <artifactId>apache</artifactId> <version>21</version> </parent> <properties> <revision>1.3.6-SNAPSHOT</revision> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <curator.version>4.3.0</curator.version> <spring.version>5.1.18.RELEASE</spring.version> <spring.boot.version>2.1.17.RELEASE</spring.boot.version> <java.version>1.8</java.version> <logback.version>1.2.3</logback.version> <hadoop.version>2.7.3</hadoop.version> <quartz.version>2.3.0</quartz.version> <jackson.version>2.10.5</jackson.version> <mybatis-plus.version>3.2.0</mybatis-plus.version> <mybatis.spring.version>2.0.1</mybatis.spring.version> <cron.utils.version>5.0.5</cron.utils.version> <druid.version>1.1.22</druid.version> <h2.version>1.4.200</h2.version> <commons.codec.version>1.11</commons.codec.version> <commons.logging.version>1.1.1</commons.logging.version> <httpclient.version>4.4.1</httpclient.version> <httpcore.version>4.4.1</httpcore.version> <junit.version>4.12</junit.version> <mysql.connector.version>5.1.34</mysql.connector.version> <slf4j.api.version>1.7.5</slf4j.api.version> <slf4j.log4j12.version>1.7.5</slf4j.log4j12.version> <commons.collections.version>3.2.2</commons.collections.version> <commons.httpclient>3.0.1</commons.httpclient> <commons.beanutils.version>1.9.4</commons.beanutils.version> <commons.configuration.version>1.10</commons.configuration.version> <commons.email.version>1.5</commons.email.version> <poi.version>3.17</poi.version> <javax.servlet.api.version>3.1.0</javax.servlet.api.version> <commons.collections4.version>4.1</commons.collections4.version> <guava.version>24.1-jre</guava.version> <postgresql.version>42.1.4</postgresql.version> <hive.jdbc.version>2.1.0</hive.jdbc.version> <commons.io.version>2.4</commons.io.version> <oshi.core.version>3.5.0</oshi.core.version> <clickhouse.jdbc.version>0.1.52</clickhouse.jdbc.version> <mssql.jdbc.version>6.1.0.jre8</mssql.jdbc.version> <presto.jdbc.version>0.238.1</presto.jdbc.version> <spotbugs.version>3.1.12</spotbugs.version> <checkstyle.version>3.0.0</checkstyle.version> <zookeeper.version>3.4.14</zookeeper.version> <frontend-maven-plugin.version>1.6</frontend-maven-plugin.version> <maven-compiler-plugin.version>3.3</maven-compiler-plugin.version> <maven-assembly-plugin.version>3.1.0</maven-assembly-plugin.version> <maven-release-plugin.version>2.5.3</maven-release-plugin.version> <maven-javadoc-plugin.version>2.10.3</maven-javadoc-plugin.version> <maven-source-plugin.version>2.4</maven-source-plugin.version> <maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version> <maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version> <rpm-maven-plugion.version>2.2.0</rpm-maven-plugion.version> <jacoco.version>0.8.4</jacoco.version> <jcip.version>1.0</jcip.version> <maven.deploy.skip>false</maven.deploy.skip> <cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version> <mockito.version>2.21.0</mockito.version> <powermock.version>2.0.2</powermock.version> <servlet-api.version>2.5</servlet-api.version> <swagger.version>1.9.3</swagger.version> <springfox.version>2.9.2</springfox.version> <swagger-models.version>1.5.24</swagger-models.version> <guava-retry.version>2.0.0</guava-retry.version> <dep.airlift.version>0.184</dep.airlift.version> <dep.packaging.version>${dep.airlift.version}</dep.packaging.version> <protostuff.version>1.7.2</protostuff.version> <reflections.version>0.9.12</reflections.version> <byte-buddy.version>1.9.16</byte-buddy.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>${mybatis-plus.version}</version> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus</artifactId> <version>${mybatis-plus.version}</version> </dependency> <!-- quartz--> <dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</artifactId> <version>${quartz.version}</version> </dependency> <dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz-jobs</artifactId> <version>${quartz.version}</version> </dependency> <dependency> <groupId>com.cronutils</groupId> <artifactId>cron-utils</artifactId> <version>${cron.utils.version}</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>${druid.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>${spring.boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.dolphinscheduler</groupId> <artifactId>dolphinscheduler-server</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.dolphinscheduler</groupId> <artifactId>dolphinscheduler-common</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.dolphinscheduler</groupId> <artifactId>dolphinscheduler-alert-plugin</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.dolphinscheduler</groupId> <artifactId>dolphinscheduler-dao</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.dolphinscheduler</groupId> <artifactId>dolphinscheduler-api</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.dolphinscheduler</groupId> <artifactId>dolphinscheduler-remote</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.dolphinscheduler</groupId> <artifactId>dolphinscheduler-service</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.dolphinscheduler</groupId> <artifactId>dolphinscheduler-alert</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.dolphinscheduler</groupId> <artifactId>dolphinscheduler-spi</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-framework</artifactId> <version>${curator.version}</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-recipes</artifactId> <version>${curator.version}</version> <exclusions> <exclusion> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </exclusion> <exclusion> <artifactId>netty</artifactId> <groupId>io.netty</groupId> </exclusion> <exclusion> <groupId>com.github.spotbugs</groupId> <artifactId>spotbugs-annotations</artifactId> </exclusion> </exclusions> <version>${zookeeper.version}</version> </dependency> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>${commons.codec.version}</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>${commons.logging.version}</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>${httpclient.version}</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> <version>${httpcore.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>${jackson.version}</version> </dependency> <!--protostuff--> <!-- https://mvnrepository.com/artifact/io.protostuff/protostuff-core --> <dependency> <groupId>io.protostuff</groupId> <artifactId>protostuff-core</artifactId> <version>${protostuff.version}</version> </dependency> <!-- https://mvnrepository.com/artifact/io.protostuff/protostuff-runtime --> <dependency> <groupId>io.protostuff</groupId> <artifactId>protostuff-runtime</artifactId> <version>${protostuff.version}</version> </dependency> <dependency> <groupId>net.bytebuddy</groupId> <artifactId>byte-buddy</artifactId> <version>${byte-buddy.version}</version> </dependency> <dependency> <groupId>org.reflections</groupId> <artifactId>reflections</artifactId> <version>${reflections.version}</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>${mockito.version}</version> <type>jar</type> <scope>test</scope> </dependency> <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-module-junit4</artifactId> <version>${powermock.version}</version> <type>jar</type> <scope>test</scope> </dependency> <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-api-mockito2</artifactId> <version>${powermock.version}</version> <type>jar</type> <scope>test</scope> <exclusions> <exclusion> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql.connector.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <version>${h2.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>${slf4j.api.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>${slf4j.log4j12.version}</version> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>${commons.collections.version}</version> </dependency> <dependency> <groupId>commons-httpclient</groupId> <artifactId>commons-httpclient</artifactId> <version>${commons.httpclient}</version> </dependency> <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> <version>${commons.beanutils.version}</version> </dependency> <dependency> <groupId>commons-configuration</groupId> <artifactId>commons-configuration</artifactId> <version>${commons.configuration.version}</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>${logback.version}</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>${logback.version}</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-email</artifactId> <version>${commons.email.version}</version> </dependency> <!--excel poi--> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>${poi.version}</version> </dependency> <!-- hadoop --> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> <version>${hadoop.version}</version> <exclusions> <exclusion> <artifactId>slf4j-log4j12</artifactId> <groupId>org.slf4j</groupId> </exclusion> <exclusion> <artifactId>com.sun.jersey</artifactId> <groupId>jersey-json</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-client</artifactId> <version>${hadoop.version}</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-hdfs</artifactId> <version>${hadoop.version}</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-yarn-common</artifactId> <version>${hadoop.version}</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-aws</artifactId> <version>${hadoop.version}</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-collections4</artifactId> <version>${commons.collections4.version}</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>${guava.version}</version> </dependency> <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <version>${postgresql.version}</version> </dependency> <dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-jdbc</artifactId> <version>${hive.jdbc.version}</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>${commons.io.version}</version> </dependency> <dependency> <groupId>com.github.oshi</groupId> <artifactId>oshi-core</artifactId> <version>${oshi.core.version}</version> </dependency> <dependency> <groupId>ru.yandex.clickhouse</groupId> <artifactId>clickhouse-jdbc</artifactId> <version>${clickhouse.jdbc.version}</version> </dependency> <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>mssql-jdbc</artifactId> <version>${mssql.jdbc.version}</version> </dependency> <dependency> <groupId>com.facebook.presto</groupId> <artifactId>presto-jdbc</artifactId> <version>${presto.jdbc.version}</version> </dependency> <dependency> <groupId>net.jcip</groupId> <artifactId>jcip-annotations</artifactId> <version>${jcip.version}</version> <optional>true</optional> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>${servlet-api.version}</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>${javax.servlet.api.version}</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>${springfox.version}</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>${springfox.version}</version> </dependency> <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-models</artifactId> <version>${swagger-models.version}</version> </dependency> <dependency> <groupId>com.github.xiaoymin</groupId> <artifactId>swagger-bootstrap-ui</artifactId> <version>${swagger.version}</version> </dependency> <dependency> <groupId>com.github.rholder</groupId> <artifactId>guava-retrying</artifactId> <version>${guava-retry.version}</version> </dependency> <dependency> <groupId>org.sonatype.aether</groupId> <artifactId>aether-api</artifactId> <version>1.13.1</version> </dependency> <dependency> <groupId>io.airlift.resolver</groupId> <artifactId>resolver</artifactId> <version>1.5</version> </dependency> <dependency> <groupId>org.ow2.asm</groupId> <artifactId>asm</artifactId> <version>6.2.1</version> </dependency> <dependency> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> <version>1.1</version> </dependency> <dependency> <groupId>com.sun.mail</groupId> <artifactId>javax.mail</artifactId> <version>1.6.2</version> </dependency> </dependencies> </dependencyManagement> <build> <finalName>apache-dolphinscheduler-incubating-${project.version}</finalName> <pluginManagement> <plugins> <plugin> <groupId>org.apache.dolphinscheduler</groupId> <artifactId>dolphinscheduler-maven-plugin</artifactId> <version>1.0.0</version> <extensions>true</extensions> </plugin> <plugin> <groupId>ca.vanzyl.maven.plugins</groupId> <artifactId>provisio-maven-plugin</artifactId> <version>1.0.4</version> <extensions>true</extensions> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>rpm-maven-plugin</artifactId> <version>${rpm-maven-plugion.version}</version> <inherited>false</inherited> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>${java.version}</source> <target>${java.version}</target> <testSource>${java.version}</testSource> <testTarget>${java.version}</testTarget> </configuration> <version>${maven-compiler-plugin.version}</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <version>${maven-release-plugin.version}</version> <configuration> <tagNameFormat>@{project.version}</tagNameFormat> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>${maven-assembly-plugin.version}</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>${maven-javadoc-plugin.version}</version> <configuration> <source>8</source> <failOnError>false</failOnError> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>${maven-source-plugin.version}</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>${maven-dependency-plugin.version}</version> </plugin> </plugins> </pluginManagement> <plugins> <plugin> <groupId>org.apache.dolphinscheduler</groupId> <artifactId>dolphinscheduler-maven-plugin</artifactId> <extensions>true</extensions> <!--<configuration>--> <!--<allowedProvidedDependencies>--> <!--<allowedProvidedDependency>org.apache.dolphinscheduler:dolphinscheduler-common</allowedProvidedDependency>--> <!--</allowedProvidedDependencies>--> <!--</configuration>--> </plugin> <plugin> <groupId>ca.vanzyl.maven.plugins</groupId> <artifactId>provisio-maven-plugin</artifactId> <extensions>true</extensions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <executions> <execution> <id>attach-sources</id> <phase>verify</phase> <goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>${maven-javadoc-plugin.version}</version> <executions> <execution> <id>attach-javadocs</id> <goals> <goal>jar</goal> </goals> </execution> </executions> <configuration> <aggregate>true</aggregate> <charset>${project.build.sourceEncoding}</charset> <encoding>${project.build.sourceEncoding}</encoding> <docencoding>${project.build.sourceEncoding}</docencoding> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <version>${maven-release-plugin.version}</version> <configuration> <autoVersionSubmodules>true</autoVersionSubmodules> <tagNameFormat>@{project.version}</tagNameFormat> <tagBase>${project.version}</tagBase> <!--<goals>-f pom.xml deploy</goals>--> </configuration> <dependencies> <dependency> <groupId>org.apache.maven.scm</groupId> <artifactId>maven-scm-provider-jgit</artifactId> <version>1.9.5</version> </dependency> </dependencies> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>${maven-compiler-plugin.version}</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> <encoding>${project.build.sourceEncoding}</encoding> <skip>false</skip><!--not skip compile test classes--> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>${maven-surefire-plugin.version}</version> <configuration> <includes> <include>**/api/controller/ProcessDefinitionControllerTest.java</include> <include>**/api/controller/TenantControllerTest.java</include> <include>**/api/dto/resources/filter/ResourceFilterTest.java</include> <include>**/api/dto/resources/visitor/ResourceTreeVisitorTest.java</include> <includeDataxTaskTest>**/api/enums/testGetEnum.java</includeDataxTaskTest> <include>**/api/enums/StatusTest.java</include> <include>**/api/exceptions/ApiExceptionHandlerTest.java</include> <include>**/api/exceptions/ServiceExceptionTest.java</include> <include>**/api/interceptor/LocaleChangeInterceptorTest.java</include> <include>**/api/interceptor/LoginHandlerInterceptorTest.java</include> <include>**/api/security/impl/pwd/PasswordAuthenticatorTest.java</include> <include>**/api/security/impl/ldap/LdapAuthenticatorTest.java</include> <include>**/api/security/SecurityConfigLDAPTest.java</include> <include>**/api/security/SecurityConfigPasswordTest.java</include> <include>**/api/service/AccessTokenServiceTest.java</include> <include>**/api/service/AlertGroupServiceTest.java</include> <include>**/api/service/BaseDAGServiceTest.java</include> <include>**/api/service/BaseServiceTest.java</include> <include>**/api/service/DataAnalysisServiceTest.java</include> <include>**/api/service/AlertPluginInstanceServiceTest.java</include> <include>**/api/service/DataSourceServiceTest.java</include> <include>**/api/service/ExecutorService2Test.java</include> <include>**/api/service/ExecutorServiceTest.java</include> <include>**/api/service/LoggerServiceTest.java</include> <include>**/api/service/MonitorServiceTest.java</include> <include>**/api/service/ProcessDefinitionServiceTest.java</include> <include>**/api/service/ProcessDefinitionVersionServiceTest.java</include> <include>**/api/service/ProcessInstanceServiceTest.java</include> <include>**/api/service/ProjectServiceTest.java</include> <include>**/api/service/QueueServiceTest.java</include> <include>**/api/service/ResourcesServiceTest.java</include> <include>**/api/service/SchedulerServiceTest.java</include> <include>**/api/service/SessionServiceTest.java</include> <include>**/api/service/TaskInstanceServiceTest.java</include> <include>**/api/service/TenantServiceTest.java</include> <include>**/api/service/UdfFuncServiceTest.java</include> <include>**/api/service/UiPluginServiceTest.java</include> <include>**/api/service/UserAlertGroupServiceTest.java</include> <include>**/api/service/UsersServiceTest.java</include> <include>**/api/service/WorkerGroupServiceTest.java</include> <include>**/api/service/WorkFlowLineageServiceTest.java</include> <include>**/api/controller/ProcessDefinitionControllerTest.java</include> <include>**/api/controller/TaskInstanceControllerTest.java</include> <include>**/api/controller/WorkFlowLineageControllerTest.java</include> <include>**/api/utils/exportprocess/DataSourceParamTest.java</include> <include>**/api/utils/exportprocess/DependentParamTest.java</include> <include>**/api/utils/CheckUtilsTest.java</include> <include>**/api/utils/FileUtilsTest.java</include> <include>**/api/utils/CheckUtilsTest.java</include> <include>**/api/utils/CheckUtilsTest.java</include> <include>**/api/utils/ResultTest.java</include> <include>**/common/graph/DAGTest.java</include> <include>**/common/os/OshiTest.java</include> <include>**/common/os/OSUtilsTest.java</include> <include>**/common/shell/ShellExecutorTest.java</include> <include>**/common/task/DataxParametersTest.java</include> <include>**/common/task/EntityTestUtils.java</include> <include>**/common/task/FlinkParametersTest.java</include> <include>**/common/task/HttpParametersTest.java</include> <include>**/common/task/SqoopParameterEntityTest.java</include> <include>**/common/threadutils/ThreadPoolExecutorsTest.java</include> <include>**/common/threadutils/ThreadUtilsTest.java</include> <include>**/common/utils/CollectionUtilsTest.java</include> <include>**/common/utils/CommonUtilsTest.java</include> <include>**/common/utils/DateUtilsTest.java</include> <include>**/common/utils/DependentUtilsTest.java</include> <include>**/common/utils/EncryptionUtilsTest.java</include> <include>**/common/utils/FileUtilsTest.java</include> <include>**/common/utils/IpUtilsTest.java</include> <include>**/common/utils/JSONUtilsTest.java</include> <include>**/common/utils/LoggerUtilsTest.java</include> <include>**/common/utils/NetUtilsTest.java</include> <include>**/common/utils/OSUtilsTest.java</include> <include>**/common/utils/ParameterUtilsTest.java</include> <include>**/common/utils/TimePlaceholderUtilsTest.java</include> <include>**/common/utils/PreconditionsTest.java</include> <include>**/common/utils/PropertyUtilsTest.java</include> <include>**/common/utils/SchemaUtilsTest.java</include> <include>**/common/utils/ScriptRunnerTest.java</include> <include>**/common/utils/SensitiveLogUtilsTest.java</include> <include>**/common/utils/StringTest.java</include> <include>**/common/utils/StringUtilsTest.java</include> <include>**/common/utils/TaskParametersUtilsTest.java</include> <include>**/common/utils/VarPoolUtilsTest.java</include> <include>**/common/utils/HadoopUtilsTest.java</include> <include>**/common/utils/HttpUtilsTest.java</include> <include>**/common/utils/KerberosHttpClientTest.java</include> <include>**/common/utils/HiveConfUtilsTest.java</include> <include>**/common/ConstantsTest.java</include> <include>**/common/utils/HadoopUtils.java</include> <include>**/common/utils/RetryerUtilsTest.java</include> <include>**/common/plugin/DolphinSchedulerPluginLoaderTest.java</include> <include>**/common/enums/ExecutionStatusTest</include> <include>**/dao/mapper/AccessTokenMapperTest.java</include> <include>**/dao/mapper/AlertGroupMapperTest.java</include> <include>**/dao/mapper/CommandMapperTest.java</include> <include>**/dao/mapper/ConnectionFactoryTest.java</include> <include>**/dao/mapper/DataSourceMapperTest.java</include> <include>**/dao/entity/TaskInstanceTest.java</include> <include>**/dao/entity/UdfFuncTest.java</include> <include>**/remote/JsonSerializerTest.java</include> <include>**/remote/RemoveTaskLogResponseCommandTest.java</include> <include>**/rpc/RpcTest.java</include> <include>**/remote/RemoveTaskLogRequestCommandTest.java</include> <include>**/remote/NettyRemotingClientTest.java</include> <include>**/remote/NettyUtilTest.java</include> <include>**/remote/ResponseFutureTest.java</include> <include>**/remote/command/alert/AlertSendRequestCommandTest.java</include> <include>**/remote/command/alert/AlertSendResponseCommandTest.java</include> <include>**/server/log/LoggerServerTest.java</include> <include>**/server/entity/SQLTaskExecutionContextTest.java</include> <include>**/server/log/MasterLogFilterTest.java</include> <include>**/server/log/SensitiveDataConverterTest.java</include> <!--<include>**/server/log/TaskLogDiscriminatorTest.java</include>--> <include>**/server/log/TaskLogFilterTest.java</include> <include>**/server/log/WorkerLogFilterTest.java</include> <include>**/server/master/consumer/TaskPriorityQueueConsumerTest.java</include> <include>**/server/master/runner/MasterTaskExecThreadTest.java</include> <!--<include>**/server/master/dispatch/executor/NettyExecutorManagerTest.java</include>--> <include>**/server/master/dispatch/host/assign/LowerWeightRoundRobinTest.java</include> <include>**/server/master/dispatch/host/assign/RandomSelectorTest.java</include> <include>**/server/master/dispatch/host/assign/RoundRobinSelectorTest.java</include> <include>**/server/master/register/MasterRegistryTest.java</include> <include>**/server/master/dispatch/host/assign/RoundRobinHostManagerTest.java</include> <include>**/server/master/AlertManagerTest.java</include> <include>**/server/master/MasterCommandTest.java</include> <include>**/server/master/DependentTaskTest.java</include> <include>**/server/master/ConditionsTaskTest.java</include> <include>**/server/master/MasterExecThreadTest.java</include> <include>**/server/master/ParamsTest.java</include> <include>**/server/master/SubProcessTaskTest.java</include> <include>**/server/master/processor/TaskAckProcessorTest.java</include> <include>**/server/master/processor/TaskKillResponseProcessorTest.java</include> <include>**/server/master/processor/queue/TaskResponseServiceTest.java</include> <include>**/server/register/ZookeeperNodeManagerTest.java</include> <include>**/server/register/ZookeeperRegistryCenterTest.java</include> <include>**/server/utils/DataxUtilsTest.java</include> <include>**/server/utils/ExecutionContextTestUtils.java</include> <include>**/server/utils/HostTest.java</include> <include>**/server/utils/FlinkArgsUtilsTest.java</include> <include>**/server/utils/LogUtilsTest.java</include> <include>**/server/utils/MapReduceArgsUtilsTest.java</include> <include>**/server/utils/ParamUtilsTest.java</include> <include>**/server/utils/ProcessUtilsTest.java</include> <include>**/server/utils/SparkArgsUtilsTest.java</include> <include>**/server/worker/processor/TaskCallbackServiceTest.java</include> <include>**/server/worker/processor/TaskExecuteProcessorTest.java</include> <include>**/server/worker/registry/WorkerRegistryTest.java</include> <include>**/server/worker/shell/ShellCommandExecutorTest.java</include> <include>**/server/worker/sql/SqlExecutorTest.java</include> <include>**/server/worker/task/spark/SparkTaskTest.java</include> <include>**/server/worker/task/EnvFileTest.java</include> <include>**/server/worker/task/spark/SparkTaskTest.java</include> <!--<include>**/server/worker/task/datax/DataxTaskTest.java</include>--> <!--<include>**/server/worker/task/http/HttpTaskTest.java</include>--> <include>**/server/worker/task/sqoop/SqoopTaskTest.java</include> <include>**/server/worker/task/shell/ShellTaskTest.java</include> <include>**/server/worker/task/TaskManagerTest.java</include> <include>**/server/worker/task/AbstractCommandExecutorTest.java</include> <include>**/server/worker/task/ShellTaskReturnTest.java</include> <include>**/server/worker/EnvFileTest.java</include> <include>**/server/worker/runner/TaskExecuteThreadTest.java</include> <include>**/server/worker/runner/WorkerManagerThreadTest.java</include> <include>**/service/quartz/cron/CronUtilsTest.java</include> <include>**/service/process/ProcessServiceTest.java</include> <include>**/service/zk/DefaultEnsembleProviderTest.java</include> <include>**/service/zk/ZKServerTest.java</include> <include>**/service/zk/CuratorZookeeperClientTest.java</include> <include>**/service/zk/RegisterOperatorTest.java</include> <include>**/service/queue/TaskUpdateQueueTest.java</include> <include>**/service/queue/PeerTaskInstancePriorityQueueTest.java</include> <include>**/service/alert/AlertClientServiceTest.java</include> <include>**/dao/mapper/DataSourceUserMapperTest.java</include> <!--<iTaskUpdateQueueConsumerThreadnclude>**/dao/mapper/ErrorCommandMapperTest.java</iTaskUpdateQueueConsumerThreadnclude>--> <include>**/dao/mapper/ProcessDefinitionMapperTest.java</include> <include>**/dao/mapper/ProcessDefinitionVersionMapperTest.java</include> <include>**/dao/mapper/ProcessInstanceMapMapperTest.java</include> <include>**/dao/mapper/ProcessInstanceMapperTest.java</include> <include>**/dao/mapper/ProjectMapperTest.java</include> <include>**/dao/mapper/ProjectUserMapperTest.java</include> <include>**/dao/mapper/QueueMapperTest.java</include> <include>**/dao/mapper/ResourceUserMapperTest.java</include> <include>**/dao/mapper/ScheduleMapperTest.java</include> <include>**/dao/mapper/SessionMapperTest.java</include> <include>**/dao/mapper/TaskInstanceMapperTest.java</include> <include>**/dao/mapper/TenantMapperTest.java</include> <include>**/dao/mapper/UdfFuncMapperTest.java</include> <include>**/dao/mapper/UDFUserMapperTest.java</include> <include>**/dao/mapper/UserMapperTest.java</include> <include>**/dao/mapper/AlertPluginInstanceMapperTest.java</include> <include>**/dao/mapper/PluginDefineTest.java</include> <include>**/dao/utils/DagHelperTest.java</include> <include>**/dao/AlertDaoTest.java</include> <include>**/dao/datasource/OracleDataSourceTest.java</include> <include>**/dao/datasource/HiveDataSourceTest.java</include> <include>**/dao/datasource/BaseDataSourceTest.java</include> <include>**/dao/upgrade/ProcessDefinitionDaoTest.java</include> <include>**/dao/upgrade/WokrerGrouopDaoTest.java</include> <include>**/dao/upgrade/UpgradeDaoTest.java</include> <include>**/plugin/alert/email/EmailAlertChannelFactoryTest.java</include> <include>**/plugin/alert/email/EmailAlertChannelTest.java</include> <include>**/plugin/alert/email/ExcelUtilsTest.java</include> <include>**/plugin/alert/email/MailUtilsTest.java</include> <include>**/plugin/alert/email/template/DefaultHTMLTemplateTest.java</include> <include>**/plugin/alert/dingtalk/DingTalkSenderTest.java</include> <include>**/plugin/alert/dingtalk/DingTalkAlertChannelFactoryTest.java</include> <include>**/plugin/alert/wechat/WeChatSenderTest.java</include> <include>**/plugin/alert/wechat/WeChatAlertChannelFactoryTest.java</include> <include>**/plugin/alert/script/ProcessUtilsTest.java</include> <include>**/plugin/alert/script/ScriptAlertChannelFactoryTest.java</include> <include>**/plugin/alert/script/ScriptSenderTest.java</include> <include>**/plugin/alert/http/HttpAlertChannelFactoryTest.java</include> <include>**/plugin/alert/http/HttpAlertChannelTest.java</include> <include>**/plugin/alert/feishu/FeiShuAlertChannelFactoryTest.java</include> <include>**/plugin/alert/feishu/FeiShuSenderTest.java</include> <include>**/plugin/alert/http/HttpAlertPluginTest.java</include> <include>**/plugin/alert/http/HttpSenderTest.java</include> <include>**/spi/params/PluginParamsTransferTest.java</include> <include>**/alert/plugin/EmailAlertPluginTest.java</include> <include>**/alert/plugin/AlertPluginManagerTest.java</include> <include>**/alert/plugin/DolphinPluginLoaderTest.java</include> <include>**/alert/utils/DingTalkUtilsTest.java</include> <include>**/alert/utils/EnterpriseWeChatUtilsTest.java</include> <include>**/alert/utils/FuncUtilsTest.java</include> <include>**/alert/processor/AlertRequestProcessorTest.java</include> <include>**/alert/runner/AlertSenderTest.java</include> <include>**/alert/AlertServerTest.java</include> </includes> <!-- <skip>true</skip> --> </configuration> </plugin> <!-- jenkins plugin jacoco report--> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>${jacoco.version}</version> <configuration> <destFile>target/jacoco.exec</destFile> <dataFile>target/jacoco.exec</dataFile> </configuration> <executions> <execution> <id>jacoco-initialize</id> <goals> <goal>prepare-agent</goal> </goals> </execution> <execution> <id>jacoco-site</id> <phase>test</phase> <goals> <goal>report</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>com.github.spotbugs</groupId> <artifactId>spotbugs-maven-plugin</artifactId> <version>${spotbugs.version}</version> <configuration> <xmlOutput>true</xmlOutput> <threshold>medium</threshold> <effort>default</effort> <excludeFilterFile>dev-config/spotbugs-exclude.xml</excludeFilterFile> <failOnError>true</failOnError> </configuration> <dependencies> <dependency> <groupId>com.github.spotbugs</groupId> <artifactId>spotbugs</artifactId> <version>4.0.0-beta4</version> </dependency> </dependencies> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>${checkstyle.version}</version> <dependencies> <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> <version>8.18</version> </dependency> </dependencies> <configuration> <consoleOutput>true</consoleOutput> <encoding>UTF-8</encoding> <configLocation>style/checkstyle.xml</configLocation> <suppressionsLocation>style/checkstyle-suppressions.xml</suppressionsLocation> <suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression> <failOnViolation>true</failOnViolation> <violationSeverity>warning</violationSeverity> <includeTestSourceDirectory>true</includeTestSourceDirectory> <sourceDirectories> <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory> </sourceDirectories> <excludes>**\/generated-sources\/</excludes> <skip>true</skip> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>check</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>${cobertura-maven-plugin.version}</version> <configuration> <check> </check> <aggregate>true</aggregate> <outputDirectory>./target/cobertura</outputDirectory> <encoding>${project.build.sourceEncoding}</encoding> <quiet>true</quiet> <format>xml</format> <instrumentation> <ignoreTrivial>true</ignoreTrivial> </instrumentation> </configuration> </plugin> </plugins> </build> <modules> <module>dolphinscheduler-alert-plugin</module> <module>dolphinscheduler-ui</module> <module>dolphinscheduler-server</module> <module>dolphinscheduler-common</module> <module>dolphinscheduler-api</module> <module>dolphinscheduler-dao</module> <module>dolphinscheduler-alert</module> <module>dolphinscheduler-dist</module> <module>dolphinscheduler-remote</module> <module>dolphinscheduler-service</module> <module>dolphinscheduler-spi</module> <module>dolphinscheduler-microbench</module> </modules> </project>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,884
[Improvement][Common] a concatenation URL problem occurred when the address of the ACITVE ResourceManager in YARN HA mode failed to be obtained
**Describe the question** Acitve ReSourceManager IP = null when obtaining Acitve ReSourceManager address in YARN HA mode fails, the program will return splicing application url = http://null:8088/ws/v1/cluster/apps/%s **What are the current deficiencies and the benefits of improvement** The yarn application URL generation failed exception should be thrown here **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4884
https://github.com/apache/dolphinscheduler/pull/4885
ea6b1de120cd438b7611b966d396164dec421cbb
c8e31ad58e15936174e773172d12337a8cf26d69
"2021-02-26T04:31:57Z"
java
"2021-03-11T14:14:52Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/exception/BaseException.java
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,884
[Improvement][Common] a concatenation URL problem occurred when the address of the ACITVE ResourceManager in YARN HA mode failed to be obtained
**Describe the question** Acitve ReSourceManager IP = null when obtaining Acitve ReSourceManager address in YARN HA mode fails, the program will return splicing application url = http://null:8088/ws/v1/cluster/apps/%s **What are the current deficiencies and the benefits of improvement** The yarn application URL generation failed exception should be thrown here **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4884
https://github.com/apache/dolphinscheduler/pull/4885
ea6b1de120cd438b7611b966d396164dec421cbb
c8e31ad58e15936174e773172d12337a8cf26d69
"2021-02-26T04:31:57Z"
java
"2021-03-11T14:14:52Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
/* * 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.dolphinscheduler.common.utils; import static org.apache.dolphinscheduler.common.Constants.RESOURCE_UPLOAD_PATH; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.ResUploadType; import org.apache.dolphinscheduler.common.enums.ResourceType; import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileUtil; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.HdfsConfiguration; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.yarn.client.cli.RMAdminCLI; import java.io.BufferedReader; import java.io.Closeable; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.security.PrivilegedExceptionAction; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.Stream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; /** * hadoop utils * single instance */ public class HadoopUtils implements Closeable { private static final Logger logger = LoggerFactory.getLogger(HadoopUtils.class); private static String hdfsUser = PropertyUtils.getString(Constants.HDFS_ROOT_USER); public static final String resourceUploadPath = PropertyUtils.getString(RESOURCE_UPLOAD_PATH, "/dolphinscheduler"); public static final String rmHaIds = PropertyUtils.getString(Constants.YARN_RESOURCEMANAGER_HA_RM_IDS); public static final String appAddress = PropertyUtils.getString(Constants.YARN_APPLICATION_STATUS_ADDRESS); public static final String jobHistoryAddress = PropertyUtils.getString(Constants.YARN_JOB_HISTORY_STATUS_ADDRESS); private static final String HADOOP_UTILS_KEY = "HADOOP_UTILS_KEY"; private static final LoadingCache<String, HadoopUtils> cache = CacheBuilder .newBuilder() .expireAfterWrite(PropertyUtils.getInt(Constants.KERBEROS_EXPIRE_TIME, 2), TimeUnit.HOURS) .build(new CacheLoader<String, HadoopUtils>() { @Override public HadoopUtils load(String key) throws Exception { return new HadoopUtils(); } }); private static volatile boolean yarnEnabled = false; private Configuration configuration; private FileSystem fs; private HadoopUtils() { init(); initHdfsPath(); } public static HadoopUtils getInstance() { return cache.getUnchecked(HADOOP_UTILS_KEY); } /** * init dolphinscheduler root path in hdfs */ private void initHdfsPath() { Path path = new Path(resourceUploadPath); try { if (!fs.exists(path)) { fs.mkdirs(path); } } catch (Exception e) { logger.error(e.getMessage(), e); } } /** * init hadoop configuration */ private void init() { try { configuration = new HdfsConfiguration(); String resourceStorageType = PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE); ResUploadType resUploadType = ResUploadType.valueOf(resourceStorageType); if (resUploadType == ResUploadType.HDFS) { if (PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false)) { System.setProperty(Constants.JAVA_SECURITY_KRB5_CONF, PropertyUtils.getString(Constants.JAVA_SECURITY_KRB5_CONF_PATH)); configuration.set(Constants.HADOOP_SECURITY_AUTHENTICATION, "kerberos"); hdfsUser = ""; UserGroupInformation.setConfiguration(configuration); UserGroupInformation.loginUserFromKeytab(PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_USERNAME), PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_PATH)); } String defaultFS = configuration.get(Constants.FS_DEFAULTFS); //first get key from core-site.xml hdfs-site.xml ,if null ,then try to get from properties file // the default is the local file system if (defaultFS.startsWith("file")) { String defaultFSProp = PropertyUtils.getString(Constants.FS_DEFAULTFS); if (StringUtils.isNotBlank(defaultFSProp)) { Map<String, String> fsRelatedProps = PropertyUtils.getPrefixedProperties("fs."); configuration.set(Constants.FS_DEFAULTFS, defaultFSProp); fsRelatedProps.forEach((key, value) -> configuration.set(key, value)); } else { logger.error("property:{} can not to be empty, please set!", Constants.FS_DEFAULTFS); throw new RuntimeException( String.format("property: %s can not to be empty, please set!", Constants.FS_DEFAULTFS) ); } } else { logger.info("get property:{} -> {}, from core-site.xml hdfs-site.xml ", Constants.FS_DEFAULTFS, defaultFS); } if (fs == null) { if (StringUtils.isNotEmpty(hdfsUser)) { UserGroupInformation ugi = UserGroupInformation.createRemoteUser(hdfsUser); ugi.doAs(new PrivilegedExceptionAction<Boolean>() { @Override public Boolean run() throws Exception { fs = FileSystem.get(configuration); return true; } }); } else { logger.warn("hdfs.root.user is not set value!"); fs = FileSystem.get(configuration); } } } else if (resUploadType == ResUploadType.S3) { System.setProperty(Constants.AWS_S3_V4, Constants.STRING_TRUE); configuration.set(Constants.FS_DEFAULTFS, PropertyUtils.getString(Constants.FS_DEFAULTFS)); configuration.set(Constants.FS_S3A_ENDPOINT, PropertyUtils.getString(Constants.FS_S3A_ENDPOINT)); configuration.set(Constants.FS_S3A_ACCESS_KEY, PropertyUtils.getString(Constants.FS_S3A_ACCESS_KEY)); configuration.set(Constants.FS_S3A_SECRET_KEY, PropertyUtils.getString(Constants.FS_S3A_SECRET_KEY)); fs = FileSystem.get(configuration); } } catch (Exception e) { logger.error(e.getMessage(), e); } } /** * @return Configuration */ public Configuration getConfiguration() { return configuration; } /** * get application url * * @param applicationId application id * @return url of application */ public String getApplicationUrl(String applicationId) throws Exception { /** * if rmHaIds contains xx, it signs not use resourcemanager * otherwise: * if rmHaIds is empty, single resourcemanager enabled * if rmHaIds not empty: resourcemanager HA enabled */ String appUrl = ""; if (StringUtils.isEmpty(rmHaIds)) { //single resourcemanager enabled appUrl = appAddress; yarnEnabled = true; } else { //resourcemanager HA enabled appUrl = getAppAddress(appAddress, rmHaIds); yarnEnabled = true; logger.info("application url : {}", appUrl); } if (StringUtils.isBlank(appUrl)) { throw new Exception("application url is blank"); } return String.format(appUrl, applicationId); } public String getJobHistoryUrl(String applicationId) { //eg:application_1587475402360_712719 -> job_1587475402360_712719 String jobId = applicationId.replace("application", "job"); return String.format(jobHistoryAddress, jobId); } /** * cat file on hdfs * * @param hdfsFilePath hdfs file path * @return byte[] byte array * @throws IOException errors */ public byte[] catFile(String hdfsFilePath) throws IOException { if (StringUtils.isBlank(hdfsFilePath)) { logger.error("hdfs file path:{} is blank", hdfsFilePath); return new byte[0]; } try (FSDataInputStream fsDataInputStream = fs.open(new Path(hdfsFilePath))) { return IOUtils.toByteArray(fsDataInputStream); } } /** * cat file on hdfs * * @param hdfsFilePath hdfs file path * @param skipLineNums skip line numbers * @param limit read how many lines * @return content of file * @throws IOException errors */ public List<String> catFile(String hdfsFilePath, int skipLineNums, int limit) throws IOException { if (StringUtils.isBlank(hdfsFilePath)) { logger.error("hdfs file path:{} is blank", hdfsFilePath); return Collections.emptyList(); } try (FSDataInputStream in = fs.open(new Path(hdfsFilePath))) { BufferedReader br = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); Stream<String> stream = br.lines().skip(skipLineNums).limit(limit); return stream.collect(Collectors.toList()); } } /** * make the given file and all non-existent parents into * directories. Has the semantics of Unix 'mkdir -p'. * Existence of the directory hierarchy is not an error. * * @param hdfsPath path to create * @return mkdir result * @throws IOException errors */ public boolean mkdir(String hdfsPath) throws IOException { return fs.mkdirs(new Path(hdfsPath)); } /** * copy files between FileSystems * * @param srcPath source hdfs path * @param dstPath destination hdfs path * @param deleteSource whether to delete the src * @param overwrite whether to overwrite an existing file * @return if success or not * @throws IOException errors */ public boolean copy(String srcPath, String dstPath, boolean deleteSource, boolean overwrite) throws IOException { return FileUtil.copy(fs, new Path(srcPath), fs, new Path(dstPath), deleteSource, overwrite, fs.getConf()); } /** * the src file is on the local disk. Add it to FS at * the given dst name. * * @param srcFile local file * @param dstHdfsPath destination hdfs path * @param deleteSource whether to delete the src * @param overwrite whether to overwrite an existing file * @return if success or not * @throws IOException errors */ public boolean copyLocalToHdfs(String srcFile, String dstHdfsPath, boolean deleteSource, boolean overwrite) throws IOException { Path srcPath = new Path(srcFile); Path dstPath = new Path(dstHdfsPath); fs.copyFromLocalFile(deleteSource, overwrite, srcPath, dstPath); return true; } /** * copy hdfs file to local * * @param srcHdfsFilePath source hdfs file path * @param dstFile destination file * @param deleteSource delete source * @param overwrite overwrite * @return result of copy hdfs file to local * @throws IOException errors */ public boolean copyHdfsToLocal(String srcHdfsFilePath, String dstFile, boolean deleteSource, boolean overwrite) throws IOException { Path srcPath = new Path(srcHdfsFilePath); File dstPath = new File(dstFile); if (dstPath.exists()) { if (dstPath.isFile()) { if (overwrite) { Files.delete(dstPath.toPath()); } } else { logger.error("destination file must be a file"); } } if (!dstPath.getParentFile().exists()) { dstPath.getParentFile().mkdirs(); } return FileUtil.copy(fs, srcPath, dstPath, deleteSource, fs.getConf()); } /** * delete a file * * @param hdfsFilePath the path to delete. * @param recursive if path is a directory and set to * true, the directory is deleted else throws an exception. In * case of a file the recursive can be set to either true or false. * @return true if delete is successful else false. * @throws IOException errors */ public boolean delete(String hdfsFilePath, boolean recursive) throws IOException { return fs.delete(new Path(hdfsFilePath), recursive); } /** * check if exists * * @param hdfsFilePath source file path * @return result of exists or not * @throws IOException errors */ public boolean exists(String hdfsFilePath) throws IOException { return fs.exists(new Path(hdfsFilePath)); } /** * Gets a list of files in the directory * * @param filePath file path * @return {@link FileStatus} file status * @throws Exception errors */ public FileStatus[] listFileStatus(String filePath) throws Exception { try { return fs.listStatus(new Path(filePath)); } catch (IOException e) { logger.error("Get file list exception", e); throw new Exception("Get file list exception", e); } } /** * Renames Path src to Path dst. Can take place on local fs * or remote DFS. * * @param src path to be renamed * @param dst new path after rename * @return true if rename is successful * @throws IOException on failure */ public boolean rename(String src, String dst) throws IOException { return fs.rename(new Path(src), new Path(dst)); } /** * hadoop resourcemanager enabled or not * * @return result */ public boolean isYarnEnabled() { return yarnEnabled; } /** * get the state of an application * * @param applicationId application id * @return the return may be null or there may be other parse exceptions */ public ExecutionStatus getApplicationStatus(String applicationId) throws Exception { if (StringUtils.isEmpty(applicationId)) { return null; } String result = Constants.FAILED; String applicationUrl = getApplicationUrl(applicationId); logger.info("applicationUrl={}", applicationUrl); String responseContent = PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false) ? KerberosHttpClient.get(applicationUrl) : HttpUtils.get(applicationUrl); if (responseContent != null) { ObjectNode jsonObject = JSONUtils.parseObject(responseContent); if (!jsonObject.has("app")) { return ExecutionStatus.FAILURE; } result = jsonObject.path("app").path("finalStatus").asText(); } else { //may be in job history String jobHistoryUrl = getJobHistoryUrl(applicationId); logger.info("jobHistoryUrl={}", jobHistoryUrl); responseContent = PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false) ? KerberosHttpClient.get(jobHistoryUrl) : HttpUtils.get(jobHistoryUrl); if (null != responseContent) { ObjectNode jsonObject = JSONUtils.parseObject(responseContent); if (!jsonObject.has("job")) { return ExecutionStatus.FAILURE; } result = jsonObject.path("job").path("state").asText(); } else { return ExecutionStatus.FAILURE; } } switch (result) { case Constants.ACCEPTED: return ExecutionStatus.SUBMITTED_SUCCESS; case Constants.SUCCEEDED: return ExecutionStatus.SUCCESS; case Constants.NEW: case Constants.NEW_SAVING: case Constants.SUBMITTED: case Constants.FAILED: return ExecutionStatus.FAILURE; case Constants.KILLED: return ExecutionStatus.KILL; case Constants.RUNNING: default: return ExecutionStatus.RUNNING_EXECUTION; } } /** * get data hdfs path * * @return data hdfs path */ public static String getHdfsDataBasePath() { if ("/".equals(resourceUploadPath)) { // if basepath is configured to /, the generated url may be //default/resources (with extra leading /) return ""; } else { return resourceUploadPath; } } /** * hdfs resource dir * * @param tenantCode tenant code * @param resourceType resource type * @return hdfs resource dir */ public static String getHdfsDir(ResourceType resourceType, String tenantCode) { String hdfsDir = ""; if (resourceType.equals(ResourceType.FILE)) { hdfsDir = getHdfsResDir(tenantCode); } else if (resourceType.equals(ResourceType.UDF)) { hdfsDir = getHdfsUdfDir(tenantCode); } return hdfsDir; } /** * hdfs resource dir * * @param tenantCode tenant code * @return hdfs resource dir */ public static String getHdfsResDir(String tenantCode) { return String.format("%s/resources", getHdfsTenantDir(tenantCode)); } /** * hdfs user dir * * @param tenantCode tenant code * @param userId user id * @return hdfs resource dir */ public static String getHdfsUserDir(String tenantCode, int userId) { return String.format("%s/home/%d", getHdfsTenantDir(tenantCode), userId); } /** * hdfs udf dir * * @param tenantCode tenant code * @return get udf dir on hdfs */ public static String getHdfsUdfDir(String tenantCode) { return String.format("%s/udfs", getHdfsTenantDir(tenantCode)); } /** * get hdfs file name * * @param resourceType resource type * @param tenantCode tenant code * @param fileName file name * @return hdfs file name */ public static String getHdfsFileName(ResourceType resourceType, String tenantCode, String fileName) { if (fileName.startsWith("/")) { fileName = fileName.replaceFirst("/", ""); } return String.format("%s/%s", getHdfsDir(resourceType, tenantCode), fileName); } /** * get absolute path and name for resource file on hdfs * * @param tenantCode tenant code * @param fileName file name * @return get absolute path and name for file on hdfs */ public static String getHdfsResourceFileName(String tenantCode, String fileName) { if (fileName.startsWith("/")) { fileName = fileName.replaceFirst("/", ""); } return String.format("%s/%s", getHdfsResDir(tenantCode), fileName); } /** * get absolute path and name for udf file on hdfs * * @param tenantCode tenant code * @param fileName file name * @return get absolute path and name for udf file on hdfs */ public static String getHdfsUdfFileName(String tenantCode, String fileName) { if (fileName.startsWith("/")) { fileName = fileName.replaceFirst("/", ""); } return String.format("%s/%s", getHdfsUdfDir(tenantCode), fileName); } /** * @param tenantCode tenant code * @return file directory of tenants on hdfs */ public static String getHdfsTenantDir(String tenantCode) { return String.format("%s/%s", getHdfsDataBasePath(), tenantCode); } /** * getAppAddress * * @param appAddress app address * @param rmHa resource manager ha * @return app address */ public static String getAppAddress(String appAddress, String rmHa) { //get active ResourceManager String activeRM = YarnHAAdminUtils.getAcitveRMName(rmHa); String[] split1 = appAddress.split(Constants.DOUBLE_SLASH); if (split1.length != 2) { return null; } String start = split1[0] + Constants.DOUBLE_SLASH; String[] split2 = split1[1].split(Constants.COLON); if (split2.length != 2) { return null; } String end = Constants.COLON + split2[1]; return start + activeRM + end; } @Override public void close() throws IOException { if (fs != null) { try { fs.close(); } catch (IOException e) { logger.error("Close HadoopUtils instance failed", e); throw new IOException("Close HadoopUtils instance failed", e); } } } /** * yarn ha admin utils */ private static final class YarnHAAdminUtils extends RMAdminCLI { /** * get active resourcemanager * * @param rmIds * @return */ public static String getAcitveRMName(String rmIds) { String[] rmIdArr = rmIds.split(Constants.COMMA); int activeResourceManagerPort = PropertyUtils.getInt(Constants.HADOOP_RESOURCE_MANAGER_HTTPADDRESS_PORT, 8088); String yarnUrl = "http://%s:" + activeResourceManagerPort + "/ws/v1/cluster/info"; try { /** * send http get request to rm */ for (String rmId : rmIdArr) { String state = getRMState(String.format(yarnUrl, rmId)); if (Constants.HADOOP_RM_STATE_ACTIVE.equals(state)) { return rmId; } } } catch (Exception e) { for (int i = 1; i < rmIdArr.length; i++) { String state = getRMState(String.format(yarnUrl, rmIdArr[i])); if (Constants.HADOOP_RM_STATE_ACTIVE.equals(state)) { return rmIdArr[i]; } } } return null; } /** * get ResourceManager state * * @param url * @return */ public static String getRMState(String url) { String retStr = PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false) ? KerberosHttpClient.get(url) : HttpUtils.get(url); if (StringUtils.isEmpty(retStr)) { return null; } //to json ObjectNode jsonObject = JSONUtils.parseObject(retStr); //get ResourceManager state if (!jsonObject.has("clusterInfo")) { return null; } return jsonObject.get("clusterInfo").path("haState").asText(); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,884
[Improvement][Common] a concatenation URL problem occurred when the address of the ACITVE ResourceManager in YARN HA mode failed to be obtained
**Describe the question** Acitve ReSourceManager IP = null when obtaining Acitve ReSourceManager address in YARN HA mode fails, the program will return splicing application url = http://null:8088/ws/v1/cluster/apps/%s **What are the current deficiencies and the benefits of improvement** The yarn application URL generation failed exception should be thrown here **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4884
https://github.com/apache/dolphinscheduler/pull/4885
ea6b1de120cd438b7611b966d396164dec421cbb
c8e31ad58e15936174e773172d12337a8cf26d69
"2021-02-26T04:31:57Z"
java
"2021-03-11T14:14:52Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/HadoopUtilsTest.java
/* * 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.dolphinscheduler.common.utils; import org.apache.dolphinscheduler.common.enums.ResourceType; import org.apache.hadoop.conf.Configuration; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @RunWith(MockitoJUnitRunner.class) //todo there is no hadoop environment public class HadoopUtilsTest { private static final Logger logger = LoggerFactory.getLogger(HadoopUtilsTest.class); private HadoopUtils hadoopUtils = HadoopUtils.getInstance(); @Test public void getActiveRMTest() { try{ hadoopUtils.getAppAddress("http://ark1:8088/ws/v1/cluster/apps/%s","192.168.xx.xx,192.168.xx.xx"); } catch (Exception e) { logger.error(e.getMessage(),e); } } @Test public void rename() { boolean result = false; try { result = hadoopUtils.rename("/dolphinscheduler/hdfs1","/dolphinscheduler/hdfs2"); } catch (Exception e) { logger.error(e.getMessage(),e); } Assert.assertEquals(false, result); } @Test public void getConfiguration(){ Configuration conf = hadoopUtils.getConfiguration(); } @Test public void mkdir() { boolean result = false; try { result = hadoopUtils.mkdir("/dolphinscheduler/hdfs"); } catch (Exception e) { logger.error(e.getMessage(), e); } Assert.assertEquals(false, result); } @Test public void delete() { boolean result = false; try { result = hadoopUtils.delete("/dolphinscheduler/hdfs",true); } catch (Exception e) { logger.error(e.getMessage(), e); } Assert.assertEquals(false, result); } @Test public void exists() { boolean result = false; try { result = hadoopUtils.exists("/dolphinscheduler/hdfs"); } catch (Exception e) { logger.error(e.getMessage(), e); } Assert.assertEquals(false, result); } @Test public void getHdfsDataBasePath() { String result = hadoopUtils.getHdfsDataBasePath(); Assert.assertEquals("/dolphinscheduler", result); } @Test public void getHdfsResDir() { String result = hadoopUtils.getHdfsResDir("11000"); Assert.assertEquals("/dolphinscheduler/11000/resources", result); } @Test public void getHdfsUserDir() { String result = hadoopUtils.getHdfsUserDir("11000",1000); Assert.assertEquals("/dolphinscheduler/11000/home/1000", result); } @Test public void getHdfsUdfDir() { String result = hadoopUtils.getHdfsUdfDir("11000"); Assert.assertEquals("/dolphinscheduler/11000/udfs", result); } @Test public void getHdfsFileName() { String result = hadoopUtils.getHdfsFileName(ResourceType.FILE,"11000","aa.txt"); Assert.assertEquals("/dolphinscheduler/11000/resources/aa.txt", result); } @Test public void getHdfsResourceFileName() { String result = hadoopUtils.getHdfsResourceFileName("11000","aa.txt"); Assert.assertEquals("/dolphinscheduler/11000/resources/aa.txt", result); } @Test public void getHdfsUdfFileName() { String result = hadoopUtils.getHdfsFileName(ResourceType.UDF,"11000","aa.txt"); Assert.assertEquals("/dolphinscheduler/11000/udfs/aa.txt", result); } @Test public void isYarnEnabled() { boolean result = hadoopUtils.isYarnEnabled(); Assert.assertEquals(true, result); } @Test public void test() { try { hadoopUtils.copyLocalToHdfs("/root/teamviewer_13.1.8286.x86_64.rpm", "/journey", true, true); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Test public void readFileTest(){ try { byte[] bytes = hadoopUtils.catFile("/dolphinscheduler/hdfs/resources/35435.sh"); logger.info(new String(bytes)); } catch (Exception e) { logger.error(e.getMessage(),e); } } @Test public void testMove(){ try { hadoopUtils.copy("/opt/apptest/test.dat","/opt/apptest/test.dat.back",true,true); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Test public void getApplicationStatus() { try { logger.info(hadoopUtils.getApplicationStatus("application_1542010131334_0029").toString()); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Test public void getApplicationUrl() throws Exception { String application_1516778421218_0042 = hadoopUtils.getApplicationUrl("application_1529051418016_0167"); logger.info(application_1516778421218_0042); } @Test public void getJobHistoryUrl(){ String application_1516778421218_0042 = hadoopUtils.getJobHistoryUrl("application_1529051418016_0167"); logger.info(application_1516778421218_0042); } @Test public void catFileWithLimitTest() { List<String> stringList = new ArrayList<>(); try { stringList = hadoopUtils.catFile("/dolphinscheduler/hdfs/resources/WCSparkPython.py", 0, 1000); logger.info(String.join(",",stringList)); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Test public void catFileTest() { byte[] content = new byte[0]; try { content = hadoopUtils.catFile("/dolphinscheduler/hdfs/resources/WCSparkPython.py"); } catch (Exception e) { logger.error(e.getMessage(), e); } logger.info(Arrays.toString(content)); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,044
[Bug][Master] Fix First master fault tolerance when startup
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** Filtering an empty Host results in failure to perform Master startup fault tolerance 过滤空Host导致未执行Master启动容错 ![image](https://user-images.githubusercontent.com/11975398/110957734-df4aa700-8386-11eb-851f-530a9699630e.png) ![image](https://user-images.githubusercontent.com/11975398/110957590-b3c7bc80-8386-11eb-8648-5c28c65ecc12.png) **Which version of Dolphin Scheduler:** -[1.3.6-prerelease]
https://github.com/apache/dolphinscheduler/issues/5044
https://github.com/apache/dolphinscheduler/pull/5045
cc2a94a9735099b0a453624ce1c9f3be7a375a9d
a3153b5e44d40cceea6e705f2406c4a4ec5f99c9
"2021-03-12T15:02:48Z"
java
"2021-03-12T16:01:18Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
/* * 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.dolphinscheduler.server.zk; import static org.apache.dolphinscheduler.common.Constants.SLEEP_TIME_MILLIS; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.ZKNodeType; import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.common.thread.ThreadUtils; import org.apache.dolphinscheduler.common.utils.NetUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.remote.utils.Host; import org.apache.dolphinscheduler.server.builder.TaskExecutionContextBuilder; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.server.master.MasterServer; import org.apache.dolphinscheduler.server.master.registry.MasterRegistry; import org.apache.dolphinscheduler.server.utils.ProcessUtils; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.zk.AbstractZKClient; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.recipes.cache.TreeCacheEvent; import org.apache.curator.framework.recipes.locks.InterProcessMutex; import java.util.Date; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * zookeeper master client * <p> * single instance */ @Component public class ZKMasterClient extends AbstractZKClient { /** * logger */ private static final Logger logger = LoggerFactory.getLogger(ZKMasterClient.class); /** * process service */ @Autowired private ProcessService processService; /** * master registry */ @Autowired private MasterRegistry masterRegistry; public void start(MasterServer masterServer) { InterProcessMutex mutex = null; try { // create distributed lock with the root node path of the lock space as /dolphinscheduler/lock/failover/startup-masters String znodeLock = getMasterStartUpLockPath(); mutex = new InterProcessMutex(getZkClient(), znodeLock); mutex.acquire(); // master registry masterRegistry.registry(); masterRegistry.getZookeeperRegistryCenter().setStoppable(masterServer); String registPath = this.masterRegistry.getMasterPath(); masterRegistry.getZookeeperRegistryCenter().getRegisterOperator().handleDeadServer(registPath, ZKNodeType.MASTER, Constants.DELETE_ZK_OP); // init system znode this.initSystemZNode(); while (!checkZKNodeExists(NetUtils.getHost(), ZKNodeType.MASTER)) { ThreadUtils.sleep(SLEEP_TIME_MILLIS); } // self tolerant if (getActiveMasterNum() == 1) { removeZKNodePath(null, ZKNodeType.MASTER, true); removeZKNodePath(null, ZKNodeType.WORKER, true); } registerListener(); } catch (Exception e) { logger.error("master start up exception", e); } finally { releaseMutex(mutex); } } @Override public void close() { masterRegistry.unRegistry(); super.close(); } /** * handle path events that this class cares about * * @param client zkClient * @param event path event * @param path zk path */ @Override protected void dataChanged(CuratorFramework client, TreeCacheEvent event, String path) { //monitor master if (path.startsWith(getZNodeParentPath(ZKNodeType.MASTER) + Constants.SINGLE_SLASH)) { handleMasterEvent(event, path); } else if (path.startsWith(getZNodeParentPath(ZKNodeType.WORKER) + Constants.SINGLE_SLASH)) { //monitor worker handleWorkerEvent(event, path); } } /** * remove zookeeper node path * * @param path zookeeper node path * @param zkNodeType zookeeper node type * @param failover is failover */ private void removeZKNodePath(String path, ZKNodeType zkNodeType, boolean failover) { logger.info("{} node deleted : {}", zkNodeType.toString(), path); InterProcessMutex mutex = null; try { String failoverPath = getFailoverLockPath(zkNodeType); // create a distributed lock mutex = new InterProcessMutex(getZkClient(), failoverPath); mutex.acquire(); String serverHost = null; if (StringUtils.isNotEmpty(path)) { serverHost = getHostByEventDataPath(path); if (StringUtils.isEmpty(serverHost)) { logger.error("server down error: unknown path: {}", path); return; } // handle dead server handleDeadServer(path, zkNodeType, Constants.ADD_ZK_OP); } //failover server if (failover) { failoverServerWhenDown(serverHost, zkNodeType); } } catch (Exception e) { logger.error("{} server failover failed.", zkNodeType.toString()); logger.error("failover exception ", e); } finally { releaseMutex(mutex); } } /** * failover server when server down * * @param serverHost server host * @param zkNodeType zookeeper node type * @throws Exception exception */ private void failoverServerWhenDown(String serverHost, ZKNodeType zkNodeType) throws Exception { if (StringUtils.isEmpty(serverHost)) { return; } switch (zkNodeType) { case MASTER: failoverMaster(serverHost); break; case WORKER: failoverWorker(serverHost, true); break; default: break; } } /** * get failover lock path * * @param zkNodeType zookeeper node type * @return fail over lock path */ private String getFailoverLockPath(ZKNodeType zkNodeType) { switch (zkNodeType) { case MASTER: return getMasterFailoverLockPath(); case WORKER: return getWorkerFailoverLockPath(); default: return ""; } } /** * monitor master * * @param event event * @param path path */ public void handleMasterEvent(TreeCacheEvent event, String path) { switch (event.getType()) { case NODE_ADDED: logger.info("master node added : {}", path); break; case NODE_REMOVED: removeZKNodePath(path, ZKNodeType.MASTER, true); break; default: break; } } /** * monitor worker * * @param event event * @param path path */ public void handleWorkerEvent(TreeCacheEvent event, String path) { switch (event.getType()) { case NODE_ADDED: logger.info("worker node added : {}", path); break; case NODE_REMOVED: logger.info("worker node deleted : {}", path); removeZKNodePath(path, ZKNodeType.WORKER, true); break; default: break; } } /** * task needs failover if task start before worker starts * * @param taskInstance task instance * @return true if task instance need fail over */ private boolean checkTaskInstanceNeedFailover(TaskInstance taskInstance) throws Exception { boolean taskNeedFailover = true; //now no host will execute this task instance,so no need to failover the task if (taskInstance.getHost() == null) { return false; } // if the worker node exists in zookeeper, we must check the task starts after the worker if (checkZKNodeExists(taskInstance.getHost(), ZKNodeType.WORKER)) { //if task start after worker starts, there is no need to failover the task. if (checkTaskAfterWorkerStart(taskInstance)) { taskNeedFailover = false; } } return taskNeedFailover; } /** * check task start after the worker server starts. * * @param taskInstance task instance * @return true if task instance start time after worker server start date */ private boolean checkTaskAfterWorkerStart(TaskInstance taskInstance) { if (StringUtils.isEmpty(taskInstance.getHost())) { return false; } Date workerServerStartDate = null; List<Server> workerServers = getServersList(ZKNodeType.WORKER); for (Server workerServer : workerServers) { if (taskInstance.getHost().equals(workerServer.getHost() + Constants.COLON + workerServer.getPort())) { workerServerStartDate = workerServer.getCreateTime(); break; } } if (workerServerStartDate != null) { return taskInstance.getStartTime().after(workerServerStartDate); } return false; } /** * failover worker tasks * <p> * 1. kill yarn job if there are yarn jobs in tasks. * 2. change task state from running to need failover. * 3. failover all tasks when workerHost is null * * @param workerHost worker host * @param needCheckWorkerAlive need check worker alive * @throws Exception exception */ private void failoverWorker(String workerHost, boolean needCheckWorkerAlive) throws Exception { workerHost = Host.of(workerHost).getAddress(); logger.info("start worker[{}] failover ...", workerHost); List<TaskInstance> needFailoverTaskInstanceList = processService.queryNeedFailoverTaskInstances(workerHost); for (TaskInstance taskInstance : needFailoverTaskInstanceList) { if (needCheckWorkerAlive) { if (!checkTaskInstanceNeedFailover(taskInstance)) { continue; } } ProcessInstance processInstance = processService.findProcessInstanceDetailById(taskInstance.getProcessInstanceId()); if (processInstance != null) { taskInstance.setProcessInstance(processInstance); } TaskExecutionContext taskExecutionContext = TaskExecutionContextBuilder.get() .buildTaskInstanceRelatedInfo(taskInstance) .buildProcessInstanceRelatedInfo(processInstance) .create(); // only kill yarn job if exists , the local thread has exited ProcessUtils.killYarnJob(taskExecutionContext); taskInstance.setState(ExecutionStatus.NEED_FAULT_TOLERANCE); processService.saveTaskInstance(taskInstance); } logger.info("end worker[{}] failover ...", workerHost); } /** * failover master tasks * * @param masterHost master host */ private void failoverMaster(String masterHost) { logger.info("start master failover ..."); List<ProcessInstance> needFailoverProcessInstanceList = processService.queryNeedFailoverProcessInstances(masterHost); logger.info("failover process list size:{} ", needFailoverProcessInstanceList.size()); //updateProcessInstance host is null and insert into command for (ProcessInstance processInstance : needFailoverProcessInstanceList) { logger.info("failover process instance id: {} host:{}", processInstance.getId(), processInstance.getHost()); if (Constants.NULL.equals(processInstance.getHost())) { continue; } processService.processNeedFailoverProcessInstances(processInstance); } logger.info("master failover end"); } public InterProcessMutex blockAcquireMutex() throws Exception { InterProcessMutex mutex = new InterProcessMutex(getZkClient(), getMasterLockPath()); mutex.acquire(); return mutex; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,024
[Improvement][Worker] Python Command
In general, the home is the directory where the software is installed,but the commandInterpreter method use the Python home directory in PythonCommandExecutor.java, which is in the environment variable configuration file needs to be configured PYTHON_HOME to PYTHON_HOME/bin/Python. Obviously, this is unreasonable and misleading **Describe alternatives you've considered** ```java /** * get python home * * @return python home */ @Override protected String commandInterpreter() { String pythonHome = getPythonHome(taskExecutionContext.getEnvFile()); if (StringUtils.isEmpty(pythonHome)) { return PYTHON; } -- return pythonHome ++ return pythonHome + "/bin/python"; } ``` [dev]
https://github.com/apache/dolphinscheduler/issues/5024
https://github.com/apache/dolphinscheduler/pull/5036
a3153b5e44d40cceea6e705f2406c4a4ec5f99c9
2d8c4ec86bdc8d00baee4066f40699078735c5dc
"2021-03-10T02:12:24Z"
java
"2021-03-15T02:22:13Z"
docker/build/README.md
## What is DolphinScheduler? DolphinScheduler is a distributed and easy-to-expand visual DAG workflow scheduling system, dedicated to solving the complex dependencies in data processing, making the scheduling system out of the box for data processing. GitHub URL: https://github.com/apache/incubator-dolphinscheduler Official Website: https://dolphinscheduler.apache.org ![DolphinScheduler](https://dolphinscheduler.apache.org/img/hlogo_colorful.svg) [![EN doc](https://img.shields.io/badge/document-English-blue.svg)](README.md) [![CN doc](https://img.shields.io/badge/文档-中文版-blue.svg)](README_zh_CN.md) ## Prerequisites - [Docker](https://docs.docker.com/engine/) 1.13.1+ - [Docker Compose](https://docs.docker.com/compose/) 1.11.0+ ## How to use this docker image #### You can start a dolphinscheduler by docker-compose (recommended) ``` $ docker-compose -f ./docker/docker-swarm/docker-compose.yml up -d ``` The default **postgres** user `root`, postgres password `root` and database `dolphinscheduler` are created in the `docker-compose.yml`. The default **zookeeper** is created in the `docker-compose.yml`. Access the Web UI: http://192.168.xx.xx:12345/dolphinscheduler The default username is `admin` and the default password is `dolphinscheduler123` > **Tip**: For quick start in docker, you can create a tenant named `ds` and associate the user `admin` with the tenant `ds` #### Or via Environment Variables **`DATABASE_HOST`** **`DATABASE_PORT`** **`DATABASE_DATABASE`** **`ZOOKEEPER_QUORUM`** You can specify **existing postgres and zookeeper service**. Example: ``` $ docker run -d --name dolphinscheduler \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ -p 12345:12345 \ apache/dolphinscheduler:latest all ``` Access the Web UI:http://192.168.xx.xx:12345/dolphinscheduler #### Or start a standalone dolphinscheduler server You can start a standalone dolphinscheduler server. * Create a **local volume** for resource storage, For example: ``` docker volume create dolphinscheduler-resource-local ``` * Start a **master server**, For example: ``` $ docker run -d --name dolphinscheduler-master \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ apache/dolphinscheduler:latest master-server ``` * Start a **worker server** (including **logger server**), For example: ``` $ docker run -d --name dolphinscheduler-worker \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ -e ALERT_LISTEN_HOST="dolphinscheduler-alert" \ -v dolphinscheduler-resource-local:/dolphinscheduler \ apache/dolphinscheduler:latest worker-server ``` * Start a **api server**, For example: ``` $ docker run -d --name dolphinscheduler-api \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ -v dolphinscheduler-resource-local:/dolphinscheduler \ -p 12345:12345 \ apache/dolphinscheduler:latest api-server ``` * Start a **alert server**, For example: ``` $ docker run -d --name dolphinscheduler-alert \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ apache/dolphinscheduler:latest alert-server ``` **Note**: You must be specify `DATABASE_HOST` `DATABASE_PORT` `DATABASE_DATABASE` `DATABASE_USERNAME` `DATABASE_PASSWORD` `ZOOKEEPER_QUORUM` when start a standalone dolphinscheduler server. ## How to build a docker image You can build a docker image in A Unix-like operating system, You can also build it in Windows operating system. In Unix-Like, Example: ```bash $ cd path/incubator-dolphinscheduler $ sh ./docker/build/hooks/build ``` In Windows, Example: ```bat C:\incubator-dolphinscheduler>.\docker\build\hooks\build.bat ``` Please read `./docker/build/hooks/build` `./docker/build/hooks/build.bat` script files if you don't understand ## Environment Variables The DolphinScheduler Docker container is configured through environment variables, and the default value will be used if an environment variable is not set. **`DATABASE_TYPE`** This environment variable sets the type for database. The default value is `postgresql`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DATABASE_DRIVER`** This environment variable sets the type for database. The default value is `org.postgresql.Driver`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DATABASE_HOST`** This environment variable sets the host for database. The default value is `127.0.0.1`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DATABASE_PORT`** This environment variable sets the port for database. The default value is `5432`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DATABASE_USERNAME`** This environment variable sets the username for database. The default value is `root`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DATABASE_PASSWORD`** This environment variable sets the password for database. The default value is `root`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DATABASE_DATABASE`** This environment variable sets the database for database. The default value is `dolphinscheduler`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`DATABASE_PARAMS`** This environment variable sets the database for database. The default value is `characterEncoding=utf8`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`, `api-server`, `alert-server`. **`HADOOP_HOME`** This environment variable sets `HADOOP_HOME`. The default value is `/opt/soft/hadoop`. **`HADOOP_CONF_DIR`** This environment variable sets `HADOOP_CONF_DIR`. The default value is `/opt/soft/hadoop/etc/hadoop`. **`SPARK_HOME1`** This environment variable sets `SPARK_HOME1`. The default value is `/opt/soft/spark1`. **`SPARK_HOME2`** This environment variable sets `SPARK_HOME2`. The default value is `/opt/soft/spark2`. **`PYTHON_HOME`** This environment variable sets `PYTHON_HOME`. The default value is `/usr/bin/python`. **`JAVA_HOME`** This environment variable sets `JAVA_HOME`. The default value is `/usr/lib/jvm/java-1.8-openjdk`. **`HIVE_HOME`** This environment variable sets `HIVE_HOME`. The default value is `/opt/soft/hive`. **`FLINK_HOME`** This environment variable sets `FLINK_HOME`. The default value is `/opt/soft/flink`. **`DATAX_HOME`** This environment variable sets `DATAX_HOME`. The default value is `/opt/soft/datax/bin/datax.py`. **`DOLPHINSCHEDULER_DATA_BASEDIR_PATH`** User data directory path, self configuration, please make sure the directory exists and have read write permissions. The default value is `/tmp/dolphinscheduler` **`DOLPHINSCHEDULER_OPTS`** This environment variable sets java options. The default value is empty. **`RESOURCE_STORAGE_TYPE`** This environment variable sets resource storage type for dolphinscheduler like `HDFS`, `S3`, `NONE`. The default value is `HDFS`. **`RESOURCE_UPLOAD_PATH`** This environment variable sets resource store path on HDFS/S3 for resource storage. The default value is `/dolphinscheduler`. **`FS_DEFAULT_FS`** This environment variable sets fs.defaultFS for resource storage like `file:///`, `hdfs://mycluster:8020` or `s3a://dolphinscheduler`. The default value is `file:///`. **`FS_S3A_ENDPOINT`** This environment variable sets s3 endpoint for resource storage. The default value is `s3.xxx.amazonaws.com`. **`FS_S3A_ACCESS_KEY`** This environment variable sets s3 access key for resource storage. The default value is `xxxxxxx`. **`FS_S3A_SECRET_KEY`** This environment variable sets s3 secret key for resource storage. The default value is `xxxxxxx`. **`ZOOKEEPER_QUORUM`** This environment variable sets zookeeper quorum for `master-server` and `worker-serverr`. The default value is `127.0.0.1:2181`. **Note**: You must be specify it when start a standalone dolphinscheduler server. Like `master-server`, `worker-server`. **`ZOOKEEPER_ROOT`** This environment variable sets zookeeper root directory for dolphinscheduler. The default value is `/dolphinscheduler`. **`MASTER_EXEC_THREADS`** This environment variable sets exec thread num for `master-server`. The default value is `100`. **`MASTER_EXEC_TASK_NUM`** This environment variable sets exec task num for `master-server`. The default value is `20`. **`MASTER_HEARTBEAT_INTERVAL`** This environment variable sets heartbeat interval for `master-server`. The default value is `10`. **`MASTER_TASK_COMMIT_RETRYTIMES`** This environment variable sets task commit retry times for `master-server`. The default value is `5`. **`MASTER_TASK_COMMIT_INTERVAL`** This environment variable sets task commit interval for `master-server`. The default value is `1000`. **`MASTER_MAX_CPULOAD_AVG`** This environment variable sets max cpu load avg for `master-server`. The default value is `100`. **`MASTER_RESERVED_MEMORY`** This environment variable sets reserved memory for `master-server`. The default value is `0.1`. **`MASTER_LISTEN_PORT`** This environment variable sets port for `master-server`. The default value is `5678`. **`WORKER_EXEC_THREADS`** This environment variable sets exec thread num for `worker-server`. The default value is `100`. **`WORKER_HEARTBEAT_INTERVAL`** This environment variable sets heartbeat interval for `worker-server`. The default value is `10`. **`WORKER_MAX_CPULOAD_AVG`** This environment variable sets max cpu load avg for `worker-server`. The default value is `100`. **`WORKER_RESERVED_MEMORY`** This environment variable sets reserved memory for `worker-server`. The default value is `0.1`. **`WORKER_LISTEN_PORT`** This environment variable sets port for `worker-server`. The default value is `1234`. **`WORKER_GROUPS`** This environment variable sets groups for `worker-server`. The default value is `default`. **`WORKER_HOST_WEIGHT`** This environment variable sets weight for `worker-server`. The default value is `100`. **`ALERT_LISTEN_HOST`** This environment variable sets the host of `alert-server` for `worker-server`. The default value is `127.0.0.1`. **`ALERT_PLUGIN_DIR`** This environment variable sets the alert plugin directory for `alert-server`. The default value is `lib/plugin/alert`. ## Initialization scripts If you would like to do additional initialization in an image derived from this one, add one or more environment variable under `/root/start-init-conf.sh`, and modify template files in `/opt/dolphinscheduler/conf/*.tpl`. For example, to add an environment variable `API_SERVER_PORT` in `/root/start-init-conf.sh`: ``` export API_SERVER_PORT=5555 ``` and to modify `/opt/dolphinscheduler/conf/application-api.properties.tpl` template file, add server port: ``` server.port=${API_SERVER_PORT} ``` `/root/start-init-conf.sh` will dynamically generate config file: ```sh echo "generate dolphinscheduler config" ls ${DOLPHINSCHEDULER_HOME}/conf/ | grep ".tpl" | while read line; do eval "cat << EOF $(cat ${DOLPHINSCHEDULER_HOME}/conf/${line}) EOF " > ${DOLPHINSCHEDULER_HOME}/conf/${line%.*} done ``` ## FAQ ### How to stop dolphinscheduler by docker-compose? Stop containers: ``` docker-compose stop ``` Stop containers and remove containers, networks and volumes: ``` docker-compose down -v ``` ### How to deploy dolphinscheduler on Docker Swarm? Assuming that the Docker Swarm cluster has been created (If there is no Docker Swarm cluster, please refer to [create-swarm](https://docs.docker.com/engine/swarm/swarm-tutorial/create-swarm/)) Start a stack named dolphinscheduler ``` docker stack deploy -c docker-stack.yml dolphinscheduler ``` Stop and remove the stack named dolphinscheduler ``` docker stack rm dolphinscheduler ``` ### How to use MySQL as the DolphinScheduler's database instead of PostgreSQL? > Because of the commercial license, we cannot directly use the driver and client of MySQL. > > If you want to use MySQL, you can build a new image based on the `apache/dolphinscheduler` image as follows. 1. Download the MySQL driver [mysql-connector-java-5.1.49.jar](https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar) (require `>=5.1.47`) 2. Create a new `Dockerfile` to add MySQL driver and client: ``` FROM apache/dolphinscheduler:latest COPY mysql-connector-java-5.1.49.jar /opt/dolphinscheduler/lib RUN apk add --update --no-cache mysql-client ``` 3. Build a new docker image including MySQL driver and client: ``` docker build -t apache/dolphinscheduler:mysql . ``` 4. Modify all `image` fields to `apache/dolphinscheduler:mysql` in `docker-compose.yml` > If you want to deploy dolphinscheduler on Docker Swarm, you need modify `docker-stack.yml` 5. Comment the `dolphinscheduler-postgresql` block in `docker-compose.yml` 6. Add `dolphinscheduler-mysql` service in `docker-compose.yml` (**Optional**, you can directly use a external MySQL database) 7. Modify all DATABASE environments in `docker-compose.yml` ``` DATABASE_TYPE: mysql DATABASE_DRIVER: com.mysql.jdbc.Driver DATABASE_HOST: dolphinscheduler-mysql DATABASE_PORT: 3306 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler DATABASE_PARAMS: useUnicode=true&characterEncoding=UTF-8 ``` > If you have added `dolphinscheduler-mysql` service in `docker-compose.yml`, just set `DATABASE_HOST` to `dolphinscheduler-mysql` 8. Run a dolphinscheduler (See **How to use this docker image**) ### How to support MySQL datasource in `Datasource manage`? > Because of the commercial license, we cannot directly use the driver of MySQL. > > If you want to add MySQL datasource, you can build a new image based on the `apache/dolphinscheduler` image as follows. 1. Download the MySQL driver [mysql-connector-java-5.1.49.jar](https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar) (require `>=5.1.47`) 2. Create a new `Dockerfile` to add MySQL driver: ``` FROM apache/dolphinscheduler:latest COPY mysql-connector-java-5.1.49.jar /opt/dolphinscheduler/lib ``` 3. Build a new docker image including MySQL driver: ``` docker build -t apache/dolphinscheduler:mysql-driver . ``` 4. Modify all `image` fields to `apache/dolphinscheduler:mysql-driver` in `docker-compose.yml` > If you want to deploy dolphinscheduler on Docker Swarm, you need modify `docker-stack.yml` 5. Run a dolphinscheduler (See **How to use this docker image**) 6. Add a MySQL datasource in `Datasource manage` ### How to support Oracle datasource in `Datasource manage`? > Because of the commercial license, we cannot directly use the driver of Oracle. > > If you want to add Oracle datasource, you can build a new image based on the `apache/dolphinscheduler` image as follows. 1. Download the Oracle driver [ojdbc8.jar](https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc8/) (such as `ojdbc8-19.9.0.0.jar`) 2. Create a new `Dockerfile` to add Oracle driver: ``` FROM apache/dolphinscheduler:latest COPY ojdbc8-19.9.0.0.jar /opt/dolphinscheduler/lib ``` 3. Build a new docker image including Oracle driver: ``` docker build -t apache/dolphinscheduler:oracle-driver . ``` 4. Modify all `image` fields to `apache/dolphinscheduler:oracle-driver` in `docker-compose.yml` > If you want to deploy dolphinscheduler on Docker Swarm, you need modify `docker-stack.yml` 5. Run a dolphinscheduler (See **How to use this docker image**) 6. Add a Oracle datasource in `Datasource manage` For more information please refer to the [incubator-dolphinscheduler](https://github.com/apache/incubator-dolphinscheduler.git) documentation.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,024
[Improvement][Worker] Python Command
In general, the home is the directory where the software is installed,but the commandInterpreter method use the Python home directory in PythonCommandExecutor.java, which is in the environment variable configuration file needs to be configured PYTHON_HOME to PYTHON_HOME/bin/Python. Obviously, this is unreasonable and misleading **Describe alternatives you've considered** ```java /** * get python home * * @return python home */ @Override protected String commandInterpreter() { String pythonHome = getPythonHome(taskExecutionContext.getEnvFile()); if (StringUtils.isEmpty(pythonHome)) { return PYTHON; } -- return pythonHome ++ return pythonHome + "/bin/python"; } ``` [dev]
https://github.com/apache/dolphinscheduler/issues/5024
https://github.com/apache/dolphinscheduler/pull/5036
a3153b5e44d40cceea6e705f2406c4a4ec5f99c9
2d8c4ec86bdc8d00baee4066f40699078735c5dc
"2021-03-10T02:12:24Z"
java
"2021-03-15T02:22:13Z"
docker/build/README_zh_CN.md
## DolphinScheduler是什么? 一个分布式易扩展的可视化DAG工作流任务调度系统。致力于解决数据处理流程中错综复杂的依赖关系,使调度系统在数据处理流程中`开箱即用`。 GitHub URL: https://github.com/apache/incubator-dolphinscheduler Official Website: https://dolphinscheduler.apache.org ![DolphinScheduler](https://dolphinscheduler.apache.org/img/hlogo_colorful.svg) [![EN doc](https://img.shields.io/badge/document-English-blue.svg)](README.md) [![CN doc](https://img.shields.io/badge/文档-中文版-blue.svg)](README_zh_CN.md) ## 先决条件 - [Docker](https://docs.docker.com/engine/) 1.13.1+ - [Docker Compose](https://docs.docker.com/compose/) 1.11.0+ ## 如何使用docker镜像 #### 以 docker-compose 的方式启动dolphinscheduler(推荐) ``` $ docker-compose -f ./docker/docker-swarm/docker-compose.yml up -d ``` 在`docker-compose.yml`文件中,默认的创建`Postgres`的用户、密码和数据库,默认值分别为:`root`、`root`、`dolphinscheduler`。 同时,默认的`Zookeeper`也会在`docker-compose.yml`文件中被创建。 访问前端页面:http://192.168.xx.xx:12345/dolphinscheduler 默认的用户是`admin`,默认的密码是`dolphinscheduler123` > **提示**: 为了在docker中快速开始,你可以创建一个名为`ds`的租户,并将这个租户`ds`关联到用户`admin` #### 或者通过环境变量 **`DATABASE_HOST`** **`DATABASE_PORT`** **`ZOOKEEPER_QUORUM`** 使用已存在的服务 你可以指定已经存在的 **`Postgres`** 和 **`Zookeeper`** 服务. 如下: ``` $ docker run -d --name dolphinscheduler \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ -p 12345:12345 \ apache/dolphinscheduler:latest all ``` 访问前端页面:http://192.168.xx.xx:12345/dolphinscheduler #### 或者运行dolphinscheduler中的部分服务 你能够运行dolphinscheduler中的部分服务。 * 创建一个 **本地卷** 用于资源存储,如下: ``` docker volume create dolphinscheduler-resource-local ``` * 启动一个 **master server**, 如下: ``` $ docker run -d --name dolphinscheduler-master \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ apache/dolphinscheduler:latest master-server ``` * 启动一个 **worker server** (包括 **logger server**), 如下: ``` $ docker run -d --name dolphinscheduler-worker \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ -e ALERT_LISTEN_HOST="dolphinscheduler-alert" \ -v dolphinscheduler-resource-local:/dolphinscheduler \ apache/dolphinscheduler:latest worker-server ``` * 启动一个 **api server**, 如下: ``` $ docker run -d --name dolphinscheduler-api \ -e ZOOKEEPER_QUORUM="192.168.x.x:2181" \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ -v dolphinscheduler-resource-local:/dolphinscheduler \ -p 12345:12345 \ apache/dolphinscheduler:latest api-server ``` * 启动一个 **alert server**, 如下: ``` $ docker run -d --name dolphinscheduler-alert \ -e DATABASE_HOST="192.168.x.x" -e DATABASE_PORT="5432" -e DATABASE_DATABASE="dolphinscheduler" \ -e DATABASE_USERNAME="test" -e DATABASE_PASSWORD="test" \ apache/dolphinscheduler:latest alert-server ``` **注意**: 当你运行dolphinscheduler中的部分服务时,你必须指定这些环境变量 `DATABASE_HOST` `DATABASE_PORT` `DATABASE_DATABASE` `DATABASE_USERNAME` `DATABASE_PASSWORD` `ZOOKEEPER_QUORUM`。 ## 如何构建一个docker镜像 你能够在类Unix系统和Windows系统中构建一个docker镜像。 类Unix系统, 如下: ```bash $ cd path/incubator-dolphinscheduler $ sh ./docker/build/hooks/build ``` Windows系统, 如下: ```bat C:\incubator-dolphinscheduler>.\docker\build\hooks\build.bat ``` 如果你不理解这些脚本 `./docker/build/hooks/build` `./docker/build/hooks/build.bat`,请阅读里面的内容。 ## 环境变量 DolphinScheduler Docker 容器通过环境变量进行配置,缺省时将会使用默认值 **`DATABASE_TYPE`** 配置`database`的`TYPE`, 默认值 `postgresql`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DATABASE_DRIVER`** 配置`database`的`DRIVER`, 默认值 `org.postgresql.Driver`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DATABASE_HOST`** 配置`database`的`HOST`, 默认值 `127.0.0.1`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DATABASE_PORT`** 配置`database`的`PORT`, 默认值 `5432`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DATABASE_USERNAME`** 配置`database`的`USERNAME`, 默认值 `root`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DATABASE_PASSWORD`** 配置`database`的`PASSWORD`, 默认值 `root`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DATABASE_DATABASE`** 配置`database`的`DATABASE`, 默认值 `dolphinscheduler`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`DATABASE_PARAMS`** 配置`database`的`PARAMS`, 默认值 `characterEncoding=utf8`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`、`api-server`、`alert-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`HADOOP_HOME`** 配置`dolphinscheduler`的`HADOOP_HOME`,默认值 `/opt/soft/hadoop`。 **`HADOOP_CONF_DIR`** 配置`dolphinscheduler`的`HADOOP_CONF_DIR`,默认值 `/opt/soft/hadoop/etc/hadoop`。 **`SPARK_HOME1`** 配置`dolphinscheduler`的`SPARK_HOME1`,默认值 `/opt/soft/spark1`。 **`SPARK_HOME2`** 配置`dolphinscheduler`的`SPARK_HOME2`,默认值 `/opt/soft/spark2`。 **`PYTHON_HOME`** 配置`dolphinscheduler`的`PYTHON_HOME`,默认值 `/usr/bin/python`。 **`JAVA_HOME`** 配置`dolphinscheduler`的`JAVA_HOME`,默认值 `/usr/lib/jvm/java-1。8-openjdk`。 **`HIVE_HOME`** 配置`dolphinscheduler`的`HIVE_HOME`,默认值 `/opt/soft/hive`。 **`FLINK_HOME`** 配置`dolphinscheduler`的`FLINK_HOME`,默认值 `/opt/soft/flink`。 **`DATAX_HOME`** 配置`dolphinscheduler`的`DATAX_HOME`,默认值 `/opt/soft/datax/bin/datax。py`。 **`DOLPHINSCHEDULER_DATA_BASEDIR_PATH`** 用户数据目录, 用户自己配置, 请确保这个目录存在并且用户读写权限, 默认值 `/tmp/dolphinscheduler`。 **`DOLPHINSCHEDULER_OPTS`** 配置`dolphinscheduler`的`java options`,默认值 `""`、 **`RESOURCE_STORAGE_TYPE`** 配置`dolphinscheduler`的资源存储类型,可选项为 `HDFS`、`S3`、`NONE`,默认值 `HDFS`。 **`RESOURCE_UPLOAD_PATH`** 配置`HDFS/S3`上的资源存储路径,默认值 `/dolphinscheduler`。 **`FS_DEFAULT_FS`** 配置资源存储的文件系统协议,如 `file:///`, `hdfs://mycluster:8020` or `s3a://dolphinscheduler`,默认值 `file:///`。 **`FS_S3A_ENDPOINT`** 当`RESOURCE_STORAGE_TYPE=S3`时,需要配置`S3`的访问路径,默认值 `s3.xxx.amazonaws.com`。 **`FS_S3A_ACCESS_KEY`** 当`RESOURCE_STORAGE_TYPE=S3`时,需要配置`S3`的`s3 access key`,默认值 `xxxxxxx`。 **`FS_S3A_SECRET_KEY`** 当`RESOURCE_STORAGE_TYPE=S3`时,需要配置`S3`的`s3 secret key`,默认值 `xxxxxxx`。 **`ZOOKEEPER_QUORUM`** 配置`master-server`和`worker-serverr`的`Zookeeper`地址, 默认值 `127.0.0.1:2181`。 **注意**: 当运行`dolphinscheduler`中`master-server`、`worker-server`这些服务时,必须指定这个环境变量,以便于你更好的搭建分布式服务。 **`ZOOKEEPER_ROOT`** 配置`dolphinscheduler`在`zookeeper`中数据存储的根目录,默认值 `/dolphinscheduler`。 **`MASTER_EXEC_THREADS`** 配置`master-server`中的执行线程数量,默认值 `100`。 **`MASTER_EXEC_TASK_NUM`** 配置`master-server`中的执行任务数量,默认值 `20`。 **`MASTER_HEARTBEAT_INTERVAL`** 配置`master-server`中的心跳交互时间,默认值 `10`。 **`MASTER_TASK_COMMIT_RETRYTIMES`** 配置`master-server`中的任务提交重试次数,默认值 `5`。 **`MASTER_TASK_COMMIT_INTERVAL`** 配置`master-server`中的任务提交交互时间,默认值 `1000`。 **`MASTER_MAX_CPULOAD_AVG`** 配置`master-server`中的CPU中的`load average`值,默认值 `100`。 **`MASTER_RESERVED_MEMORY`** 配置`master-server`的保留内存,默认值 `0.1`。 **`MASTER_LISTEN_PORT`** 配置`master-server`的端口,默认值 `5678`。 **`WORKER_EXEC_THREADS`** 配置`worker-server`中的执行线程数量,默认值 `100`。 **`WORKER_HEARTBEAT_INTERVAL`** 配置`worker-server`中的心跳交互时间,默认值 `10`。 **`WORKER_MAX_CPULOAD_AVG`** 配置`worker-server`中的CPU中的最大`load average`值,默认值 `100`。 **`WORKER_RESERVED_MEMORY`** 配置`worker-server`的保留内存,默认值 `0.1`。 **`WORKER_LISTEN_PORT`** 配置`worker-server`的端口,默认值 `1234`。 **`WORKER_GROUPS`** 配置`worker-server`的分组,默认值 `default`。 **`WORKER_HOST_WEIGHT`** 配置`worker-server`的权重,默认之`100`。 **`ALERT_LISTEN_HOST`** 配置`worker-server`的告警主机,即`alert-server`的主机名,默认值 `127.0.0.1`。 **`ALERT_PLUGIN_DIR`** 配置`alert-server`的告警插件目录,默认值 `lib/plugin/alert`。 ## 初始化脚本 如果你想在编译的时候或者运行的时候附加一些其它的操作及新增一些环境变量,你可以在`/root/start-init-conf.sh`文件中进行修改,同时如果涉及到配置文件的修改,请在`/opt/dolphinscheduler/conf/*.tpl`中修改相应的配置文件 例如,在`/root/start-init-conf.sh`添加一个环境变量`API_SERVER_PORT`: ``` export API_SERVER_PORT=5555 ``` 当添加以上环境变量后,你应该在相应的模板文件`/opt/dolphinscheduler/conf/application-api.properties.tpl`中添加这个环境变量配置: ``` server.port=${API_SERVER_PORT} ``` `/root/start-init-conf.sh`将根据模板文件动态的生成配置文件: ```sh echo "generate dolphinscheduler config" ls ${DOLPHINSCHEDULER_HOME}/conf/ | grep ".tpl" | while read line; do eval "cat << EOF $(cat ${DOLPHINSCHEDULER_HOME}/conf/${line}) EOF " > ${DOLPHINSCHEDULER_HOME}/conf/${line%.*} done ``` ## FAQ ### 如何通过 docker-compose 停止 dolphinscheduler? 停止所有容器: ``` docker-compose stop ``` 停止所有容器并移除所有容器,网络和存储卷: ``` docker-compose down -v ``` ### 如何在 Docker Swarm 上部署 dolphinscheduler? 假设 Docker Swarm 集群已经部署(如果还没有创建 Docker Swarm 集群,请参考 [create-swarm](https://docs.docker.com/engine/swarm/swarm-tutorial/create-swarm/)) 启动名为 dolphinscheduler 的 stack ``` docker stack deploy -c docker-stack.yml dolphinscheduler ``` 启动并移除名为 dolphinscheduler 的 stack ``` docker stack rm dolphinscheduler ``` ### 如何用 MySQL 替代 PostgreSQL 作为 DolphinScheduler 的数据库? > 由于商业许可证的原因,我们不能直接使用 MySQL 的驱动包和客户端. > > 如果你要使用 MySQL, 你可以基于官方镜像 `apache/dolphinscheduler` 进行构建. 1. 下载 MySQL 驱动包 [mysql-connector-java-5.1.49.jar](https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar) (要求 `>=5.1.47`) 2. 创建一个新的 `Dockerfile`,用于添加 MySQL 的驱动包和客户端: ``` FROM apache/dolphinscheduler:latest COPY mysql-connector-java-5.1.49.jar /opt/dolphinscheduler/lib RUN apk add --update --no-cache mysql-client ``` 3. 构建一个包含 MySQL 的驱动包和客户端的新镜像: ``` docker build -t apache/dolphinscheduler:mysql . ``` 4. 修改 `docker-compose.yml` 文件中的所有 image 字段为 `apache/dolphinscheduler:mysql` > 如果你想在 Docker Swarm 上部署 dolphinscheduler,你需要修改 `docker-stack.yml` 5. 注释 `docker-compose.yml` 文件中的 `dolphinscheduler-postgresql` 块 6. 在 `docker-compose.yml` 文件中添加 `dolphinscheduler-mysql` 服务(**可选**,你可以直接使用一个外部的 MySQL 数据库) 7. 修改 `docker-compose.yml` 文件中的所有 DATABASE 环境变量 ``` DATABASE_TYPE: mysql DATABASE_DRIVER: com.mysql.jdbc.Driver DATABASE_HOST: dolphinscheduler-mysql DATABASE_PORT: 3306 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler DATABASE_PARAMS: useUnicode=true&characterEncoding=UTF-8 ``` > 如果你已经添加了 `dolphinscheduler-mysql` 服务,设置 `DATABASE_HOST` 为 `dolphinscheduler-mysql` 即可 8. 运行 dolphinscheduler (详见**如何使用docker镜像**) ### 如何在数据源中心支持 MySQL 数据源? > 由于商业许可证的原因,我们不能直接使用 MySQL 的驱动包. > > 如果你要添加 MySQL 数据源, 你可以基于官方镜像 `apache/dolphinscheduler` 进行构建. 1. 下载 MySQL 驱动包 [mysql-connector-java-5.1.49.jar](https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar) (要求 `>=5.1.47`) 2. 创建一个新的 `Dockerfile`,用于添加 MySQL 驱动包: ``` FROM apache/dolphinscheduler:latest COPY mysql-connector-java-5.1.49.jar /opt/dolphinscheduler/lib ``` 3. 构建一个包含 MySQL 驱动包的新镜像: ``` docker build -t apache/dolphinscheduler:mysql-driver . ``` 4. 将 `docker-compose.yml` 文件中的所有 image 字段 修改为 `apache/dolphinscheduler:mysql-driver` > 如果你想在 Docker Swarm 上部署 dolphinscheduler,你需要修改 `docker-stack.yml` 5. 运行 dolphinscheduler (详见**如何使用docker镜像**) 6. 在数据源中心添加一个 MySQL 数据源 ### 如何在数据源中心支持 Oracle 数据源? > 由于商业许可证的原因,我们不能直接使用 Oracle 的驱动包. > > 如果你要添加 Oracle 数据源, 你可以基于官方镜像 `apache/dolphinscheduler` 进行构建. 1. 下载 Oracle 驱动包 [ojdbc8.jar](https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc8/) (such as `ojdbc8-19.9.0.0.jar`) 2. 创建一个新的 `Dockerfile`,用于添加 Oracle 驱动包: ``` FROM apache/dolphinscheduler:latest COPY ojdbc8-19.9.0.0.jar /opt/dolphinscheduler/lib ``` 3. 构建一个包含 Oracle 驱动包的新镜像: ``` docker build -t apache/dolphinscheduler:oracle-driver . ``` 4. 将 `docker-compose.yml` 文件中的所有 image 字段 修改为 `apache/dolphinscheduler:oracle-driver` > 如果你想在 Docker Swarm 上部署 dolphinscheduler,你需要修改 `docker-stack.yml` 5. 运行 dolphinscheduler (详见**如何使用docker镜像**) 6. 在数据源中心添加一个 Oracle 数据源 更多信息请查看 [incubator-dolphinscheduler](https://github.com/apache/incubator-dolphinscheduler.git) 文档.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,024
[Improvement][Worker] Python Command
In general, the home is the directory where the software is installed,but the commandInterpreter method use the Python home directory in PythonCommandExecutor.java, which is in the environment variable configuration file needs to be configured PYTHON_HOME to PYTHON_HOME/bin/Python. Obviously, this is unreasonable and misleading **Describe alternatives you've considered** ```java /** * get python home * * @return python home */ @Override protected String commandInterpreter() { String pythonHome = getPythonHome(taskExecutionContext.getEnvFile()); if (StringUtils.isEmpty(pythonHome)) { return PYTHON; } -- return pythonHome ++ return pythonHome + "/bin/python"; } ``` [dev]
https://github.com/apache/dolphinscheduler/issues/5024
https://github.com/apache/dolphinscheduler/pull/5036
a3153b5e44d40cceea6e705f2406c4a4ec5f99c9
2d8c4ec86bdc8d00baee4066f40699078735c5dc
"2021-03-10T02:12:24Z"
java
"2021-03-15T02:22:13Z"
docker/build/conf/dolphinscheduler/env/dolphinscheduler_env.sh.tpl
# # 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. # export HADOOP_HOME=$HADOOP_HOME export HADOOP_CONF_DIR=$HADOOP_CONF_DIR export SPARK_HOME1=$SPARK_HOME1 export SPARK_HOME2=$SPARK_HOME2 export PYTHON_HOME=$PYTHON_HOME export JAVA_HOME=$JAVA_HOME export HIVE_HOME=$HIVE_HOME export FLINK_HOME=$FLINK_HOME export DATAX_HOME=$DATAX_HOME export PATH=$HADOOP_HOME/bin:$SPARK_HOME1/bin:$SPARK_HOME2/bin:$PYTHON_HOME:$JAVA_HOME/bin:$HIVE_HOME/bin:$PATH:$FLINK_HOME/bin:$DATAX_HOME:$PATH
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,024
[Improvement][Worker] Python Command
In general, the home is the directory where the software is installed,but the commandInterpreter method use the Python home directory in PythonCommandExecutor.java, which is in the environment variable configuration file needs to be configured PYTHON_HOME to PYTHON_HOME/bin/Python. Obviously, this is unreasonable and misleading **Describe alternatives you've considered** ```java /** * get python home * * @return python home */ @Override protected String commandInterpreter() { String pythonHome = getPythonHome(taskExecutionContext.getEnvFile()); if (StringUtils.isEmpty(pythonHome)) { return PYTHON; } -- return pythonHome ++ return pythonHome + "/bin/python"; } ``` [dev]
https://github.com/apache/dolphinscheduler/issues/5024
https://github.com/apache/dolphinscheduler/pull/5036
a3153b5e44d40cceea6e705f2406c4a4ec5f99c9
2d8c4ec86bdc8d00baee4066f40699078735c5dc
"2021-03-10T02:12:24Z"
java
"2021-03-15T02:22:13Z"
docker/build/startup-init-conf.sh
#!/bin/bash # # 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. # set -e echo "init env variables" # Define parameters default value #============================================================================ # Database Source #============================================================================ export DATABASE_TYPE=${DATABASE_TYPE:-"postgresql"} export DATABASE_DRIVER=${DATABASE_DRIVER:-"org.postgresql.Driver"} export DATABASE_HOST=${DATABASE_HOST:-"127.0.0.1"} export DATABASE_PORT=${DATABASE_PORT:-"5432"} export DATABASE_USERNAME=${DATABASE_USERNAME:-"root"} export DATABASE_PASSWORD=${DATABASE_PASSWORD:-"root"} export DATABASE_DATABASE=${DATABASE_DATABASE:-"dolphinscheduler"} export DATABASE_PARAMS=${DATABASE_PARAMS:-"characterEncoding=utf8"} #============================================================================ # Common #============================================================================ # dolphinscheduler env export HADOOP_HOME=${HADOOP_HOME:-"/opt/soft/hadoop"} export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-"/opt/soft/hadoop/etc/hadoop"} export SPARK_HOME1=${SPARK_HOME1:-"/opt/soft/spark1"} export SPARK_HOME2=${SPARK_HOME2:-"/opt/soft/spark2"} export PYTHON_HOME=${PYTHON_HOME:-"/usr/bin/python"} export JAVA_HOME=${JAVA_HOME:-"/usr/lib/jvm/java-1.8-openjdk"} export HIVE_HOME=${HIVE_HOME:-"/opt/soft/hive"} export FLINK_HOME=${FLINK_HOME:-"/opt/soft/flink"} export DATAX_HOME=${DATAX_HOME:-"/opt/soft/datax/bin/datax.py"} # common env export DOLPHINSCHEDULER_DATA_BASEDIR_PATH=${DOLPHINSCHEDULER_DATA_BASEDIR_PATH:-"/tmp/dolphinscheduler"} export DOLPHINSCHEDULER_OPTS=${DOLPHINSCHEDULER_OPTS:-""} export RESOURCE_STORAGE_TYPE=${RESOURCE_STORAGE_TYPE:-"HDFS"} export RESOURCE_UPLOAD_PATH=${RESOURCE_UPLOAD_PATH:-"/dolphinscheduler"} export FS_DEFAULT_FS=${FS_DEFAULT_FS:-"file:///"} export FS_S3A_ENDPOINT=${FS_S3A_ENDPOINT:-"s3.xxx.amazonaws.com"} export FS_S3A_ACCESS_KEY=${FS_S3A_ACCESS_KEY:-"xxxxxxx"} export FS_S3A_SECRET_KEY=${FS_S3A_SECRET_KEY:-"xxxxxxx"} #============================================================================ # Zookeeper #============================================================================ export ZOOKEEPER_QUORUM=${ZOOKEEPER_QUORUM:-"127.0.0.1:2181"} export ZOOKEEPER_ROOT=${ZOOKEEPER_ROOT:-"/dolphinscheduler"} #============================================================================ # Master Server #============================================================================ export MASTER_EXEC_THREADS=${MASTER_EXEC_THREADS:-"100"} export MASTER_EXEC_TASK_NUM=${MASTER_EXEC_TASK_NUM:-"20"} export MASTER_HEARTBEAT_INTERVAL=${MASTER_HEARTBEAT_INTERVAL:-"10"} export MASTER_TASK_COMMIT_RETRYTIMES=${MASTER_TASK_COMMIT_RETRYTIMES:-"5"} export MASTER_TASK_COMMIT_INTERVAL=${MASTER_TASK_COMMIT_INTERVAL:-"1000"} export MASTER_MAX_CPULOAD_AVG=${MASTER_MAX_CPULOAD_AVG:-"100"} export MASTER_RESERVED_MEMORY=${MASTER_RESERVED_MEMORY:-"0.1"} export MASTER_LISTEN_PORT=${MASTER_LISTEN_PORT:-"5678"} #============================================================================ # Worker Server #============================================================================ export WORKER_EXEC_THREADS=${WORKER_EXEC_THREADS:-"100"} export WORKER_HEARTBEAT_INTERVAL=${WORKER_HEARTBEAT_INTERVAL:-"10"} export WORKER_MAX_CPULOAD_AVG=${WORKER_MAX_CPULOAD_AVG:-"100"} export WORKER_RESERVED_MEMORY=${WORKER_RESERVED_MEMORY:-"0.1"} export WORKER_LISTEN_PORT=${WORKER_LISTEN_PORT:-"1234"} export WORKER_GROUPS=${WORKER_GROUPS:-"default"} export WORKER_HOST_WEIGHT=${WORKER_HOST_WEIGHT:-"100"} export ALERT_LISTEN_HOST=${ALERT_LISTEN_HOST:-"127.0.0.1"} #============================================================================ # Alert Server #============================================================================ export ALERT_PLUGIN_DIR=${ALERT_PLUGIN_DIR:-"lib/plugin/alert"} echo "generate dolphinscheduler config" ls ${DOLPHINSCHEDULER_HOME}/conf/ | grep ".tpl" | while read line; do eval "cat << EOF $(cat ${DOLPHINSCHEDULER_HOME}/conf/${line}) EOF " > ${DOLPHINSCHEDULER_HOME}/conf/${line%.*} done # generate dolphinscheduler env only in docker DOLPHINSCHEDULER_ENV_PATH=${DOLPHINSCHEDULER_HOME}/conf/env/dolphinscheduler_env.sh if [ -z "${KUBERNETES_SERVICE_HOST}" ] && [ -r "${DOLPHINSCHEDULER_ENV_PATH}.tpl" ]; then eval "cat << EOF $(cat ${DOLPHINSCHEDULER_ENV_PATH}.tpl) EOF " > ${DOLPHINSCHEDULER_ENV_PATH} chmod +x ${DOLPHINSCHEDULER_ENV_PATH} fi
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,024
[Improvement][Worker] Python Command
In general, the home is the directory where the software is installed,but the commandInterpreter method use the Python home directory in PythonCommandExecutor.java, which is in the environment variable configuration file needs to be configured PYTHON_HOME to PYTHON_HOME/bin/Python. Obviously, this is unreasonable and misleading **Describe alternatives you've considered** ```java /** * get python home * * @return python home */ @Override protected String commandInterpreter() { String pythonHome = getPythonHome(taskExecutionContext.getEnvFile()); if (StringUtils.isEmpty(pythonHome)) { return PYTHON; } -- return pythonHome ++ return pythonHome + "/bin/python"; } ``` [dev]
https://github.com/apache/dolphinscheduler/issues/5024
https://github.com/apache/dolphinscheduler/pull/5036
a3153b5e44d40cceea6e705f2406c4a4ec5f99c9
2d8c4ec86bdc8d00baee4066f40699078735c5dc
"2021-03-10T02:12:24Z"
java
"2021-03-15T02:22:13Z"
docker/docker-swarm/docker-compose.yml
# 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. version: "3.1" services: dolphinscheduler-postgresql: image: bitnami/postgresql:latest container_name: dolphinscheduler-postgresql ports: - 5432:5432 environment: TZ: Asia/Shanghai POSTGRESQL_USERNAME: root POSTGRESQL_PASSWORD: root POSTGRESQL_DATABASE: dolphinscheduler volumes: - dolphinscheduler-postgresql:/bitnami/postgresql - dolphinscheduler-postgresql-initdb:/docker-entrypoint-initdb.d restart: unless-stopped networks: - dolphinscheduler dolphinscheduler-zookeeper: image: bitnami/zookeeper:latest container_name: dolphinscheduler-zookeeper ports: - 2181:2181 environment: TZ: Asia/Shanghai ALLOW_ANONYMOUS_LOGIN: "yes" ZOO_4LW_COMMANDS_WHITELIST: srvr,ruok,wchs,cons volumes: - dolphinscheduler-zookeeper:/bitnami/zookeeper restart: unless-stopped networks: - dolphinscheduler dolphinscheduler-api: image: apache/dolphinscheduler:latest container_name: dolphinscheduler-api command: api-server ports: - 12345:12345 environment: TZ: Asia/Shanghai DOLPHINSCHEDULER_OPTS: "-Xms512m -Xmx512m -Xmn256m" DATABASE_TYPE: postgresql DATABASE_DRIVER: org.postgresql.Driver DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler DATABASE_PARAMS: characterEncoding=utf8 ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 RESOURCE_STORAGE_TYPE: HDFS RESOURCE_UPLOAD_PATH: /dolphinscheduler FS_DEFAULT_FS: file:/// healthcheck: test: ["CMD", "/root/checkpoint.sh", "ApiApplicationServer"] interval: 30s timeout: 5s retries: 3 depends_on: - dolphinscheduler-postgresql - dolphinscheduler-zookeeper volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs - dolphinscheduler-resource-local:/dolphinscheduler restart: unless-stopped networks: - dolphinscheduler dolphinscheduler-alert: image: apache/dolphinscheduler:latest container_name: dolphinscheduler-alert command: alert-server ports: - 50052:50052 environment: TZ: Asia/Shanghai ALERT_PLUGIN_DIR: lib/plugin/alert DOLPHINSCHEDULER_OPTS: "-Xms512m -Xmx512m -Xmn256m" DATABASE_TYPE: postgresql DATABASE_DRIVER: org.postgresql.Driver DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler DATABASE_PARAMS: characterEncoding=utf8 healthcheck: test: ["CMD", "/root/checkpoint.sh", "AlertServer"] interval: 30s timeout: 5s retries: 3 depends_on: - dolphinscheduler-postgresql volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs restart: unless-stopped networks: - dolphinscheduler dolphinscheduler-master: image: apache/dolphinscheduler:latest container_name: dolphinscheduler-master command: master-server ports: - 5678:5678 environment: TZ: Asia/Shanghai MASTER_EXEC_THREADS: "100" MASTER_EXEC_TASK_NUM: "20" MASTER_HEARTBEAT_INTERVAL: "10" MASTER_TASK_COMMIT_RETRYTIMES: "5" MASTER_TASK_COMMIT_INTERVAL: "1000" MASTER_MAX_CPULOAD_AVG: "100" MASTER_RESERVED_MEMORY: "0.1" DOLPHINSCHEDULER_DATA_BASEDIR_PATH: /tmp/dolphinscheduler DOLPHINSCHEDULER_OPTS: "-Xms1g -Xmx1g -Xmn512m" DATABASE_TYPE: postgresql DATABASE_DRIVER: org.postgresql.Driver DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler DATABASE_PARAMS: characterEncoding=utf8 ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 healthcheck: test: ["CMD", "/root/checkpoint.sh", "MasterServer"] interval: 30s timeout: 5s retries: 3 depends_on: - dolphinscheduler-postgresql - dolphinscheduler-zookeeper volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs restart: unless-stopped networks: - dolphinscheduler dolphinscheduler-worker: image: apache/dolphinscheduler:latest container_name: dolphinscheduler-worker command: worker-server ports: - 1234:1234 - 50051:50051 environment: TZ: Asia/Shanghai WORKER_EXEC_THREADS: "100" WORKER_HEARTBEAT_INTERVAL: "10" WORKER_MAX_CPULOAD_AVG: "100" WORKER_RESERVED_MEMORY: "0.1" WORKER_GROUPS: "default" WORKER_HOST_WEIGHT: "100" ALERT_LISTEN_HOST: dolphinscheduler-alert HADOOP_HOME: "/opt/soft/hadoop" HADOOP_CONF_DIR: "/opt/soft/hadoop/etc/hadoop" SPARK_HOME1: "/opt/soft/spark1" SPARK_HOME2: "/opt/soft/spark2" PYTHON_HOME: "/usr/bin/python" JAVA_HOME: "/usr/lib/jvm/java-1.8-openjdk" HIVE_HOME: "/opt/soft/hive" FLINK_HOME: "/opt/soft/flink" DATAX_HOME: "/opt/soft/datax/bin/datax.py" DOLPHINSCHEDULER_DATA_BASEDIR_PATH: /tmp/dolphinscheduler DOLPHINSCHEDULER_OPTS: "-Xms1g -Xmx1g -Xmn512m" DATABASE_TYPE: postgresql DATABASE_DRIVER: org.postgresql.Driver DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler DATABASE_PARAMS: characterEncoding=utf8 ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 RESOURCE_STORAGE_TYPE: HDFS RESOURCE_UPLOAD_PATH: /dolphinscheduler FS_DEFAULT_FS: file:/// healthcheck: test: ["CMD", "/root/checkpoint.sh", "WorkerServer"] interval: 30s timeout: 5s retries: 3 depends_on: - dolphinscheduler-postgresql - dolphinscheduler-zookeeper volumes: - dolphinscheduler-worker-data:/tmp/dolphinscheduler - dolphinscheduler-logs:/opt/dolphinscheduler/logs - dolphinscheduler-resource-local:/dolphinscheduler restart: unless-stopped networks: - dolphinscheduler networks: dolphinscheduler: driver: bridge volumes: dolphinscheduler-postgresql: dolphinscheduler-postgresql-initdb: dolphinscheduler-zookeeper: dolphinscheduler-worker-data: dolphinscheduler-logs: dolphinscheduler-resource-local:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,024
[Improvement][Worker] Python Command
In general, the home is the directory where the software is installed,but the commandInterpreter method use the Python home directory in PythonCommandExecutor.java, which is in the environment variable configuration file needs to be configured PYTHON_HOME to PYTHON_HOME/bin/Python. Obviously, this is unreasonable and misleading **Describe alternatives you've considered** ```java /** * get python home * * @return python home */ @Override protected String commandInterpreter() { String pythonHome = getPythonHome(taskExecutionContext.getEnvFile()); if (StringUtils.isEmpty(pythonHome)) { return PYTHON; } -- return pythonHome ++ return pythonHome + "/bin/python"; } ``` [dev]
https://github.com/apache/dolphinscheduler/issues/5024
https://github.com/apache/dolphinscheduler/pull/5036
a3153b5e44d40cceea6e705f2406c4a4ec5f99c9
2d8c4ec86bdc8d00baee4066f40699078735c5dc
"2021-03-10T02:12:24Z"
java
"2021-03-15T02:22:13Z"
docker/docker-swarm/docker-stack.yml
# 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. version: "3.1" services: dolphinscheduler-postgresql: image: bitnami/postgresql:latest ports: - 5432:5432 environment: TZ: Asia/Shanghai POSTGRESQL_USERNAME: root POSTGRESQL_PASSWORD: root POSTGRESQL_DATABASE: dolphinscheduler volumes: - dolphinscheduler-postgresql:/bitnami/postgresql networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-zookeeper: image: bitnami/zookeeper:latest ports: - 2181:2181 environment: TZ: Asia/Shanghai ALLOW_ANONYMOUS_LOGIN: "yes" ZOO_4LW_COMMANDS_WHITELIST: srvr,ruok,wchs,cons volumes: - dolphinscheduler-zookeeper:/bitnami/zookeeper networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-api: image: apache/dolphinscheduler:latest command: api-server ports: - 12345:12345 environment: TZ: Asia/Shanghai DOLPHINSCHEDULER_OPTS: "-Xms512m -Xmx512m -Xmn256m" DATABASE_TYPE: postgresql DATABASE_DRIVER: org.postgresql.Driver DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler DATABASE_PARAMS: characterEncoding=utf8 ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 RESOURCE_STORAGE_TYPE: HDFS RESOURCE_UPLOAD_PATH: /dolphinscheduler FS_DEFAULT_FS: file:/// healthcheck: test: ["CMD", "/root/checkpoint.sh", "ApiApplicationServer"] interval: 30s timeout: 5s retries: 3 volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-alert: image: apache/dolphinscheduler:latest command: alert-server ports: - 50052:50052 environment: TZ: Asia/Shanghai ALERT_PLUGIN_DIR: lib/plugin/alert DOLPHINSCHEDULER_OPTS: "-Xms512m -Xmx512m -Xmn256m" DATABASE_TYPE: postgresql DATABASE_DRIVER: org.postgresql.Driver DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler DATABASE_PARAMS: characterEncoding=utf8 healthcheck: test: ["CMD", "/root/checkpoint.sh", "AlertServer"] interval: 30s timeout: 5s retries: 3 volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-master: image: apache/dolphinscheduler:latest command: master-server ports: - 5678:5678 environment: TZ: Asia/Shanghai MASTER_EXEC_THREADS: "100" MASTER_EXEC_TASK_NUM: "20" MASTER_HEARTBEAT_INTERVAL: "10" MASTER_TASK_COMMIT_RETRYTIMES: "5" MASTER_TASK_COMMIT_INTERVAL: "1000" MASTER_MAX_CPULOAD_AVG: "100" MASTER_RESERVED_MEMORY: "0.1" DOLPHINSCHEDULER_DATA_BASEDIR_PATH: /tmp/dolphinscheduler DOLPHINSCHEDULER_OPTS: "-Xms1g -Xmx1g -Xmn512m" DATABASE_TYPE: postgresql DATABASE_DRIVER: org.postgresql.Driver DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler DATABASE_PARAMS: characterEncoding=utf8 ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 healthcheck: test: ["CMD", "/root/checkpoint.sh", "MasterServer"] interval: 30s timeout: 5s retries: 3 volumes: - dolphinscheduler-logs:/opt/dolphinscheduler/logs networks: - dolphinscheduler deploy: mode: replicated replicas: 1 dolphinscheduler-worker: image: apache/dolphinscheduler:latest command: worker-server ports: - 1234:1234 - 50051:50051 environment: TZ: Asia/Shanghai WORKER_EXEC_THREADS: "100" WORKER_HEARTBEAT_INTERVAL: "10" WORKER_MAX_CPULOAD_AVG: "100" WORKER_RESERVED_MEMORY: "0.1" WORKER_GROUPS: "default" WORKER_HOST_WEIGHT: "100" ALERT_LISTEN_HOST: dolphinscheduler-alert HADOOP_HOME: "/opt/soft/hadoop" HADOOP_CONF_DIR: "/opt/soft/hadoop/etc/hadoop" SPARK_HOME1: "/opt/soft/spark1" SPARK_HOME2: "/opt/soft/spark2" PYTHON_HOME: "/usr/bin/python" JAVA_HOME: "/usr/lib/jvm/java-1.8-openjdk" HIVE_HOME: "/opt/soft/hive" FLINK_HOME: "/opt/soft/flink" DATAX_HOME: "/opt/soft/datax/bin/datax.py" DOLPHINSCHEDULER_DATA_BASEDIR_PATH: /tmp/dolphinscheduler DOLPHINSCHEDULER_OPTS: "-Xms1g -Xmx1g -Xmn512m" DATABASE_TYPE: postgresql DATABASE_DRIVER: org.postgresql.Driver DATABASE_HOST: dolphinscheduler-postgresql DATABASE_PORT: 5432 DATABASE_USERNAME: root DATABASE_PASSWORD: root DATABASE_DATABASE: dolphinscheduler DATABASE_PARAMS: characterEncoding=utf8 ZOOKEEPER_QUORUM: dolphinscheduler-zookeeper:2181 RESOURCE_STORAGE_TYPE: HDFS RESOURCE_UPLOAD_PATH: /dolphinscheduler FS_DEFAULT_FS: file:/// healthcheck: test: ["CMD", "/root/checkpoint.sh", "WorkerServer"] interval: 30s timeout: 5s retries: 3 volumes: - dolphinscheduler-worker-data:/tmp/dolphinscheduler - dolphinscheduler-logs:/opt/dolphinscheduler/logs networks: - dolphinscheduler deploy: mode: replicated replicas: 1 networks: dolphinscheduler: driver: overlay volumes: dolphinscheduler-postgresql: dolphinscheduler-zookeeper: dolphinscheduler-worker-data: dolphinscheduler-logs:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,024
[Improvement][Worker] Python Command
In general, the home is the directory where the software is installed,but the commandInterpreter method use the Python home directory in PythonCommandExecutor.java, which is in the environment variable configuration file needs to be configured PYTHON_HOME to PYTHON_HOME/bin/Python. Obviously, this is unreasonable and misleading **Describe alternatives you've considered** ```java /** * get python home * * @return python home */ @Override protected String commandInterpreter() { String pythonHome = getPythonHome(taskExecutionContext.getEnvFile()); if (StringUtils.isEmpty(pythonHome)) { return PYTHON; } -- return pythonHome ++ return pythonHome + "/bin/python"; } ``` [dev]
https://github.com/apache/dolphinscheduler/issues/5024
https://github.com/apache/dolphinscheduler/pull/5036
a3153b5e44d40cceea6e705f2406c4a4ec5f99c9
2d8c4ec86bdc8d00baee4066f40699078735c5dc
"2021-03-10T02:12:24Z"
java
"2021-03-15T02:22:13Z"
docker/kubernetes/dolphinscheduler/values.yaml
# # 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. # # Default values for dolphinscheduler-chart. # This is a YAML-formatted file. # Declare variables to be passed into your templates. timezone: "Asia/Shanghai" image: repository: "apache/dolphinscheduler" tag: "latest" pullPolicy: "IfNotPresent" pullSecret: "" ## If not exists external database, by default, Dolphinscheduler's database will use it. postgresql: enabled: true postgresqlUsername: "root" postgresqlPassword: "root" postgresqlDatabase: "dolphinscheduler" persistence: enabled: false size: "20Gi" storageClass: "-" ## If exists external database, and set postgresql.enable value to false. ## external database will be used, otherwise Dolphinscheduler's database will be used. externalDatabase: type: "postgresql" driver: "org.postgresql.Driver" host: "localhost" port: "5432" username: "root" password: "root" database: "dolphinscheduler" params: "characterEncoding=utf8" ## If not exists external zookeeper, by default, Dolphinscheduler's zookeeper will use it. zookeeper: enabled: true fourlwCommandsWhitelist: "srvr,ruok,wchs,cons" service: port: "2181" persistence: enabled: false size: "20Gi" storageClass: "-" zookeeperRoot: "/dolphinscheduler" ## If exists external zookeeper, and set zookeeper.enable value to false. ## If zookeeper.enable is false, Dolphinscheduler's zookeeper will use it. externalZookeeper: zookeeperQuorum: "127.0.0.1:2181" zookeeperRoot: "/dolphinscheduler" common: ## ConfigMap configmap: DOLPHINSCHEDULER_ENV: - "export HADOOP_HOME=/opt/soft/hadoop" - "export HADOOP_CONF_DIR=/opt/soft/hadoop/etc/hadoop" - "export SPARK_HOME1=/opt/soft/spark1" - "export SPARK_HOME2=/opt/soft/spark2" - "export PYTHON_HOME=/usr/bin/python" - "export JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk" - "export HIVE_HOME=/opt/soft/hive" - "export FLINK_HOME=/opt/soft/flink" - "export DATAX_HOME=/opt/soft/datax/bin/datax.py" - "export PATH=$HADOOP_HOME/bin:$SPARK_HOME1/bin:$SPARK_HOME2/bin:$PYTHON_HOME:$JAVA_HOME/bin:$HIVE_HOME/bin:$FLINK_HOME/bin:$PATH" DOLPHINSCHEDULER_DATA_BASEDIR_PATH: "/tmp/dolphinscheduler" RESOURCE_STORAGE_TYPE: "HDFS" RESOURCE_UPLOAD_PATH: "/dolphinscheduler" FS_DEFAULT_FS: "file:///" FS_S3A_ENDPOINT: "s3.xxx.amazonaws.com" FS_S3A_ACCESS_KEY: "xxxxxxx" FS_S3A_SECRET_KEY: "xxxxxxx" ## If RESOURCE_STORAGE_TYPE is HDFS and FS_DEFAULT_FS is file:///, fsFileResourcePersistence should be enabled for resource storage fsFileResourcePersistence: enabled: false accessModes: - "ReadWriteMany" ## storageClassName must support the access mode: ReadWriteMany storageClassName: "-" storage: "20Gi" master: ## PodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. podManagementPolicy: "Parallel" ## Replicas is the desired number of replicas of the given Template. replicas: "3" ## You can use annotations to attach arbitrary non-identifying metadata to objects. ## Clients such as tools and libraries can retrieve this metadata. annotations: {} ## Affinity is a group of affinity scheduling rules. If specified, the pod's scheduling constraints. ## More info: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#affinity-v1-core affinity: {} ## NodeSelector is a selector which must be true for the pod to fit on a node. ## Selector which must match a node's labels for the pod to be scheduled on that node. ## More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ nodeSelector: {} ## Tolerations are appended (excluding duplicates) to pods running with this RuntimeClass during admission, ## effectively unioning the set of nodes tolerated by the pod and the RuntimeClass. tolerations: [] ## Compute Resources required by this container. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container resources: {} # resources: # limits: # memory: "8Gi" # cpu: "4" # requests: # memory: "2Gi" # cpu: "500m" ## ConfigMap configmap: DOLPHINSCHEDULER_OPTS: "" MASTER_EXEC_THREADS: "100" MASTER_EXEC_TASK_NUM: "20" MASTER_HEARTBEAT_INTERVAL: "10" MASTER_TASK_COMMIT_RETRYTIMES: "5" MASTER_TASK_COMMIT_INTERVAL: "1000" MASTER_MAX_CPULOAD_AVG: "100" MASTER_RESERVED_MEMORY: "0.1" MASTER_LISTEN_PORT: "5678" ## Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes livenessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes readinessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## PersistentVolumeClaim represents a reference to a PersistentVolumeClaim in the same namespace. ## The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. ## Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. ## A claim in this list takes precedence over any volumes in the template, with the same name. persistentVolumeClaim: enabled: false accessModes: - "ReadWriteOnce" storageClassName: "-" storage: "20Gi" worker: ## PodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. podManagementPolicy: "Parallel" ## Replicas is the desired number of replicas of the given Template. replicas: "3" ## You can use annotations to attach arbitrary non-identifying metadata to objects. ## Clients such as tools and libraries can retrieve this metadata. annotations: {} ## Affinity is a group of affinity scheduling rules. If specified, the pod's scheduling constraints. ## More info: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#affinity-v1-core affinity: {} ## NodeSelector is a selector which must be true for the pod to fit on a node. ## Selector which must match a node's labels for the pod to be scheduled on that node. ## More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ nodeSelector: {} ## Tolerations are appended (excluding duplicates) to pods running with this RuntimeClass during admission, ## effectively unioning the set of nodes tolerated by the pod and the RuntimeClass. tolerations: [] ## Compute Resources required by this container. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container resources: {} # resources: # limits: # memory: "8Gi" # cpu: "4" # requests: # memory: "2Gi" # cpu: "500m" ## ConfigMap configmap: DOLPHINSCHEDULER_OPTS: "" WORKER_EXEC_THREADS: "100" WORKER_HEARTBEAT_INTERVAL: "10" WORKER_MAX_CPULOAD_AVG: "100" WORKER_RESERVED_MEMORY: "0.1" WORKER_LISTEN_PORT: "1234" WORKER_GROUPS: "default" WORKER_HOST_WEIGHT: "100" ## Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes livenessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes readinessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## PersistentVolumeClaim represents a reference to a PersistentVolumeClaim in the same namespace. ## The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. ## Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. ## A claim in this list takes precedence over any volumes in the template, with the same name. persistentVolumeClaim: enabled: false ## dolphinscheduler data volume dataPersistentVolume: enabled: false accessModes: - "ReadWriteOnce" storageClassName: "-" storage: "20Gi" ## dolphinscheduler logs volume logsPersistentVolume: enabled: false accessModes: - "ReadWriteOnce" storageClassName: "-" storage: "20Gi" alert: ## Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1. replicas: "1" ## The deployment strategy to use to replace existing pods with new ones. strategy: type: "RollingUpdate" rollingUpdate: maxSurge: "25%" maxUnavailable: "25%" ## You can use annotations to attach arbitrary non-identifying metadata to objects. ## Clients such as tools and libraries can retrieve this metadata. annotations: {} ## NodeSelector is a selector which must be true for the pod to fit on a node. ## Selector which must match a node's labels for the pod to be scheduled on that node. ## More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ affinity: {} ## Compute Resources required by this container. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container nodeSelector: {} ## Tolerations are appended (excluding duplicates) to pods running with this RuntimeClass during admission, ## effectively unioning the set of nodes tolerated by the pod and the RuntimeClass. tolerations: [] ## Affinity is a group of affinity scheduling rules. If specified, the pod's scheduling constraints. ## More info: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#affinity-v1-core resources: {} # resources: # limits: # memory: "2Gi" # cpu: "1" # requests: # memory: "1Gi" # cpu: "500m" ## ConfigMap configmap: DOLPHINSCHEDULER_OPTS: "" ALERT_PLUGIN_DIR: "lib/plugin/alert" ## Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes livenessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes readinessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## PersistentVolumeClaim represents a reference to a PersistentVolumeClaim in the same namespace. ## More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims persistentVolumeClaim: enabled: false accessModes: - "ReadWriteOnce" storageClassName: "-" storage: "20Gi" api: ## Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1. replicas: "1" ## The deployment strategy to use to replace existing pods with new ones. strategy: type: "RollingUpdate" rollingUpdate: maxSurge: "25%" maxUnavailable: "25%" ## You can use annotations to attach arbitrary non-identifying metadata to objects. ## Clients such as tools and libraries can retrieve this metadata. annotations: {} ## NodeSelector is a selector which must be true for the pod to fit on a node. ## Selector which must match a node's labels for the pod to be scheduled on that node. ## More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ affinity: {} ## Compute Resources required by this container. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container nodeSelector: {} ## Tolerations are appended (excluding duplicates) to pods running with this RuntimeClass during admission, ## effectively unioning the set of nodes tolerated by the pod and the RuntimeClass. tolerations: [] ## Affinity is a group of affinity scheduling rules. If specified, the pod's scheduling constraints. ## More info: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#affinity-v1-core resources: {} # resources: # limits: # memory: "2Gi" # cpu: "1" # requests: # memory: "1Gi" # cpu: "500m" ## ConfigMap configmap: DOLPHINSCHEDULER_OPTS: "" ## Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes livenessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes readinessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## PersistentVolumeClaim represents a reference to a PersistentVolumeClaim in the same namespace. ## More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims persistentVolumeClaim: enabled: false accessModes: - "ReadWriteOnce" storageClassName: "-" storage: "20Gi" ingress: enabled: false host: "dolphinscheduler.org" path: "/dolphinscheduler" tls: enabled: false secretName: "dolphinscheduler-tls"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,024
[Improvement][Worker] Python Command
In general, the home is the directory where the software is installed,but the commandInterpreter method use the Python home directory in PythonCommandExecutor.java, which is in the environment variable configuration file needs to be configured PYTHON_HOME to PYTHON_HOME/bin/Python. Obviously, this is unreasonable and misleading **Describe alternatives you've considered** ```java /** * get python home * * @return python home */ @Override protected String commandInterpreter() { String pythonHome = getPythonHome(taskExecutionContext.getEnvFile()); if (StringUtils.isEmpty(pythonHome)) { return PYTHON; } -- return pythonHome ++ return pythonHome + "/bin/python"; } ``` [dev]
https://github.com/apache/dolphinscheduler/issues/5024
https://github.com/apache/dolphinscheduler/pull/5036
a3153b5e44d40cceea6e705f2406c4a4ec5f99c9
2d8c4ec86bdc8d00baee4066f40699078735c5dc
"2021-03-10T02:12:24Z"
java
"2021-03-15T02:22:13Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/PythonCommandExecutor.java
/* * 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.dolphinscheduler.server.worker.task; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.utils.FileUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.*; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.function.Consumer; /** * python command executor */ public class PythonCommandExecutor extends AbstractCommandExecutor { /** * logger */ private static final Logger logger = LoggerFactory.getLogger(PythonCommandExecutor.class); /** * python */ public static final String PYTHON = "python"; /** * constructor * @param logHandler log handler * @param taskExecutionContext taskExecutionContext * @param logger logger */ public PythonCommandExecutor(Consumer<List<String>> logHandler, TaskExecutionContext taskExecutionContext, Logger logger) { super(logHandler,taskExecutionContext,logger); } /** * build command file path * * @return command file path */ @Override protected String buildCommandFilePath() { return String.format("%s/py_%s.command", taskExecutionContext.getExecutePath(), taskExecutionContext.getTaskAppId()); } /** * create command file if not exists * @param execCommand exec command * @param commandFile command file * @throws IOException io exception */ @Override protected void createCommandFileIfNotExists(String execCommand, String commandFile) throws IOException { logger.info("tenantCode :{}, task dir:{}", taskExecutionContext.getTenantCode(), taskExecutionContext.getExecutePath()); if (!Files.exists(Paths.get(commandFile))) { logger.info("generate command file:{}", commandFile); StringBuilder sb = new StringBuilder(); sb.append("#-*- encoding=utf8 -*-\n"); sb.append("\n\n"); sb.append(execCommand); logger.info(sb.toString()); // write data to file FileUtils.writeStringToFile(new File(commandFile), sb.toString(), StandardCharsets.UTF_8); } } /** * get command options * @return command options list */ @Override protected List<String> commandOptions() { // unbuffered binary stdout and stderr return Collections.singletonList("-u"); } /** * get python home * @return python home */ @Override protected String commandInterpreter() { String pythonHome = getPythonHome(taskExecutionContext.getEnvFile()); if (StringUtils.isEmpty(pythonHome)){ return PYTHON; } return pythonHome; } /** * get the absolute path of the Python command * note : * common.properties * PYTHON_HOME configured under common.properties is Python absolute path, not PYTHON_HOME itself * * for example : * your PYTHON_HOM is /opt/python3.7/ * you must set PYTHON_HOME is /opt/python3.7/python under nder common.properties * dolphinscheduler.env.path file. * * @param envPath env path * @return python home */ private static String getPythonHome(String envPath){ BufferedReader br = null; StringBuilder sb = new StringBuilder(); try { br = new BufferedReader(new InputStreamReader(new FileInputStream(envPath))); String line; while ((line = br.readLine()) != null){ if (line.contains(Constants.PYTHON_HOME)){ sb.append(line); break; } } String result = sb.toString(); if (org.apache.commons.lang.StringUtils.isEmpty(result)){ return null; } String[] arrs = result.split(Constants.EQUAL_SIGN); if (arrs.length == 2){ return arrs[1]; } }catch (IOException e){ logger.error("read file failure",e); }finally { try { if (br != null){ br.close(); } } catch (IOException e) { logger.error(e.getMessage(),e); } } return null; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,024
[Improvement][Worker] Python Command
In general, the home is the directory where the software is installed,but the commandInterpreter method use the Python home directory in PythonCommandExecutor.java, which is in the environment variable configuration file needs to be configured PYTHON_HOME to PYTHON_HOME/bin/Python. Obviously, this is unreasonable and misleading **Describe alternatives you've considered** ```java /** * get python home * * @return python home */ @Override protected String commandInterpreter() { String pythonHome = getPythonHome(taskExecutionContext.getEnvFile()); if (StringUtils.isEmpty(pythonHome)) { return PYTHON; } -- return pythonHome ++ return pythonHome + "/bin/python"; } ``` [dev]
https://github.com/apache/dolphinscheduler/issues/5024
https://github.com/apache/dolphinscheduler/pull/5036
a3153b5e44d40cceea6e705f2406c4a4ec5f99c9
2d8c4ec86bdc8d00baee4066f40699078735c5dc
"2021-03-10T02:12:24Z"
java
"2021-03-15T02:22:13Z"
dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/EnvFileTest.java
/* * 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.dolphinscheduler.server.worker; import org.apache.dolphinscheduler.common.utils.StringUtils; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class EnvFileTest { private static final Logger logger = LoggerFactory.getLogger(EnvFileTest.class); @Test public void test() { String path = System.getProperty("user.dir")+"/script/env/dolphinscheduler_env.sh"; String pythonHome = getPythonHome(path); logger.info(pythonHome); } /** * get python home * @param path * @return */ private static String getPythonHome(String path){ BufferedReader br = null; String line = null; StringBuilder sb = new StringBuilder(); try { br = new BufferedReader(new InputStreamReader(new FileInputStream(path))); while ((line = br.readLine()) != null){ if (line.contains("PYTHON_HOME")){ sb.append(line); break; } } String result = sb.toString(); if (StringUtils.isEmpty(result)){ return null; } String[] arrs = result.split("="); if (arrs.length == 2){ return arrs[1]; } }catch (IOException e){ logger.error("read file failed",e); }finally { try { if (br != null){ br.close(); } } catch (IOException e) { logger.error(e.getMessage(),e); } } return null; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,024
[Improvement][Worker] Python Command
In general, the home is the directory where the software is installed,but the commandInterpreter method use the Python home directory in PythonCommandExecutor.java, which is in the environment variable configuration file needs to be configured PYTHON_HOME to PYTHON_HOME/bin/Python. Obviously, this is unreasonable and misleading **Describe alternatives you've considered** ```java /** * get python home * * @return python home */ @Override protected String commandInterpreter() { String pythonHome = getPythonHome(taskExecutionContext.getEnvFile()); if (StringUtils.isEmpty(pythonHome)) { return PYTHON; } -- return pythonHome ++ return pythonHome + "/bin/python"; } ``` [dev]
https://github.com/apache/dolphinscheduler/issues/5024
https://github.com/apache/dolphinscheduler/pull/5036
a3153b5e44d40cceea6e705f2406c4a4ec5f99c9
2d8c4ec86bdc8d00baee4066f40699078735c5dc
"2021-03-10T02:12:24Z"
java
"2021-03-15T02:22:13Z"
script/env/dolphinscheduler_env.sh
# # 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. # export HADOOP_HOME=/opt/soft/hadoop export HADOOP_CONF_DIR=/opt/soft/hadoop/etc/hadoop export SPARK_HOME1=/opt/soft/spark1 export SPARK_HOME2=/opt/soft/spark2 export PYTHON_HOME=/opt/soft/python export JAVA_HOME=/opt/soft/java export HIVE_HOME=/opt/soft/hive export FLINK_HOME=/opt/soft/flink export DATAX_HOME=/opt/soft/datax/bin/datax.py export PATH=$HADOOP_HOME/bin:$SPARK_HOME1/bin:$SPARK_HOME2/bin:$PYTHON_HOME:$JAVA_HOME/bin:$HIVE_HOME/bin:$PATH:$FLINK_HOME/bin:$DATAX_HOME:$PATH
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,071
[Bug][Server] When setting value on shell script, it not working on the next task node.
**When setting value on shell script, it not working on the next task node.** If using `${setValue(key, value)}` function in the shell task, it needs to share the `key` to the process instance. but now, it's not working. **Which version of Dolphin Scheduler:** - [current dev branch]
https://github.com/apache/dolphinscheduler/issues/5071
https://github.com/apache/dolphinscheduler/pull/5067
6bf5031f455a930488ab58bb15c108cab80425a4
0ba120e8ab80d4687685837f6aa52460e7201813
"2021-03-16T13:51:01Z"
java
"2021-03-16T13:56:05Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/shell/ShellTask.java
/* * 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.dolphinscheduler.server.worker.task.shell; import static java.util.Calendar.DAY_OF_MONTH; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.Direct; import org.apache.dolphinscheduler.common.process.Property; import org.apache.dolphinscheduler.common.task.AbstractParameters; import org.apache.dolphinscheduler.common.task.shell.ShellParameters; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.ParameterUtils; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.server.utils.ParamUtils; import org.apache.dolphinscheduler.server.worker.task.AbstractTask; import org.apache.dolphinscheduler.server.worker.task.CommandExecuteResult; import org.apache.dolphinscheduler.server.worker.task.ShellCommandExecutor; import org.slf4j.Logger; import java.io.File; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardOpenOption; import java.nio.file.attribute.FileAttribute; import java.nio.file.attribute.PosixFilePermission; import java.nio.file.attribute.PosixFilePermissions; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; /** * shell task */ public class ShellTask extends AbstractTask { /** * shell parameters */ private ShellParameters shellParameters; /** * shell command executor */ private ShellCommandExecutor shellCommandExecutor; /** * taskExecutionContext */ private TaskExecutionContext taskExecutionContext; /** * constructor * * @param taskExecutionContext taskExecutionContext * @param logger logger */ public ShellTask(TaskExecutionContext taskExecutionContext, Logger logger) { super(taskExecutionContext, logger); this.taskExecutionContext = taskExecutionContext; this.shellCommandExecutor = new ShellCommandExecutor(this::logHandle, taskExecutionContext, logger); } @Override public void init() { logger.info("shell task params {}", taskExecutionContext.getTaskParams()); shellParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), ShellParameters.class); if (!shellParameters.checkParameters()) { throw new RuntimeException("shell task params is not valid"); } } @Override public void handle() throws Exception { try { // construct process CommandExecuteResult commandExecuteResult = shellCommandExecutor.run(buildCommand()); setExitStatusCode(commandExecuteResult.getExitStatusCode()); setAppIds(commandExecuteResult.getAppIds()); setProcessId(commandExecuteResult.getProcessId()); setResult(shellCommandExecutor.getTaskResultString()); } catch (Exception e) { logger.error("shell task error", e); setExitStatusCode(Constants.EXIT_CODE_FAILURE); throw e; } } @Override public void cancelApplication(boolean cancelApplication) throws Exception { // cancel process shellCommandExecutor.cancelApplication(); } /** * create command * * @return file name * @throws Exception exception */ private String buildCommand() throws Exception { // generate scripts String fileName = String.format("%s/%s_node.%s", taskExecutionContext.getExecutePath(), taskExecutionContext.getTaskAppId(), OSUtils.isWindows() ? "bat" : "sh"); Path path = new File(fileName).toPath(); if (Files.exists(path)) { return fileName; } String script = shellParameters.getRawScript().replaceAll("\\r\\n", "\n"); script = parseScript(script); shellParameters.setRawScript(script); logger.info("raw script : {}", shellParameters.getRawScript()); logger.info("task execute path : {}", taskExecutionContext.getExecutePath()); Set<PosixFilePermission> perms = PosixFilePermissions.fromString(Constants.RWXR_XR_X); FileAttribute<Set<PosixFilePermission>> attr = PosixFilePermissions.asFileAttribute(perms); if (OSUtils.isWindows()) { Files.createFile(path); } else { Files.createFile(path, attr); } Files.write(path, shellParameters.getRawScript().getBytes(), StandardOpenOption.APPEND); return fileName; } @Override public AbstractParameters getParameters() { return shellParameters; } private String parseScript(String script) { // combining local and global parameters Map<String, Property> paramsMap = ParamUtils.convert(ParamUtils.getUserDefParamsMap(taskExecutionContext.getDefinedParams()), taskExecutionContext.getDefinedParams(), shellParameters.getLocalParametersMap(), CommandType.of(taskExecutionContext.getCmdTypeIfComplement()), taskExecutionContext.getScheduleTime()); // replace variable TIME with $[YYYYmmddd...] in shell file when history run job and batch complement job if (taskExecutionContext.getScheduleTime() != null) { if (paramsMap == null) { paramsMap = new HashMap<>(); } Date date = taskExecutionContext.getScheduleTime(); if (CommandType.COMPLEMENT_DATA.getCode() == taskExecutionContext.getCmdTypeIfComplement()) { date = DateUtils.add(taskExecutionContext.getScheduleTime(), DAY_OF_MONTH, 1); } String dateTime = DateUtils.format(date, Constants.PARAMETER_FORMAT_TIME); Property p = new Property(); p.setValue(dateTime); p.setProp(Constants.PARAMETER_DATETIME); paramsMap.put(Constants.PARAMETER_DATETIME, p); } return ParameterUtils.convertParameterPlaceholders(script, ParamUtils.convert(paramsMap)); } public void setResult(String result) { Map<String, Property> localParams = shellParameters.getLocalParametersMap(); List<Map<String, String>> outProperties = new ArrayList<>(); Map<String, String> p = new HashMap<>(); localParams.forEach((k,v) -> { if (v.getDirect() == Direct.OUT) { p.put(k, result); } }); outProperties.add(p); resultString = JSONUtils.toJsonString(outProperties); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java
/* * 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.dolphinscheduler.alert; import static org.apache.dolphinscheduler.common.Constants.ALERT_RPC_PORT; import org.apache.dolphinscheduler.alert.plugin.AlertPluginManager; import org.apache.dolphinscheduler.common.plugin.DolphinPluginLoader; import org.apache.dolphinscheduler.common.plugin.DolphinPluginManagerConfig; import org.apache.dolphinscheduler.alert.processor.AlertRequestProcessor; import org.apache.dolphinscheduler.alert.runner.AlertSender; import org.apache.dolphinscheduler.alert.utils.Constants; import org.apache.dolphinscheduler.alert.utils.PropertyUtils; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.dao.AlertDao; import org.apache.dolphinscheduler.dao.DaoFactory; import org.apache.dolphinscheduler.dao.entity.Alert; import org.apache.dolphinscheduler.remote.NettyRemotingServer; import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.config.NettyServerConfig; import org.apache.dolphinscheduler.spi.utils.StringUtils; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.ImmutableList; /** * alert of start */ public class AlertServer { private static final Logger logger = LoggerFactory.getLogger(AlertServer.class); /** * Alert Dao */ private AlertDao alertDao = DaoFactory.getDaoInstance(AlertDao.class); private AlertSender alertSender; private static AlertServer instance; private AlertPluginManager alertPluginManager; private DolphinPluginManagerConfig alertPluginManagerConfig; public static final String ALERT_PLUGIN_BINDING = "alert.plugin.binding"; public static final String ALERT_PLUGIN_DIR = "alert.plugin.dir"; public static final String MAVEN_LOCAL_REPOSITORY = "maven.local.repository"; /** * netty server */ private NettyRemotingServer server; private static class AlertServerHolder { private static final AlertServer INSTANCE = new AlertServer(); } public static final AlertServer getInstance() { return AlertServerHolder.INSTANCE; } private AlertServer() { } private void initPlugin() { alertPluginManager = new AlertPluginManager(); alertPluginManagerConfig = new DolphinPluginManagerConfig(); alertPluginManagerConfig.setPlugins(PropertyUtils.getString(ALERT_PLUGIN_BINDING)); if (StringUtils.isNotBlank(PropertyUtils.getString(ALERT_PLUGIN_DIR))) { alertPluginManagerConfig.setInstalledPluginsDir(PropertyUtils.getString(ALERT_PLUGIN_DIR, Constants.ALERT_PLUGIN_PATH).trim()); } if (StringUtils.isNotBlank(PropertyUtils.getString(MAVEN_LOCAL_REPOSITORY))) { alertPluginManagerConfig.setMavenLocalRepository(PropertyUtils.getString(MAVEN_LOCAL_REPOSITORY).trim()); } DolphinPluginLoader alertPluginLoader = new DolphinPluginLoader(alertPluginManagerConfig, ImmutableList.of(alertPluginManager)); try { alertPluginLoader.loadPlugins(); } catch (Exception e) { throw new RuntimeException("load Alert Plugin Failed !", e); } } /** * init netty remoting server */ private void initRemoteServer() { NettyServerConfig serverConfig = new NettyServerConfig(); serverConfig.setListenPort(ALERT_RPC_PORT); this.server = new NettyRemotingServer(serverConfig); this.server.registerProcessor(CommandType.ALERT_SEND_REQUEST, new AlertRequestProcessor(alertDao, alertPluginManager)); this.server.start(); } /** * Cyclic alert info sending alert */ private void runSender() { while (Stopper.isRunning()) { try { Thread.sleep(Constants.ALERT_SCAN_INTERVAL); } catch (InterruptedException e) { logger.error(e.getMessage(), e); Thread.currentThread().interrupt(); } if (alertPluginManager == null || alertPluginManager.getAlertChannelMap().size() == 0) { logger.warn("No Alert Plugin . Can not send alert info. "); } else { List<Alert> alerts = alertDao.listWaitExecutionAlert(); alertSender = new AlertSender(alerts, alertDao, alertPluginManager); alertSender.run(); } } } /** * start */ public void start() { initPlugin(); initRemoteServer(); logger.info("alert server ready start "); runSender(); } /** * stop */ public void stop() { this.server.close(); logger.info("alert server shut down"); } public static void main(String[] args) { AlertServer alertServer = AlertServer.getInstance(); alertServer.start(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { alertServer.stop(); } }); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/PropertyUtils.java
/* * 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.dolphinscheduler.alert.utils; import static org.apache.dolphinscheduler.alert.utils.Constants.ALERT_PROPERTIES_PATH; import org.apache.dolphinscheduler.common.utils.IOUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import java.util.regex.PatternSyntaxException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * property utils * single instance */ public class PropertyUtils { /** * logger */ private static final Logger logger = LoggerFactory.getLogger(PropertyUtils.class); private static final Properties properties = new Properties(); /** * init properties */ private static final PropertyUtils propertyUtils = new PropertyUtils(); private PropertyUtils() { init(); } private void init() { String[] propertyFiles = new String[]{ALERT_PROPERTIES_PATH}; for (String fileName : propertyFiles) { InputStream fis = null; try { fis = PropertyUtils.class.getResourceAsStream(fileName); properties.load(fis); } catch (IOException e) { logger.error(e.getMessage(), e); if (fis != null) { IOUtils.closeQuietly(fis); } System.exit(1); } finally { IOUtils.closeQuietly(fis); } } } /** * get property value * * @param key property name * @return the value */ public static String getString(String key) { if (StringUtils.isEmpty(key)) { return null; } return properties.getProperty(key.trim()); } /** * get property value * * @param key property name * @param defaultVal default value * @return property value */ public static String getString(String key, String defaultVal) { String val = properties.getProperty(key.trim()); return val == null ? defaultVal : val; } /** * get property value * * @param key property name * @return get property int value , if key == null, then return -1 */ public static int getInt(String key) { return getInt(key, -1); } /** * get int value * * @param key the key * @param defaultValue the default value * @return the value related the key or the default value if the key not existed */ public static int getInt(String key, int defaultValue) { String value = getString(key); if (value == null) { return defaultValue; } try { return Integer.parseInt(value); } catch (NumberFormatException e) { logger.info(e.getMessage(), e); } return defaultValue; } /** * get property value * * @param key property name * @return the boolean result value */ public static Boolean getBoolean(String key) { if (StringUtils.isEmpty(key)) { return false; } String value = properties.getProperty(key.trim()); if (null != value) { return Boolean.parseBoolean(value); } return false; } /** * get long value * * @param key the key * @return if the value not existed, return -1, or will return the related value */ public static long getLong(String key) { return getLong(key, -1); } /** * get long value * * @param key the key * @param defaultVal the default value * @return the value related the key or the default value if the key not existed */ public static long getLong(String key, long defaultVal) { String val = getString(key); if (val == null) { return defaultVal; } try { return Long.parseLong(val); } catch (NumberFormatException e) { logger.info(e.getMessage(), e); } return defaultVal; } /** * get double value * * @param key the key * @return if the value not existed, return -1.0, or will return the related value */ public static double getDouble(String key) { return getDouble(key, -1.0); } /** * get double value * * @param key the key * @param defaultVal the default value * @return the value related the key or the default value if the key not existed */ public static double getDouble(String key, double defaultVal) { String val = getString(key); if (val == null) { return defaultVal; } try { return Double.parseDouble(val); } catch (NumberFormatException e) { logger.info(e.getMessage(), e); } return defaultVal; } /** * get array * * @param key property name * @param splitStr separator * @return the result array */ public static String[] getArray(String key, String splitStr) { String value = getString(key); if (value == null || StringUtils.isEmpty(splitStr)) { return null; } try { return value.split(splitStr); } catch (PatternSyntaxException e) { logger.info(e.getMessage(), e); } return null; } /** * get enum * * @param key the key * @param type the class type * @param defaultValue the default value * @param <T> the generic class type * @return get enum value */ public static <T extends Enum<T>> T getEnum(String key, Class<T> type, T defaultValue) { String val = getString(key); if (val == null) { return defaultValue; } try { return Enum.valueOf(type, val); } catch (IllegalArgumentException e) { logger.info(e.getMessage(), e); } return defaultValue; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/AlertPluginManagerTest.java
/* * 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.dolphinscheduler.alert.plugin; import org.apache.dolphinscheduler.alert.AlertServer; import org.apache.dolphinscheduler.alert.utils.Constants; import org.apache.dolphinscheduler.alert.utils.PropertyUtils; import org.apache.dolphinscheduler.common.plugin.DolphinPluginLoader; import org.apache.dolphinscheduler.common.plugin.DolphinPluginManagerConfig; import org.apache.dolphinscheduler.spi.utils.StringUtils; import java.util.Objects; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.ImmutableList; /** * AlertPluginManager Tester. */ public class AlertPluginManagerTest { private static final Logger logger = LoggerFactory.getLogger(AlertPluginManagerTest.class); @Test public void testLoadPlugins() { logger.info("begin test AlertPluginManagerTest"); AlertPluginManager alertPluginManager = new AlertPluginManager(); DolphinPluginManagerConfig alertPluginManagerConfig = new DolphinPluginManagerConfig(); String path = Objects.requireNonNull(DolphinPluginLoader.class.getClassLoader().getResource("")).getPath(); alertPluginManagerConfig.setPlugins(path + "../../../dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml"); if (StringUtils.isNotBlank(PropertyUtils.getString(AlertServer.ALERT_PLUGIN_DIR))) { alertPluginManagerConfig.setInstalledPluginsDir(org.apache.dolphinscheduler.alert.utils.PropertyUtils.getString(AlertServer.ALERT_PLUGIN_DIR, Constants.ALERT_PLUGIN_PATH).trim()); } if (StringUtils.isNotBlank(PropertyUtils.getString(AlertServer.MAVEN_LOCAL_REPOSITORY))) { alertPluginManagerConfig.setMavenLocalRepository(Objects.requireNonNull(PropertyUtils.getString(AlertServer.MAVEN_LOCAL_REPOSITORY)).trim()); } DolphinPluginLoader alertPluginLoader = new DolphinPluginLoader(alertPluginManagerConfig, ImmutableList.of(alertPluginManager)); try { alertPluginLoader.loadPlugins(); } catch (Exception e) { throw new RuntimeException("load Alert Plugin Failed !", e); } Assert.assertNotNull(alertPluginManager.getAlertChannelFactoryMap().get("Email")); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java
/* * 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.dolphinscheduler.alert.plugin; import org.apache.dolphinscheduler.alert.AlertServer; import org.apache.dolphinscheduler.alert.runner.AlertSender; import org.apache.dolphinscheduler.alert.utils.Constants; import org.apache.dolphinscheduler.alert.utils.PropertyUtils; import org.apache.dolphinscheduler.common.enums.AlertStatus; import org.apache.dolphinscheduler.common.plugin.DolphinPluginLoader; import org.apache.dolphinscheduler.common.plugin.DolphinPluginManagerConfig; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.AlertDao; import org.apache.dolphinscheduler.dao.DaoFactory; import org.apache.dolphinscheduler.dao.PluginDao; import org.apache.dolphinscheduler.dao.entity.Alert; import org.apache.dolphinscheduler.dao.entity.AlertGroup; import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance; import org.apache.dolphinscheduler.dao.entity.PluginDefine; import org.apache.dolphinscheduler.spi.alert.AlertConstants; import org.apache.dolphinscheduler.spi.alert.ShowType; import org.apache.dolphinscheduler.spi.params.InputParam; import org.apache.dolphinscheduler.spi.params.PasswordParam; import org.apache.dolphinscheduler.spi.params.PluginParamsTransfer; import org.apache.dolphinscheduler.spi.params.RadioParam; import org.apache.dolphinscheduler.spi.params.base.DataType; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.utils.StringUtils; import java.util.ArrayList; import java.util.Date; import java.util.LinkedHashMap; import java.util.List; import org.junit.Assert; import org.junit.Test; import com.google.common.collect.ImmutableList; /** * test load and use alert plugin */ public class EmailAlertPluginTest { private AlertDao alertDao = DaoFactory.getDaoInstance(AlertDao.class); private PluginDao pluginDao = DaoFactory.getDaoInstance(PluginDao.class); @Test public void testRunSend() { //create alert group AlertGroup alertGroup = new AlertGroup(); alertGroup.setDescription("test alert group 1"); alertGroup.setGroupName("testalertg1"); alertDao.getAlertGroupMapper().insert(alertGroup); //add alert Alert alert1 = new Alert(); alert1.setTitle("test alert"); LinkedHashMap<String, Object> map1 = new LinkedHashMap<>(); map1.put("mysql service name", "mysql200"); map1.put("mysql address", "192.168.xx.xx"); map1.put("port", "3306"); map1.put(AlertConstants.SHOW_TYPE, ShowType.TEXT.getDescp()); map1.put("no index of number", "80"); map1.put("database client connections", "190"); LinkedHashMap<String, Object> map2 = new LinkedHashMap<>(); map2.put("mysql service name", "mysql210"); map2.put("mysql address", "192.168.xx.xx"); map2.put("port", "3306"); map2.put("no index of number", "10"); map1.put(AlertConstants.SHOW_TYPE, ShowType.TABLE.getDescp()); map2.put("database client connections", "90"); List<LinkedHashMap<String, Object>> maps = new ArrayList<>(); maps.add(0, map1); maps.add(1, map2); String mapjson = JSONUtils.toJsonString(maps); alert1.setContent(mapjson); alert1.setLog("log log"); alert1.setAlertGroupId(alertGroup.getId()); alertDao.addAlert(alert1); List<Alert> alertList = new ArrayList<>(); alertList.add(alert1); //load email alert plugin AlertPluginManager alertPluginManager = new AlertPluginManager(); DolphinPluginManagerConfig alertPluginManagerConfig = new DolphinPluginManagerConfig(); String path = DolphinPluginLoader.class.getClassLoader().getResource("").getPath(); alertPluginManagerConfig.setPlugins(path + "../../../dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml"); if (StringUtils.isNotBlank(PropertyUtils.getString(AlertServer.ALERT_PLUGIN_DIR))) { alertPluginManagerConfig.setInstalledPluginsDir(PropertyUtils.getString(AlertServer.ALERT_PLUGIN_DIR, Constants.ALERT_PLUGIN_PATH).trim()); } if (StringUtils.isNotBlank(PropertyUtils.getString(AlertServer.MAVEN_LOCAL_REPOSITORY))) { alertPluginManagerConfig.setMavenLocalRepository(PropertyUtils.getString(AlertServer.MAVEN_LOCAL_REPOSITORY).trim()); } DolphinPluginLoader alertPluginLoader = new DolphinPluginLoader(alertPluginManagerConfig, ImmutableList.of(alertPluginManager)); try { alertPluginLoader.loadPlugins(); } catch (Exception e) { throw new RuntimeException("load Alert Plugin Failed !", e); } //create email alert plugin instance AlertPluginInstance alertPluginInstance = new AlertPluginInstance(); alertPluginInstance.setCreateTime(new Date()); alertPluginInstance.setInstanceName("test email alert"); List<PluginDefine> pluginDefineList = pluginDao.getPluginDefineMapper().queryByNameAndType("Email", "alert"); if (pluginDefineList == null || pluginDefineList.size() == 0) { throw new RuntimeException("no alert plugin be load"); } PluginDefine pluginDefine = pluginDefineList.get(0); alertPluginInstance.setPluginDefineId(pluginDefine.getId()); alertPluginInstance.setPluginInstanceParams(getEmailAlertParams()); alertDao.getAlertPluginInstanceMapper().insert(alertPluginInstance); AlertSender alertSender = new AlertSender(alertList, alertDao, alertPluginManager); alertSender.run(); Alert alertResult = alertDao.getAlertMapper().selectById(alert1.getId()); Assert.assertNotNull(alertResult); Assert.assertEquals(alertResult.getAlertStatus(), AlertStatus.EXECUTION_FAILURE); alertDao.getAlertGroupMapper().deleteById(alertGroup.getId()); alertDao.getAlertPluginInstanceMapper().deleteById(alertPluginInstance.getId()); alertDao.getAlertMapper().deleteById(alert1.getId()); } public String getEmailAlertParams() { List<PluginParams> paramsList = new ArrayList<>(); InputParam receivesParam = InputParam.newBuilder("receivers", "receivers") .setValue("540957506@qq.com") .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); InputParam mailSmtpHost = InputParam.newBuilder("mailServerHost", "mail.smtp.host") .addValidate(Validate.newBuilder().setRequired(true).build()) .setValue("smtp.exmail.qq.com") .build(); InputParam mailSmtpPort = InputParam.newBuilder("mailServerPort", "mail.smtp.port") .addValidate(Validate.newBuilder() .setRequired(true) .setType(DataType.NUMBER.getDataType()) .build()) .setValue(25) .build(); InputParam mailSender = InputParam.newBuilder("mailSender", "mail.sender") .addValidate(Validate.newBuilder().setRequired(true).build()) .setValue("easyscheduler@analysys.com.cn") .build(); RadioParam enableSmtpAuth = RadioParam.newBuilder("enableSmtpAuth", "mail.smtp.auth") .addParamsOptions(new ParamsOptions("YES", true, false)) .addParamsOptions(new ParamsOptions("NO", false, false)) .addValidate(Validate.newBuilder().setRequired(true).build()) .setValue(true) .build(); InputParam mailUser = InputParam.newBuilder("mailUser", "mail.user") .setPlaceholder("if enable use authentication, you need input user") .setValue("easyscheduler@analysys.com.cn") .build(); PasswordParam mailPassword = PasswordParam.newBuilder("mailPasswd", "mail.passwd") .setPlaceholder("if enable use authentication, you need input password") .setValue("xxxxxxx") .build(); RadioParam enableTls = RadioParam.newBuilder("starttlsEnable", "mail.smtp.starttls.enable") .addParamsOptions(new ParamsOptions("YES", true, false)) .addParamsOptions(new ParamsOptions("NO", false, false)) .addValidate(Validate.newBuilder().setRequired(true).build()) .setValue(true) .build(); RadioParam enableSsl = RadioParam.newBuilder("sslEnable", "mail.smtp.ssl.enable") .addParamsOptions(new ParamsOptions("YES", true, false)) .addParamsOptions(new ParamsOptions("NO", false, false)) .addValidate(Validate.newBuilder().setRequired(true).build()) .setValue(false) .build(); InputParam sslTrust = InputParam.newBuilder("mailSmtpSslTrust", "mail.smtp.ssl.trust") .addValidate(Validate.newBuilder().setRequired(true).build()) .setValue("smtp.exmail.qq.com") .build(); List<ParamsOptions> emailShowTypeList = new ArrayList<>(); emailShowTypeList.add(new ParamsOptions(ShowType.TABLE.getDescp(), ShowType.TABLE.getDescp(), false)); emailShowTypeList.add(new ParamsOptions(ShowType.TEXT.getDescp(), ShowType.TEXT.getDescp(), false)); emailShowTypeList.add(new ParamsOptions(ShowType.ATTACHMENT.getDescp(), ShowType.ATTACHMENT.getDescp(), false)); emailShowTypeList.add(new ParamsOptions(ShowType.TABLEATTACHMENT.getDescp(), ShowType.TABLEATTACHMENT.getDescp(), false)); RadioParam showType = RadioParam.newBuilder(AlertConstants.SHOW_TYPE, "showType") .setParamsOptionsList(emailShowTypeList) .setValue(ShowType.TABLE.getDescp()) .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); paramsList.add(receivesParam); paramsList.add(mailSmtpHost); paramsList.add(mailSmtpPort); paramsList.add(mailSender); paramsList.add(enableSmtpAuth); paramsList.add(mailUser); paramsList.add(mailPassword); paramsList.add(enableTls); paramsList.add(enableSsl); paramsList.add(sslTrust); paramsList.add(showType); return PluginParamsTransfer.transferParamsToJson(paramsList); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/PropertyUtilsTest.java
/* * 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.dolphinscheduler.alert.utils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import org.apache.dolphinscheduler.common.enums.ZKNodeType; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Test PropertyUtils * and the resource path is src/test/resources/alert.properties. */ public class PropertyUtilsTest { private static final Logger logger = LoggerFactory.getLogger(PropertyUtilsTest.class); /** * Test getString */ @Test public void testGetString() { //Expected "EMAIL" String result = PropertyUtils.getString("alert.type"); logger.info(result); assertEquals("EMAIL", result); //Expected "xxx.xxx.test" result = PropertyUtils.getString("mail.server.host"); assertEquals("xxx.xxx.test", result); //If key is undefine in alert.properties, then return null result = PropertyUtils.getString("abc"); assertNull(result); //If key is null, then return null result = PropertyUtils.getString(null); assertNull(result); } /** * Test getBoolean */ @Test public void testGetBoolean() { //Expected true Boolean result = PropertyUtils.getBoolean("mail.smtp.starttls.enable"); assertTrue(result); //Expected false result = PropertyUtils.getBoolean("mail.smtp.ssl.enable"); assertFalse(result); //If key is undefine in alert.properties, then return null result = PropertyUtils.getBoolean("abc"); assertFalse(result); //If key is null, then return false result = PropertyUtils.getBoolean(null); assertFalse(result); } /** * Test getLong */ @Test public void testGetLong() { //Expected 25 long result = PropertyUtils.getLong("mail.server.port"); assertSame(25L, result); //If key is null, then return -1 result = PropertyUtils.getLong(null); assertSame(-1L, result); //If key is undefine in alert.properties, then return -1 result = PropertyUtils.getLong("abc"); assertSame(-1L, result); //If key is undefine in alert.properties, and there is a defaultval, then return defaultval result = PropertyUtils.getLong("abc", 200); assertEquals(200L, result); //If the value can not parse to long ,it will log the error and return -1L result = PropertyUtils.getLong("test.server.testnumber"); assertSame(-1L, result); } /** * Test getDouble */ @Test public void testGetDouble() { //Expected 3.0 double result = PropertyUtils.getDouble("test.server.factor"); assertEquals(3.0, result, 0); //If key is null, then return -1.0 result = PropertyUtils.getDouble(null); assertEquals(-1.0, result, 0); //If key is undefine in alert.properties, then return -1 result = PropertyUtils.getDouble("abc"); assertEquals(-1.0, result, 0); //If key is undefine in alert.properties, and there is a defaultval, then return defaultval result = PropertyUtils.getDouble("abc", 5.0); assertEquals(5.0, result, 0); //If the value can not parse to double ,it will log the error and return -1.0 result = PropertyUtils.getDouble("test.server.testnumber"); assertEquals(-1.0, result, 0); } /** * Test getArray */ @Test public void testGetArray() { //Expected length 3 String[] result = PropertyUtils.getArray("test.server.list", ","); assertEquals(result.length, 3); //Equal array values assertEquals("xxx.xxx.test1", result[0]); assertEquals("xxx.xxx.test2", result[1]); assertEquals("xxx.xxx.test3", result[2]); //If key is null, then return -1 result = PropertyUtils.getArray(null, ","); assertNull(result); //If key is undefine in alert.properties, then return null result = PropertyUtils.getArray("abc", ","); assertNull(result); //If splitStr is null, then return null result = PropertyUtils.getArray("test.server.list", null); assertNull(result); } /** * test getInt */ @Test public void testGetInt() { //Expected 25 int result = PropertyUtils.getInt("mail.server.port"); assertSame(25, result); //If key is null, then return -1 result = PropertyUtils.getInt(null); assertSame(-1, result); //If key is undefine in alert.properties, then return -1 result = PropertyUtils.getInt("abc"); assertSame(-1, result); //If key is undefine in alert.properties, and there is a defaultval, then return defaultval result = PropertyUtils.getInt("abc", 300); assertEquals(300, result); //If the value can not parse to int ,it will log the error and return -1 result = PropertyUtils.getInt("test.server.testnumber"); assertSame(-1, result); } /** * Test getEnum */ @Test public void testGetEnum() { //Expected MASTER ZKNodeType zkNodeType = PropertyUtils.getEnum("test.server.enum1", ZKNodeType.class, ZKNodeType.WORKER); assertEquals(ZKNodeType.MASTER, zkNodeType); //Expected DEAD_SERVER zkNodeType = PropertyUtils.getEnum("test.server.enum2", ZKNodeType.class, ZKNodeType.WORKER); assertEquals(ZKNodeType.DEAD_SERVER, zkNodeType); //If key is null, then return defaultval zkNodeType = PropertyUtils.getEnum(null, ZKNodeType.class, ZKNodeType.WORKER); assertEquals(ZKNodeType.WORKER, zkNodeType); //If the value doesn't define in enum ,it will log the error and return -1 zkNodeType = PropertyUtils.getEnum("test.server.enum3", ZKNodeType.class, ZKNodeType.WORKER); assertEquals(ZKNodeType.WORKER, zkNodeType); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java
/* * 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.dolphinscheduler.common.utils; import static org.apache.dolphinscheduler.common.Constants.COMMON_PROPERTIES_PATH; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ResUploadType; import org.apache.commons.io.IOUtils; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; import java.util.Properties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * property utils * single instance */ public class PropertyUtils { /** * logger */ private static final Logger logger = LoggerFactory.getLogger(PropertyUtils.class); private static final Properties properties = new Properties(); private PropertyUtils() { throw new UnsupportedOperationException("Construct PropertyUtils"); } static { String[] propertyFiles = new String[]{COMMON_PROPERTIES_PATH}; for (String fileName : propertyFiles) { InputStream fis = null; try { fis = PropertyUtils.class.getResourceAsStream(fileName); properties.load(fis); } catch (IOException e) { logger.error(e.getMessage(), e); if (fis != null) { IOUtils.closeQuietly(fis); } System.exit(1); } finally { IOUtils.closeQuietly(fis); } } } /** * @return judge whether resource upload startup */ public static boolean getResUploadStartupState() { String resUploadStartupType = PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE); ResUploadType resUploadType = ResUploadType.valueOf(resUploadStartupType); return resUploadType == ResUploadType.HDFS || resUploadType == ResUploadType.S3; } /** * get property value * * @param key property name * @return property value */ public static String getString(String key) { return properties.getProperty(key.trim()); } /** * get property value with upper case * * @param key property name * @return property value with upper case */ public static String getUpperCaseString(String key) { return properties.getProperty(key.trim()).toUpperCase(); } /** * get property value * * @param key property name * @param defaultVal default value * @return property value */ public static String getString(String key, String defaultVal) { String val = properties.getProperty(key.trim()); return val == null ? defaultVal : val; } /** * get property value * * @param key property name * @return get property int value , if key == null, then return -1 */ public static int getInt(String key) { return getInt(key, -1); } /** * @param key key * @param defaultValue default value * @return property value */ public static int getInt(String key, int defaultValue) { String value = getString(key); if (value == null) { return defaultValue; } try { return Integer.parseInt(value); } catch (NumberFormatException e) { logger.info(e.getMessage(), e); } return defaultValue; } /** * get property value * * @param key property name * @return property value */ public static boolean getBoolean(String key) { String value = properties.getProperty(key.trim()); if (null != value) { return Boolean.parseBoolean(value); } return false; } /** * get property value * * @param key property name * @param defaultValue default value * @return property value */ public static Boolean getBoolean(String key, boolean defaultValue) { String value = properties.getProperty(key.trim()); if (null != value) { return Boolean.parseBoolean(value); } return defaultValue; } /** * get property long value * * @param key key * @param defaultVal default value * @return property value */ public static long getLong(String key, long defaultVal) { String val = getString(key); return val == null ? defaultVal : Long.parseLong(val); } /** * @param key key * @return property value */ public static long getLong(String key) { return getLong(key, -1); } /** * @param key key * @param defaultVal default value * @return property value */ public double getDouble(String key, double defaultVal) { String val = getString(key); return val == null ? defaultVal : Double.parseDouble(val); } /** * get array * * @param key property name * @param splitStr separator * @return property value through array */ public static String[] getArray(String key, String splitStr) { String value = getString(key); if (value == null) { return new String[0]; } try { String[] propertyArray = value.split(splitStr); return propertyArray; } catch (NumberFormatException e) { logger.info(e.getMessage(), e); } return new String[0]; } /** * @param key key * @param type type * @param defaultValue default value * @param <T> T * @return get enum value */ public <T extends Enum<T>> T getEnum(String key, Class<T> type, T defaultValue) { String val = getString(key); return val == null ? defaultValue : Enum.valueOf(type, val); } /** * get all properties with specified prefix, like: fs. * * @param prefix prefix to search * @return all properties with specified prefix */ public static Map<String, String> getPrefixedProperties(String prefix) { Map<String, String> matchedProperties = new HashMap<>(); for (String propName : properties.stringPropertyNames()) { if (propName.startsWith(prefix)) { matchedProperties.put(propName, properties.getProperty(propName)); } } return matchedProperties; } /** * */ public static void setValue(String key, String value) { properties.setProperty(key, value); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/TaskRecordDao.java
/* * 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.dolphinscheduler.dao; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.TaskRecordStatus; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.ConnectionUtils; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.TaskRecord; import org.apache.dolphinscheduler.dao.utils.PropertyUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.sql.*; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * task record dao */ public class TaskRecordDao { private static Logger logger = LoggerFactory.getLogger(TaskRecordDao.class.getName()); /** * get task record flag * @return whether startup taskrecord */ public static boolean getTaskRecordFlag(){ return PropertyUtils.getBoolean(Constants.TASK_RECORD_FLAG,false); } /** * create connection * * @return connection */ private static Connection getConn() { if (!getTaskRecordFlag()) { return null; } String driver = "com.mysql.jdbc.Driver"; String url = PropertyUtils.getString(Constants.TASK_RECORD_URL); String username = PropertyUtils.getString(Constants.TASK_RECORD_USER); String password = PropertyUtils.getString(Constants.TASK_RECORD_PWD); Connection conn = null; try { //classLoader,load driver Class.forName(driver); conn = DriverManager.getConnection(url, username, password); } catch (ClassNotFoundException e) { logger.error("Class not found Exception ", e); } catch (SQLException e) { logger.error("SQL Exception ", e); } return conn; } /** * generate where sql string * * @param filterMap filterMap * @return sql string */ private static String getWhereString(Map<String, String> filterMap) { if (filterMap.size() == 0) { return ""; } String result = " where 1=1 "; Object taskName = filterMap.get("taskName"); if (taskName != null && StringUtils.isNotEmpty(taskName.toString())) { result += " and PROC_NAME like concat('%', '" + taskName.toString() + "', '%') "; } Object taskDate = filterMap.get("taskDate"); if (taskDate != null && StringUtils.isNotEmpty(taskDate.toString())) { result += " and PROC_DATE='" + taskDate.toString() + "'"; } Object state = filterMap.get("state"); if (state != null && StringUtils.isNotEmpty(state.toString())) { result += " and NOTE='" + state.toString() + "'"; } Object sourceTable = filterMap.get("sourceTable"); if (sourceTable != null && StringUtils.isNotEmpty(sourceTable.toString())) { result += " and SOURCE_TAB like concat('%', '" + sourceTable.toString() + "', '%')"; } Object targetTable = filterMap.get("targetTable"); if (sourceTable != null && StringUtils.isNotEmpty(targetTable.toString())) { result += " and TARGET_TAB like concat('%', '" + targetTable.toString() + "', '%') "; } Object start = filterMap.get("startTime"); if (start != null && StringUtils.isNotEmpty(start.toString())) { result += " and STARTDATE>='" + start.toString() + "'"; } Object end = filterMap.get("endTime"); if (end != null && StringUtils.isNotEmpty(end.toString())) { result += " and ENDDATE>='" + end.toString() + "'"; } return result; } /** * count task record * * @param filterMap filterMap * @param table table * @return task record count */ public static int countTaskRecord(Map<String, String> filterMap, String table) { int count = 0; Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; try { conn = getConn(); if (conn == null) { return count; } String sql = String.format("select count(1) as count from %s", table); sql += getWhereString(filterMap); pstmt = conn.prepareStatement(sql); rs = pstmt.executeQuery(); while (rs.next()){ count = rs.getInt("count"); break; } } catch (SQLException e) { logger.error("Exception ", e); }finally { ConnectionUtils.releaseResource(rs, pstmt, conn); } return count; } /** * query task record by filter map paging * * @param filterMap filterMap * @param table table * @return task record list */ public static List<TaskRecord> queryAllTaskRecord(Map<String, String> filterMap, String table) { String sql = String.format("select * from %s", table); sql += getWhereString(filterMap); int offset = Integer.parseInt(filterMap.get("offset")); int pageSize = Integer.parseInt(filterMap.get("pageSize")); sql += String.format(" order by STARTDATE desc limit %d,%d", offset, pageSize); List<TaskRecord> recordList = new ArrayList<>(); try { recordList = getQueryResult(sql); } catch (Exception e) { logger.error("Exception ", e); } return recordList; } /** * convert result set to task record * * @param resultSet resultSet * @return task record * @throws SQLException if error throws SQLException */ private static TaskRecord convertToTaskRecord(ResultSet resultSet) throws SQLException { TaskRecord taskRecord = new TaskRecord(); taskRecord.setId(resultSet.getInt("ID")); taskRecord.setProcId(resultSet.getInt("PROC_ID")); taskRecord.setProcName(resultSet.getString("PROC_NAME")); taskRecord.setProcDate(resultSet.getString("PROC_DATE")); taskRecord.setStartTime(DateUtils.stringToDate(resultSet.getString("STARTDATE"))); taskRecord.setEndTime(DateUtils.stringToDate(resultSet.getString("ENDDATE"))); taskRecord.setResult(resultSet.getString("RESULT")); taskRecord.setDuration(resultSet.getInt("DURATION")); taskRecord.setNote(resultSet.getString("NOTE")); taskRecord.setSchema(resultSet.getString("SCHEMA")); taskRecord.setJobId(resultSet.getString("JOB_ID")); taskRecord.setSourceTab(resultSet.getString("SOURCE_TAB")); taskRecord.setSourceRowCount(resultSet.getLong("SOURCE_ROW_COUNT")); taskRecord.setTargetTab(resultSet.getString("TARGET_TAB")); taskRecord.setTargetRowCount(resultSet.getLong("TARGET_ROW_COUNT")); taskRecord.setErrorCode(resultSet.getString("ERROR_CODE")); return taskRecord; } /** * query task list by select sql * * @param selectSql select sql * @return task record list */ private static List<TaskRecord> getQueryResult(String selectSql) { List<TaskRecord> recordList = new ArrayList<>(); Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; try { conn = getConn(); if (conn == null) { return recordList; } pstmt = conn.prepareStatement(selectSql); rs = pstmt.executeQuery(); while (rs.next()) { TaskRecord taskRecord = convertToTaskRecord(rs); recordList.add(taskRecord); } } catch (SQLException e) { logger.error("Exception ", e); }finally { ConnectionUtils.releaseResource(rs, pstmt, conn); } return recordList; } /** * according to procname and procdate query task record * * @param procName procName * @param procDate procDate * @return task record status */ public static TaskRecordStatus getTaskRecordState(String procName, String procDate) { String sql = String.format("SELECT * FROM eamp_hive_log_hd WHERE PROC_NAME='%s' and PROC_DATE like '%s'" , procName, procDate + "%"); List<TaskRecord> taskRecordList = getQueryResult(sql); // contains no record and sql exception if (CollectionUtils.isEmpty(taskRecordList)) { // exception return TaskRecordStatus.EXCEPTION; } else if (taskRecordList.size() > 1) { return TaskRecordStatus.EXCEPTION; } else { TaskRecord taskRecord = taskRecordList.get(0); if (taskRecord == null) { return TaskRecordStatus.EXCEPTION; } Long targetRowCount = taskRecord.getTargetRowCount(); if (targetRowCount <= 0) { return TaskRecordStatus.FAILURE; } else { return TaskRecordStatus.SUCCESS; } } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/SpringConnectionFactory.java
/* * 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.dolphinscheduler.dao.datasource; import com.alibaba.druid.pool.DruidDataSource; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.core.MybatisConfiguration; import com.baomidou.mybatisplus.core.config.GlobalConfig; import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.dao.utils.PropertyUtils; import org.apache.ibatis.mapping.DatabaseIdProvider; import org.apache.ibatis.mapping.VendorDatabaseIdProvider; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.type.JdbcType; import org.mybatis.spring.SqlSessionTemplate; import org.mybatis.spring.annotation.MapperScan; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.ResourcePatternResolver; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import java.util.Properties; /** * data source connection factory */ @Configuration @MapperScan("org.apache.dolphinscheduler.*.mapper") public class SpringConnectionFactory { private static final Logger logger = LoggerFactory.getLogger(SpringConnectionFactory.class); /** * pagination interceptor * @return pagination interceptor */ @Bean public PaginationInterceptor paginationInterceptor() { return new PaginationInterceptor(); } /** * get the data source * @return druid dataSource */ @Bean(destroyMethod="") public DruidDataSource dataSource() { DruidDataSource druidDataSource = new DruidDataSource(); druidDataSource.setDriverClassName(PropertyUtils.getString(Constants.SPRING_DATASOURCE_DRIVER_CLASS_NAME)); druidDataSource.setUrl(PropertyUtils.getString(Constants.SPRING_DATASOURCE_URL)); druidDataSource.setUsername(PropertyUtils.getString(Constants.SPRING_DATASOURCE_USERNAME)); druidDataSource.setPassword(PropertyUtils.getString(Constants.SPRING_DATASOURCE_PASSWORD)); druidDataSource.setValidationQuery(PropertyUtils.getString(Constants.SPRING_DATASOURCE_VALIDATION_QUERY,"SELECT 1")); druidDataSource.setPoolPreparedStatements(PropertyUtils.getBoolean(Constants.SPRING_DATASOURCE_POOL_PREPARED_STATEMENTS,true)); druidDataSource.setTestWhileIdle(PropertyUtils.getBoolean(Constants.SPRING_DATASOURCE_TEST_WHILE_IDLE,true)); druidDataSource.setTestOnBorrow(PropertyUtils.getBoolean(Constants.SPRING_DATASOURCE_TEST_ON_BORROW,true)); druidDataSource.setTestOnReturn(PropertyUtils.getBoolean(Constants.SPRING_DATASOURCE_TEST_ON_RETURN,true)); druidDataSource.setKeepAlive(PropertyUtils.getBoolean(Constants.SPRING_DATASOURCE_KEEP_ALIVE,true)); druidDataSource.setMinIdle(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MIN_IDLE,5)); druidDataSource.setMaxActive(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_ACTIVE,50)); druidDataSource.setMaxWait(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_WAIT,60000)); druidDataSource.setMaxPoolPreparedStatementPerConnectionSize(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_POOL_PREPARED_STATEMENT_PER_CONNECTION_SIZE,20)); druidDataSource.setInitialSize(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_INITIAL_SIZE,5)); druidDataSource.setTimeBetweenEvictionRunsMillis(PropertyUtils.getLong(Constants.SPRING_DATASOURCE_TIME_BETWEEN_EVICTION_RUNS_MILLIS,60000)); druidDataSource.setTimeBetweenConnectErrorMillis(PropertyUtils.getLong(Constants.SPRING_DATASOURCE_TIME_BETWEEN_CONNECT_ERROR_MILLIS,60000)); druidDataSource.setMinEvictableIdleTimeMillis(PropertyUtils.getLong(Constants.SPRING_DATASOURCE_MIN_EVICTABLE_IDLE_TIME_MILLIS,300000)); druidDataSource.setValidationQueryTimeout(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_VALIDATION_QUERY_TIMEOUT,3)); //auto commit druidDataSource.setDefaultAutoCommit(PropertyUtils.getBoolean(Constants.SPRING_DATASOURCE_DEFAULT_AUTO_COMMIT,true)); return druidDataSource; } /** * * get transaction manager * @return DataSourceTransactionManager */ @Bean public DataSourceTransactionManager transactionManager() { return new DataSourceTransactionManager(dataSource()); } /** * * get sql session factory * @return sqlSessionFactory * @throws Exception sqlSessionFactory exception */ @Bean public SqlSessionFactory sqlSessionFactory() throws Exception { MybatisConfiguration configuration = new MybatisConfiguration(); configuration.setMapUnderscoreToCamelCase(true); configuration.setCacheEnabled(false); configuration.setCallSettersOnNulls(true); configuration.setJdbcTypeForNull(JdbcType.NULL); configuration.addInterceptor(paginationInterceptor()); MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean(); sqlSessionFactoryBean.setConfiguration(configuration); sqlSessionFactoryBean.setDataSource(dataSource()); GlobalConfig.DbConfig dbConfig = new GlobalConfig.DbConfig(); dbConfig.setIdType(IdType.AUTO); GlobalConfig globalConfig = new GlobalConfig(); globalConfig.setDbConfig(dbConfig); sqlSessionFactoryBean.setGlobalConfig(globalConfig); sqlSessionFactoryBean.setTypeAliasesPackage("org.apache.dolphinscheduler.dao.entity"); ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); sqlSessionFactoryBean.setMapperLocations(resolver.getResources("org/apache/dolphinscheduler/dao/mapper/*Mapper.xml")); sqlSessionFactoryBean.setTypeEnumsPackage("org.apache.dolphinscheduler.*.enums"); sqlSessionFactoryBean.setDatabaseIdProvider(databaseIdProvider()); return sqlSessionFactoryBean.getObject(); } /** * get sql session * @return SqlSession * @throws Exception */ @Bean public SqlSession sqlSession() throws Exception{ return new SqlSessionTemplate(sqlSessionFactory()); } @Bean public DatabaseIdProvider databaseIdProvider(){ DatabaseIdProvider databaseIdProvider = new VendorDatabaseIdProvider(); Properties properties = new Properties(); properties.setProperty("MySQL", "mysql"); properties.setProperty("PostgreSQL", "pg"); databaseIdProvider.setProperties(properties); return databaseIdProvider; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/PropertyUtils.java
/* * 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.dolphinscheduler.dao.utils; import org.apache.dolphinscheduler.common.Constants; import com.baomidou.mybatisplus.core.toolkit.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InputStream; import java.util.Properties; /** * property utils * single instance */ public class PropertyUtils { /** * logger */ private static final Logger logger = LoggerFactory.getLogger(PropertyUtils.class); private static final Properties properties = new Properties(); private static final PropertyUtils propertyUtils = new PropertyUtils(); private PropertyUtils(){ init(); } /** * init */ private void init(){ String[] propertyFiles = new String[]{Constants.DATASOURCE_PROPERTIES}; for (String fileName : propertyFiles) { InputStream fis = null; try { fis = PropertyUtils.class.getResourceAsStream(fileName); properties.load(fis); } catch (IOException e) { logger.error(e.getMessage(), e); if (fis != null) { IOUtils.closeQuietly(fis); } System.exit(1); } finally { IOUtils.closeQuietly(fis); } } } /** * get property value * @param key property name * @return get string value */ public static String getString(String key) { return properties.getProperty(key); } /** * get property value * * @param key property name * @param defaultVal default value * @return property value */ public static String getString(String key, String defaultVal) { String val = properties.getProperty(key.trim()); return val == null ? defaultVal : val; } /** * get property value * @param key property name * @return get property int value , if key == null, then return -1 */ public static int getInt(String key) { return getInt(key, -1); } /** * get property value * @param key key * @param defaultValue defaultValue * @return get property int value,if key == null ,then return defaultValue */ public static int getInt(String key, int defaultValue) { String value = getString(key); if (value == null) { return defaultValue; } try { return Integer.parseInt(value); } catch (NumberFormatException e) { logger.info(e.getMessage(),e); } return defaultValue; } /** * get property value * * @param key property name * @return property value */ public static Boolean getBoolean(String key) { String value = properties.getProperty(key.trim()); if(null != value){ return Boolean.parseBoolean(value); } return false; } /** * get property value * * @param key property name * @param defaultValue default value * @return property value */ public static Boolean getBoolean(String key, boolean defaultValue) { String value = properties.getProperty(key.trim()); if(null != value){ return Boolean.parseBoolean(value); } return defaultValue; } /** * get property long value * @param key key * @param defaultVal default value * @return property value */ public static long getLong(String key, long defaultVal) { String val = getString(key); return val == null ? defaultVal : Long.parseLong(val); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
/* * 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.dolphinscheduler.service.quartz; import static org.apache.dolphinscheduler.common.Constants.ORG_POSTGRESQL_DRIVER; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_ACQUIRETRIGGERSWITHINLOCK; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_CLASS; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_CLUSTERCHECKININTERVAL; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_DATASOURCE; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_DRIVERDELEGATECLASS; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_ISCLUSTERED; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_MISFIRETHRESHOLD; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_TABLEPREFIX; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_USEPROPERTIES; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_SCHEDULER_INSTANCEID; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_SCHEDULER_INSTANCENAME; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_SCHEDULER_MAKESCHEDULERTHREADDAEMON; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_THREADPOOL_CLASS; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_THREADPOOL_MAKETHREADSDAEMONS; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_THREADPOOL_THREADCOUNT; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_THREADPOOL_THREADPRIORITY; import static org.apache.dolphinscheduler.common.Constants.PROJECT_ID; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_ACQUIRETRIGGERSWITHINLOCK; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_CLUSTERCHECKININTERVAL; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_DATASOURCE; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_INSTANCEID; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_INSTANCENAME; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_JOB_GROUP_PRIFIX; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_JOB_PRIFIX; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_MISFIRETHRESHOLD; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_PROPERTIES_PATH; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_TABLE_PREFIX; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_THREADCOUNT; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_THREADPRIORITY; import static org.apache.dolphinscheduler.common.Constants.SCHEDULE; import static org.apache.dolphinscheduler.common.Constants.SCHEDULE_ID; import static org.apache.dolphinscheduler.common.Constants.SPRING_DATASOURCE_DRIVER_CLASS_NAME; import static org.apache.dolphinscheduler.common.Constants.STRING_FALSE; import static org.apache.dolphinscheduler.common.Constants.STRING_TRUE; import static org.apache.dolphinscheduler.common.Constants.UNDERLINE; import static org.quartz.CronScheduleBuilder.cronSchedule; import static org.quartz.JobBuilder.newJob; import static org.quartz.TriggerBuilder.newTrigger; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.service.exceptions.ServiceException; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.quartz.CronTrigger; import org.quartz.Job; import org.quartz.JobDetail; import org.quartz.JobKey; import org.quartz.Scheduler; import org.quartz.SchedulerException; import org.quartz.TriggerKey; import org.quartz.impl.StdSchedulerFactory; import org.quartz.impl.jdbcjobstore.JobStoreTX; import org.quartz.impl.jdbcjobstore.PostgreSQLDelegate; import org.quartz.impl.jdbcjobstore.StdJDBCDelegate; import org.quartz.impl.matchers.GroupMatcher; import org.quartz.simpl.SimpleThreadPool; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * single Quartz executors instance */ public class QuartzExecutors { /** * logger of QuartzExecutors */ private static final Logger logger = LoggerFactory.getLogger(QuartzExecutors.class); /** * read write lock */ private final ReadWriteLock lock = new ReentrantReadWriteLock(); /** * A Scheduler maintains a registry of org.quartz.JobDetail and Trigger. */ private static Scheduler scheduler; /** * load conf */ private static Configuration conf; private static final class Holder { private static final QuartzExecutors instance = new QuartzExecutors(); } private QuartzExecutors() { try { conf = new PropertiesConfiguration(QUARTZ_PROPERTIES_PATH); init(); } catch (ConfigurationException e) { logger.warn("not loaded quartz configuration file, will used default value", e); } } /** * thread safe and performance promote * * @return instance of Quartz Executors */ public static QuartzExecutors getInstance() { return Holder.instance; } /** * init * <p> * Returns a client-usable handle to a Scheduler. */ private void init() { try { StdSchedulerFactory schedulerFactory = new StdSchedulerFactory(); Properties properties = new Properties(); String dataSourceDriverClass = org.apache.dolphinscheduler.dao.utils.PropertyUtils.getString(SPRING_DATASOURCE_DRIVER_CLASS_NAME); if (dataSourceDriverClass.equals(ORG_POSTGRESQL_DRIVER)) { properties.setProperty(ORG_QUARTZ_JOBSTORE_DRIVERDELEGATECLASS, conf.getString(ORG_QUARTZ_JOBSTORE_DRIVERDELEGATECLASS, PostgreSQLDelegate.class.getName())); } else { properties.setProperty(ORG_QUARTZ_JOBSTORE_DRIVERDELEGATECLASS, conf.getString(ORG_QUARTZ_JOBSTORE_DRIVERDELEGATECLASS, StdJDBCDelegate.class.getName())); } properties.setProperty(ORG_QUARTZ_SCHEDULER_INSTANCENAME, conf.getString(ORG_QUARTZ_SCHEDULER_INSTANCENAME, QUARTZ_INSTANCENAME)); properties.setProperty(ORG_QUARTZ_SCHEDULER_INSTANCEID, conf.getString(ORG_QUARTZ_SCHEDULER_INSTANCEID, QUARTZ_INSTANCEID)); properties.setProperty(ORG_QUARTZ_SCHEDULER_MAKESCHEDULERTHREADDAEMON, conf.getString(ORG_QUARTZ_SCHEDULER_MAKESCHEDULERTHREADDAEMON, STRING_TRUE)); properties.setProperty(ORG_QUARTZ_JOBSTORE_USEPROPERTIES, conf.getString(ORG_QUARTZ_JOBSTORE_USEPROPERTIES, STRING_FALSE)); properties.setProperty(ORG_QUARTZ_THREADPOOL_CLASS, conf.getString(ORG_QUARTZ_THREADPOOL_CLASS, SimpleThreadPool.class.getName())); properties.setProperty(ORG_QUARTZ_THREADPOOL_MAKETHREADSDAEMONS, conf.getString(ORG_QUARTZ_THREADPOOL_MAKETHREADSDAEMONS, STRING_TRUE)); properties.setProperty(ORG_QUARTZ_THREADPOOL_THREADCOUNT, conf.getString(ORG_QUARTZ_THREADPOOL_THREADCOUNT, QUARTZ_THREADCOUNT)); properties.setProperty(ORG_QUARTZ_THREADPOOL_THREADPRIORITY, conf.getString(ORG_QUARTZ_THREADPOOL_THREADPRIORITY, QUARTZ_THREADPRIORITY)); properties.setProperty(ORG_QUARTZ_JOBSTORE_CLASS, conf.getString(ORG_QUARTZ_JOBSTORE_CLASS, JobStoreTX.class.getName())); properties.setProperty(ORG_QUARTZ_JOBSTORE_TABLEPREFIX, conf.getString(ORG_QUARTZ_JOBSTORE_TABLEPREFIX, QUARTZ_TABLE_PREFIX)); properties.setProperty(ORG_QUARTZ_JOBSTORE_ISCLUSTERED, conf.getString(ORG_QUARTZ_JOBSTORE_ISCLUSTERED, STRING_TRUE)); properties.setProperty(ORG_QUARTZ_JOBSTORE_MISFIRETHRESHOLD, conf.getString(ORG_QUARTZ_JOBSTORE_MISFIRETHRESHOLD, QUARTZ_MISFIRETHRESHOLD)); properties.setProperty(ORG_QUARTZ_JOBSTORE_CLUSTERCHECKININTERVAL, conf.getString(ORG_QUARTZ_JOBSTORE_CLUSTERCHECKININTERVAL, QUARTZ_CLUSTERCHECKININTERVAL)); properties.setProperty(ORG_QUARTZ_JOBSTORE_ACQUIRETRIGGERSWITHINLOCK, conf.getString(ORG_QUARTZ_JOBSTORE_ACQUIRETRIGGERSWITHINLOCK, QUARTZ_ACQUIRETRIGGERSWITHINLOCK)); properties.setProperty(ORG_QUARTZ_JOBSTORE_DATASOURCE, conf.getString(ORG_QUARTZ_JOBSTORE_DATASOURCE, QUARTZ_DATASOURCE)); properties.setProperty(ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS, conf.getString(ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS, DruidConnectionProvider.class.getName())); schedulerFactory.initialize(properties); scheduler = schedulerFactory.getScheduler(); } catch (SchedulerException e) { logger.error(e.getMessage(), e); System.exit(1); } } /** * Whether the scheduler has been started. * * @throws SchedulerException scheduler exception */ public void start() throws SchedulerException { if (!scheduler.isStarted()) { scheduler.start(); logger.info("Quartz service started"); } } /** * stop all scheduled tasks * <p> * Halts the Scheduler's firing of Triggers, * and cleans up all resources associated with the Scheduler. * <p> * The scheduler cannot be re-started. * * @throws SchedulerException scheduler exception */ public void shutdown() throws SchedulerException { if (!scheduler.isShutdown()) { // don't wait for the task to complete scheduler.shutdown(); logger.info("Quartz service stopped, and halt all tasks"); } } /** * add task trigger , if this task already exists, return this task with updated trigger * * @param clazz job class name * @param jobName job name * @param jobGroupName job group name * @param startDate job start date * @param endDate job end date * @param cronExpression cron expression * @param jobDataMap job parameters data map */ public void addJob(Class<? extends Job> clazz, String jobName, String jobGroupName, Date startDate, Date endDate, String cronExpression, Map<String, Object> jobDataMap) { lock.writeLock().lock(); try { JobKey jobKey = new JobKey(jobName, jobGroupName); JobDetail jobDetail; //add a task (if this task already exists, return this task directly) if (scheduler.checkExists(jobKey)) { jobDetail = scheduler.getJobDetail(jobKey); if (jobDataMap != null) { jobDetail.getJobDataMap().putAll(jobDataMap); } } else { jobDetail = newJob(clazz).withIdentity(jobKey).build(); if (jobDataMap != null) { jobDetail.getJobDataMap().putAll(jobDataMap); } scheduler.addJob(jobDetail, false, true); logger.info("Add job, job name: {}, group name: {}", jobName, jobGroupName); } TriggerKey triggerKey = new TriggerKey(jobName, jobGroupName); /** * Instructs the Scheduler that upon a mis-fire * situation, the CronTrigger wants to have it's * next-fire-time updated to the next time in the schedule after the * current time (taking into account any associated Calendar), * but it does not want to be fired now. */ CronTrigger cronTrigger = newTrigger().withIdentity(triggerKey).startAt(startDate).endAt(endDate) .withSchedule(cronSchedule(cronExpression).withMisfireHandlingInstructionDoNothing()) .forJob(jobDetail).build(); if (scheduler.checkExists(triggerKey)) { // updateProcessInstance scheduler trigger when scheduler cycle changes CronTrigger oldCronTrigger = (CronTrigger) scheduler.getTrigger(triggerKey); String oldCronExpression = oldCronTrigger.getCronExpression(); if (!StringUtils.equalsIgnoreCase(cronExpression, oldCronExpression)) { // reschedule job trigger scheduler.rescheduleJob(triggerKey, cronTrigger); logger.info("reschedule job trigger, triggerName: {}, triggerGroupName: {}, cronExpression: {}, startDate: {}, endDate: {}", jobName, jobGroupName, cronExpression, startDate, endDate); } } else { scheduler.scheduleJob(cronTrigger); logger.info("schedule job trigger, triggerName: {}, triggerGroupName: {}, cronExpression: {}, startDate: {}, endDate: {}", jobName, jobGroupName, cronExpression, startDate, endDate); } } catch (Exception e) { throw new ServiceException("add job failed", e); } finally { lock.writeLock().unlock(); } } /** * delete job * * @param jobName job name * @param jobGroupName job group name * @return true if the Job was found and deleted. */ public boolean deleteJob(String jobName, String jobGroupName) { lock.writeLock().lock(); try { JobKey jobKey = new JobKey(jobName, jobGroupName); if (scheduler.checkExists(jobKey)) { logger.info("try to delete job, job name: {}, job group name: {},", jobName, jobGroupName); return scheduler.deleteJob(jobKey); } else { return true; } } catch (SchedulerException e) { logger.error("delete job : {} failed", jobName, e); } finally { lock.writeLock().unlock(); } return false; } /** * delete all jobs in job group * * @param jobGroupName job group name * @return true if all of the Jobs were found and deleted, false if * one or more were not deleted. */ public boolean deleteAllJobs(String jobGroupName) { lock.writeLock().lock(); try { logger.info("try to delete all jobs in job group: {}", jobGroupName); List<JobKey> jobKeys = new ArrayList<>(); jobKeys.addAll(scheduler.getJobKeys(GroupMatcher.groupEndsWith(jobGroupName))); return scheduler.deleteJobs(jobKeys); } catch (SchedulerException e) { logger.error("delete all jobs in job group: {} failed", jobGroupName, e); } finally { lock.writeLock().unlock(); } return false; } /** * build job name * * @param processId process id * @return job name */ public static String buildJobName(int processId) { StringBuilder sb = new StringBuilder(30); sb.append(QUARTZ_JOB_PRIFIX).append(UNDERLINE).append(processId); return sb.toString(); } /** * build job group name * * @param projectId project id * @return job group name */ public static String buildJobGroupName(int projectId) { StringBuilder sb = new StringBuilder(30); sb.append(QUARTZ_JOB_GROUP_PRIFIX).append(UNDERLINE).append(projectId); return sb.toString(); } /** * add params to map * * @param projectId project id * @param scheduleId schedule id * @param schedule schedule * @return data map */ public static Map<String, Object> buildDataMap(int projectId, int scheduleId, Schedule schedule) { Map<String, Object> dataMap = new HashMap<>(8); dataMap.put(PROJECT_ID, projectId); dataMap.put(SCHEDULE_ID, scheduleId); dataMap.put(SCHEDULE, JSONUtils.toJsonString(schedule)); return dataMap; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
/* * 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.dolphinscheduler.api.enums; import java.util.Locale; import org.springframework.context.i18n.LocaleContextHolder; /** * status enum // todo #4855 One category one interval */ public enum Status { SUCCESS(0, "success", "成功"), INTERNAL_SERVER_ERROR_ARGS(10000, "Internal Server Error: {0}", "服务端异常: {0}"), REQUEST_PARAMS_NOT_VALID_ERROR(10001, "request parameter {0} is not valid", "请求参数[{0}]无效"), TASK_TIMEOUT_PARAMS_ERROR(10002, "task timeout parameter is not valid", "任务超时参数无效"), USER_NAME_EXIST(10003, "user name already exists", "用户名已存在"), USER_NAME_NULL(10004, "user name is null", "用户名不能为空"), HDFS_OPERATION_ERROR(10006, "hdfs operation error", "hdfs操作错误"), TASK_INSTANCE_NOT_FOUND(10008, "task instance not found", "任务实例不存在"), OS_TENANT_CODE_EXIST(10009, "os tenant code {0} already exists", "操作系统租户[{0}]已存在"), USER_NOT_EXIST(10010, "user {0} not exists", "用户[{0}]不存在"), ALERT_GROUP_NOT_EXIST(10011, "alarm group not found", "告警组不存在"), ALERT_GROUP_EXIST(10012, "alarm group already exists", "告警组名称已存在"), USER_NAME_PASSWD_ERROR(10013, "user name or password error", "用户名或密码错误"), LOGIN_SESSION_FAILED(10014, "create session failed!", "创建session失败"), DATASOURCE_EXIST(10015, "data source name already exists", "数据源名称已存在"), DATASOURCE_CONNECT_FAILED(10016, "data source connection failed", "建立数据源连接失败"), TENANT_NOT_EXIST(10017, "tenant not exists", "租户不存在"), PROJECT_NOT_FOUNT(10018, "project {0} not found ", "项目[{0}]不存在"), PROJECT_ALREADY_EXISTS(10019, "project {0} already exists", "项目名称[{0}]已存在"), TASK_INSTANCE_NOT_EXISTS(10020, "task instance {0} does not exist", "任务实例[{0}]不存在"), TASK_INSTANCE_NOT_SUB_WORKFLOW_INSTANCE(10021, "task instance {0} is not sub process instance", "任务实例[{0}]不是子流程实例"), SCHEDULE_CRON_NOT_EXISTS(10022, "scheduler crontab {0} does not exist", "调度配置定时表达式[{0}]不存在"), SCHEDULE_CRON_ONLINE_FORBID_UPDATE(10023, "online status does not allow update operations", "调度配置上线状态不允许修改"), SCHEDULE_CRON_CHECK_FAILED(10024, "scheduler crontab expression validation failure: {0}", "调度配置定时表达式验证失败: {0}"), MASTER_NOT_EXISTS(10025, "master does not exist", "无可用master节点"), SCHEDULE_STATUS_UNKNOWN(10026, "unknown status: {0}", "未知状态: {0}"), CREATE_ALERT_GROUP_ERROR(10027, "create alert group error", "创建告警组错误"), QUERY_ALL_ALERTGROUP_ERROR(10028, "query all alertgroup error", "查询告警组错误"), LIST_PAGING_ALERT_GROUP_ERROR(10029, "list paging alert group error", "分页查询告警组错误"), UPDATE_ALERT_GROUP_ERROR(10030, "update alert group error", "更新告警组错误"), DELETE_ALERT_GROUP_ERROR(10031, "delete alert group error", "删除告警组错误"), ALERT_GROUP_GRANT_USER_ERROR(10032, "alert group grant user error", "告警组授权用户错误"), CREATE_DATASOURCE_ERROR(10033, "create datasource error", "创建数据源错误"), UPDATE_DATASOURCE_ERROR(10034, "update datasource error", "更新数据源错误"), QUERY_DATASOURCE_ERROR(10035, "query datasource error", "查询数据源错误"), CONNECT_DATASOURCE_FAILURE(10036, "connect datasource failure", "建立数据源连接失败"), CONNECTION_TEST_FAILURE(10037, "connection test failure", "测试数据源连接失败"), DELETE_DATA_SOURCE_FAILURE(10038, "delete data source failure", "删除数据源失败"), VERIFY_DATASOURCE_NAME_FAILURE(10039, "verify datasource name failure", "验证数据源名称失败"), UNAUTHORIZED_DATASOURCE(10040, "unauthorized datasource", "未经授权的数据源"), AUTHORIZED_DATA_SOURCE(10041, "authorized data source", "授权数据源失败"), LOGIN_SUCCESS(10042, "login success", "登录成功"), USER_LOGIN_FAILURE(10043, "user login failure", "用户登录失败"), LIST_WORKERS_ERROR(10044, "list workers error", "查询worker列表错误"), LIST_MASTERS_ERROR(10045, "list masters error", "查询master列表错误"), UPDATE_PROJECT_ERROR(10046, "update project error", "更新项目信息错误"), QUERY_PROJECT_DETAILS_BY_ID_ERROR(10047, "query project details by id error", "查询项目详细信息错误"), CREATE_PROJECT_ERROR(10048, "create project error", "创建项目错误"), LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR(10049, "login user query project list paging error", "分页查询项目列表错误"), DELETE_PROJECT_ERROR(10050, "delete project error", "删除项目错误"), QUERY_UNAUTHORIZED_PROJECT_ERROR(10051, "query unauthorized project error", "查询未授权项目错误"), QUERY_AUTHORIZED_PROJECT(10052, "query authorized project", "查询授权项目错误"), QUERY_QUEUE_LIST_ERROR(10053, "query queue list error", "查询队列列表错误"), CREATE_RESOURCE_ERROR(10054, "create resource error", "创建资源错误"), UPDATE_RESOURCE_ERROR(10055, "update resource error", "更新资源错误"), QUERY_RESOURCES_LIST_ERROR(10056, "query resources list error", "查询资源列表错误"), QUERY_RESOURCES_LIST_PAGING(10057, "query resources list paging", "分页查询资源列表错误"), DELETE_RESOURCE_ERROR(10058, "delete resource error", "删除资源错误"), VERIFY_RESOURCE_BY_NAME_AND_TYPE_ERROR(10059, "verify resource by name and type error", "资源名称或类型验证错误"), VIEW_RESOURCE_FILE_ON_LINE_ERROR(10060, "view resource file online error", "查看资源文件错误"), CREATE_RESOURCE_FILE_ON_LINE_ERROR(10061, "create resource file online error", "创建资源文件错误"), RESOURCE_FILE_IS_EMPTY(10062, "resource file is empty", "资源文件内容不能为空"), EDIT_RESOURCE_FILE_ON_LINE_ERROR(10063, "edit resource file online error", "更新资源文件错误"), DOWNLOAD_RESOURCE_FILE_ERROR(10064, "download resource file error", "下载资源文件错误"), CREATE_UDF_FUNCTION_ERROR(10065, "create udf function error", "创建UDF函数错误"), VIEW_UDF_FUNCTION_ERROR(10066, "view udf function error", "查询UDF函数错误"), UPDATE_UDF_FUNCTION_ERROR(10067, "update udf function error", "更新UDF函数错误"), QUERY_UDF_FUNCTION_LIST_PAGING_ERROR(10068, "query udf function list paging error", "分页查询UDF函数列表错误"), QUERY_DATASOURCE_BY_TYPE_ERROR(10069, "query datasource by type error", "查询数据源信息错误"), VERIFY_UDF_FUNCTION_NAME_ERROR(10070, "verify udf function name error", "UDF函数名称验证错误"), DELETE_UDF_FUNCTION_ERROR(10071, "delete udf function error", "删除UDF函数错误"), AUTHORIZED_FILE_RESOURCE_ERROR(10072, "authorized file resource error", "授权资源文件错误"), AUTHORIZE_RESOURCE_TREE(10073, "authorize resource tree display error", "授权资源目录树错误"), UNAUTHORIZED_UDF_FUNCTION_ERROR(10074, "unauthorized udf function error", "查询未授权UDF函数错误"), AUTHORIZED_UDF_FUNCTION_ERROR(10075, "authorized udf function error", "授权UDF函数错误"), CREATE_SCHEDULE_ERROR(10076, "create schedule error", "创建调度配置错误"), UPDATE_SCHEDULE_ERROR(10077, "update schedule error", "更新调度配置错误"), PUBLISH_SCHEDULE_ONLINE_ERROR(10078, "publish schedule online error", "上线调度配置错误"), OFFLINE_SCHEDULE_ERROR(10079, "offline schedule error", "下线调度配置错误"), QUERY_SCHEDULE_LIST_PAGING_ERROR(10080, "query schedule list paging error", "分页查询调度配置列表错误"), QUERY_SCHEDULE_LIST_ERROR(10081, "query schedule list error", "查询调度配置列表错误"), QUERY_TASK_LIST_PAGING_ERROR(10082, "query task list paging error", "分页查询任务列表错误"), QUERY_TASK_RECORD_LIST_PAGING_ERROR(10083, "query task record list paging error", "分页查询任务记录错误"), CREATE_TENANT_ERROR(10084, "create tenant error", "创建租户错误"), QUERY_TENANT_LIST_PAGING_ERROR(10085, "query tenant list paging error", "分页查询租户列表错误"), QUERY_TENANT_LIST_ERROR(10086, "query tenant list error", "查询租户列表错误"), UPDATE_TENANT_ERROR(10087, "update tenant error", "更新租户错误"), DELETE_TENANT_BY_ID_ERROR(10088, "delete tenant by id error", "删除租户错误"), VERIFY_OS_TENANT_CODE_ERROR(10089, "verify os tenant code error", "操作系统租户验证错误"), CREATE_USER_ERROR(10090, "create user error", "创建用户错误"), QUERY_USER_LIST_PAGING_ERROR(10091, "query user list paging error", "分页查询用户列表错误"), UPDATE_USER_ERROR(10092, "update user error", "更新用户错误"), DELETE_USER_BY_ID_ERROR(10093, "delete user by id error", "删除用户错误"), GRANT_PROJECT_ERROR(10094, "grant project error", "授权项目错误"), GRANT_RESOURCE_ERROR(10095, "grant resource error", "授权资源错误"), GRANT_UDF_FUNCTION_ERROR(10096, "grant udf function error", "授权UDF函数错误"), GRANT_DATASOURCE_ERROR(10097, "grant datasource error", "授权数据源错误"), GET_USER_INFO_ERROR(10098, "get user info error", "获取用户信息错误"), USER_LIST_ERROR(10099, "user list error", "查询用户列表错误"), VERIFY_USERNAME_ERROR(10100, "verify username error", "用户名验证错误"), UNAUTHORIZED_USER_ERROR(10101, "unauthorized user error", "查询未授权用户错误"), AUTHORIZED_USER_ERROR(10102, "authorized user error", "查询授权用户错误"), QUERY_TASK_INSTANCE_LOG_ERROR(10103, "view task instance log error", "查询任务实例日志错误"), DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR(10104, "download task instance log file error", "下载任务日志文件错误"), CREATE_PROCESS_DEFINITION(10105, "create process definition", "创建工作流错误"), VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR(10106, "verify process definition name unique error", "工作流定义名称验证错误"), UPDATE_PROCESS_DEFINITION_ERROR(10107, "update process definition error", "更新工作流定义错误"), RELEASE_PROCESS_DEFINITION_ERROR(10108, "release process definition error", "上线工作流错误"), QUERY_DATAIL_OF_PROCESS_DEFINITION_ERROR(10109, "query datail of process definition error", "查询工作流详细信息错误"), QUERY_PROCESS_DEFINITION_LIST(10110, "query process definition list", "查询工作流列表错误"), ENCAPSULATION_TREEVIEW_STRUCTURE_ERROR(10111, "encapsulation treeview structure error", "查询工作流树形图数据错误"), GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR(10112, "get tasks list by process definition id error", "查询工作流定义节点信息错误"), QUERY_PROCESS_INSTANCE_LIST_PAGING_ERROR(10113, "query process instance list paging error", "分页查询工作流实例列表错误"), QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_ERROR(10114, "query task list by process instance id error", "查询任务实例列表错误"), UPDATE_PROCESS_INSTANCE_ERROR(10115, "update process instance error", "更新工作流实例错误"), QUERY_PROCESS_INSTANCE_BY_ID_ERROR(10116, "query process instance by id error", "查询工作流实例错误"), DELETE_PROCESS_INSTANCE_BY_ID_ERROR(10117, "delete process instance by id error", "删除工作流实例错误"), QUERY_SUB_PROCESS_INSTANCE_DETAIL_INFO_BY_TASK_ID_ERROR(10118, "query sub process instance detail info by task id error", "查询子流程任务实例错误"), QUERY_PARENT_PROCESS_INSTANCE_DETAIL_INFO_BY_SUB_PROCESS_INSTANCE_ID_ERROR(10119, "query parent process instance detail info by sub process instance id error", "查询子流程该工作流实例错误"), QUERY_PROCESS_INSTANCE_ALL_VARIABLES_ERROR(10120, "query process instance all variables error", "查询工作流自定义变量信息错误"), ENCAPSULATION_PROCESS_INSTANCE_GANTT_STRUCTURE_ERROR(10121, "encapsulation process instance gantt structure error", "查询工作流实例甘特图数据错误"), QUERY_PROCESS_DEFINITION_LIST_PAGING_ERROR(10122, "query process definition list paging error", "分页查询工作流定义列表错误"), SIGN_OUT_ERROR(10123, "sign out error", "退出错误"), OS_TENANT_CODE_HAS_ALREADY_EXISTS(10124, "os tenant code has already exists", "操作系统租户已存在"), IP_IS_EMPTY(10125, "ip is empty", "IP地址不能为空"), SCHEDULE_CRON_REALEASE_NEED_NOT_CHANGE(10126, "schedule release is already {0}", "调度配置上线错误[{0}]"), CREATE_QUEUE_ERROR(10127, "create queue error", "创建队列错误"), QUEUE_NOT_EXIST(10128, "queue {0} not exists", "队列ID[{0}]不存在"), QUEUE_VALUE_EXIST(10129, "queue value {0} already exists", "队列值[{0}]已存在"), QUEUE_NAME_EXIST(10130, "queue name {0} already exists", "队列名称[{0}]已存在"), UPDATE_QUEUE_ERROR(10131, "update queue error", "更新队列信息错误"), NEED_NOT_UPDATE_QUEUE(10132, "no content changes, no updates are required", "数据未变更,不需要更新队列信息"), VERIFY_QUEUE_ERROR(10133, "verify queue error", "验证队列信息错误"), NAME_NULL(10134, "name must be not null", "名称不能为空"), NAME_EXIST(10135, "name {0} already exists", "名称[{0}]已存在"), SAVE_ERROR(10136, "save error", "保存错误"), DELETE_PROJECT_ERROR_DEFINES_NOT_NULL(10137, "please delete the process definitions in project first!", "请先删除全部工作流定义"), BATCH_DELETE_PROCESS_INSTANCE_BY_IDS_ERROR(10117, "batch delete process instance by ids {0} error", "批量删除工作流实例错误"), PREVIEW_SCHEDULE_ERROR(10139, "preview schedule error", "预览调度配置错误"), PARSE_TO_CRON_EXPRESSION_ERROR(10140, "parse cron to cron expression error", "解析调度表达式错误"), SCHEDULE_START_TIME_END_TIME_SAME(10141, "The start time must not be the same as the end", "开始时间不能和结束时间一样"), DELETE_TENANT_BY_ID_FAIL(10142, "delete tenant by id fail, for there are {0} process instances in executing using it", "删除租户失败,有[{0}]个运行中的工作流实例正在使用"), DELETE_TENANT_BY_ID_FAIL_DEFINES(10143, "delete tenant by id fail, for there are {0} process definitions using it", "删除租户失败,有[{0}]个工作流定义正在使用"), DELETE_TENANT_BY_ID_FAIL_USERS(10144, "delete tenant by id fail, for there are {0} users using it", "删除租户失败,有[{0}]个用户正在使用"), DELETE_WORKER_GROUP_BY_ID_FAIL(10145, "delete worker group by id fail, for there are {0} process instances in executing using it", "删除Worker分组失败,有[{0}]个运行中的工作流实例正在使用"), QUERY_WORKER_GROUP_FAIL(10146, "query worker group fail ", "查询worker分组失败"), DELETE_WORKER_GROUP_FAIL(10147, "delete worker group fail ", "删除worker分组失败"), USER_DISABLED(10148, "The current user is disabled", "当前用户已停用"), COPY_PROCESS_DEFINITION_ERROR(10149, "copy process definition from {0} to {1} error : {2}", "从{0}复制工作流到{1}错误 : {2}"), MOVE_PROCESS_DEFINITION_ERROR(10150, "move process definition from {0} to {1} error : {2}", "从{0}移动工作流到{1}错误 : {2}"), SWITCH_PROCESS_DEFINITION_VERSION_ERROR(10151, "Switch process definition version error", "切换工作流版本出错"), SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR(10152 , "Switch process definition version error: not exists process definition, [process definition id {0}]", "切换工作流版本出错:工作流不存在,[工作流id {0}]"), SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR(10153 , "Switch process definition version error: not exists process definition version, [process definition id {0}] [version number {1}]", "切换工作流版本出错:工作流版本信息不存在,[工作流id {0}] [版本号 {1}]"), QUERY_PROCESS_DEFINITION_VERSIONS_ERROR(10154, "query process definition versions error", "查询工作流历史版本信息出错"), QUERY_PROCESS_DEFINITION_VERSIONS_PAGE_NO_OR_PAGE_SIZE_LESS_THAN_1_ERROR(10155 , "query process definition versions error: [page number:{0}] < 1 or [page size:{1}] < 1", "查询工作流历史版本出错:[pageNo:{0}] < 1 或 [pageSize:{1}] < 1"), DELETE_PROCESS_DEFINITION_VERSION_ERROR(10156, "delete process definition version error", "删除工作流历史版本出错"), QUERY_USER_CREATED_PROJECT_ERROR(10157, "query user created project error error", "查询用户创建的项目错误"), PROCESS_DEFINITION_IDS_IS_EMPTY(10158, "process definition ids is empty", "工作流IDS不能为空"), BATCH_COPY_PROCESS_DEFINITION_ERROR(10159, "batch copy process definition error", "复制工作流错误"), BATCH_MOVE_PROCESS_DEFINITION_ERROR(10160, "batch move process definition error", "移动工作流错误"), QUERY_WORKFLOW_LINEAGE_ERROR(10161, "query workflow lineage error", "查询血缘失败"), QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR(10162, "query authorized and user created project error error", "查询授权的和用户创建的项目错误"), DELETE_PROCESS_DEFINITION_BY_ID_FAIL(10163, "delete process definition by id fail, for there are {0} process instances in executing using it", "删除工作流定义失败,有[{0}]个运行中的工作流实例正在使用"), CHECK_OS_TENANT_CODE_ERROR(10164, "Please enter the English os tenant code", "请输入英文操作系统租户"), FORCE_TASK_SUCCESS_ERROR(10165, "force task success error", "强制成功任务实例错误"), TASK_INSTANCE_STATE_OPERATION_ERROR(10166, "the status of task instance {0} is {1},Cannot perform force success operation", "任务实例[{0}]的状态是[{1}],无法执行强制成功操作"), DATASOURCE_TYPE_NOT_EXIST(10167, "data source type not exist", "数据源类型不存在"), PROCESS_DEFINITION_NAME_EXIST(10168, "process definition name {0} already exists", "工作流定义名称[{0}]已存在"), DATASOURCE_DB_TYPE_ILLEGAL(10169, "datasource type illegal", "数据源类型参数不合法"), DATASOURCE_PORT_ILLEGAL(10170, "datasource port illegal", "数据源端口参数不合法"), DATASOURCE_OTHER_PARAMS_ILLEGAL(10171, "datasource other params illegal", "数据源其他参数不合法"), DATASOURCE_NAME_ILLEGAL(10172, "datasource name illegal", "数据源名称不合法"), DATASOURCE_HOST_ILLEGAL(10173, "datasource host illegal", "数据源HOST不合法"), UDF_FUNCTION_NOT_EXIST(20001, "UDF function not found", "UDF函数不存在"), UDF_FUNCTION_EXISTS(20002, "UDF function already exists", "UDF函数已存在"), RESOURCE_NOT_EXIST(20004, "resource not exist", "资源不存在"), RESOURCE_EXIST(20005, "resource already exists", "资源已存在"), RESOURCE_SUFFIX_NOT_SUPPORT_VIEW(20006, "resource suffix do not support online viewing", "资源文件后缀不支持查看"), RESOURCE_SIZE_EXCEED_LIMIT(20007, "upload resource file size exceeds limit", "上传资源文件大小超过限制"), RESOURCE_SUFFIX_FORBID_CHANGE(20008, "resource suffix not allowed to be modified", "资源文件后缀不支持修改"), UDF_RESOURCE_SUFFIX_NOT_JAR(20009, "UDF resource suffix name must be jar", "UDF资源文件后缀名只支持[jar]"), HDFS_COPY_FAIL(20010, "hdfs copy {0} -> {1} fail", "hdfs复制失败:[{0}] -> [{1}]"), RESOURCE_FILE_EXIST(20011, "resource file {0} already exists in hdfs,please delete it or change name!", "资源文件[{0}]在hdfs中已存在,请删除或修改资源名"), RESOURCE_FILE_NOT_EXIST(20012, "resource file {0} not exists in hdfs!", "资源文件[{0}]在hdfs中不存在"), UDF_RESOURCE_IS_BOUND(20013, "udf resource file is bound by UDF functions:{0}", "udf函数绑定了资源文件[{0}]"), RESOURCE_IS_USED(20014, "resource file is used by process definition", "资源文件被上线的流程定义使用了"), PARENT_RESOURCE_NOT_EXIST(20015, "parent resource not exist", "父资源文件不存在"), RESOURCE_NOT_EXIST_OR_NO_PERMISSION(20016, "resource not exist or no permission,please view the task node and remove error resource", "请检查任务节点并移除无权限或者已删除的资源"), RESOURCE_IS_AUTHORIZED(20017, "resource is authorized to user {0},suffix not allowed to be modified", "资源文件已授权其他用户[{0}],后缀不允许修改"), USER_NO_OPERATION_PERM(30001, "user has no operation privilege", "当前用户没有操作权限"), USER_NO_OPERATION_PROJECT_PERM(30002, "user {0} is not has project {1} permission", "当前用户[{0}]没有[{1}]项目的操作权限"), PROCESS_INSTANCE_NOT_EXIST(50001, "process instance {0} does not exist", "工作流实例[{0}]不存在"), PROCESS_INSTANCE_EXIST(50002, "process instance {0} already exists", "工作流实例[{0}]已存在"), PROCESS_DEFINE_NOT_EXIST(50003, "process definition {0} does not exist", "工作流定义[{0}]不存在"), PROCESS_DEFINE_NOT_RELEASE(50004, "process definition {0} not on line", "工作流定义[{0}]不是上线状态"), PROCESS_INSTANCE_ALREADY_CHANGED(50005, "the status of process instance {0} is already {1}", "工作流实例[{0}]的状态已经是[{1}]"), PROCESS_INSTANCE_STATE_OPERATION_ERROR(50006, "the status of process instance {0} is {1},Cannot perform {2} operation", "工作流实例[{0}]的状态是[{1}],无法执行[{2}]操作"), SUB_PROCESS_INSTANCE_NOT_EXIST(50007, "the task belong to process instance does not exist", "子工作流实例不存在"), PROCESS_DEFINE_NOT_ALLOWED_EDIT(50008, "process definition {0} does not allow edit", "工作流定义[{0}]不允许修改"), PROCESS_INSTANCE_EXECUTING_COMMAND(50009, "process instance {0} is executing the command, please wait ...", "工作流实例[{0}]正在执行命令,请稍等..."), PROCESS_INSTANCE_NOT_SUB_PROCESS_INSTANCE(50010, "process instance {0} is not sub process instance", "工作流实例[{0}]不是子工作流实例"), TASK_INSTANCE_STATE_COUNT_ERROR(50011, "task instance state count error", "查询各状态任务实例数错误"), COUNT_PROCESS_INSTANCE_STATE_ERROR(50012, "count process instance state error", "查询各状态流程实例数错误"), COUNT_PROCESS_DEFINITION_USER_ERROR(50013, "count process definition user error", "查询各用户流程定义数错误"), START_PROCESS_INSTANCE_ERROR(50014, "start process instance error", "运行工作流实例错误"), EXECUTE_PROCESS_INSTANCE_ERROR(50015, "execute process instance error", "操作工作流实例错误"), CHECK_PROCESS_DEFINITION_ERROR(50016, "check process definition error", "工作流定义错误"), QUERY_RECIPIENTS_AND_COPYERS_BY_PROCESS_DEFINITION_ERROR(50017, "query recipients and copyers by process definition error", "查询收件人和抄送人错误"), DATA_IS_NOT_VALID(50017, "data {0} not valid", "数据[{0}]无效"), DATA_IS_NULL(50018, "data {0} is null", "数据[{0}]不能为空"), PROCESS_NODE_HAS_CYCLE(50019, "process node has cycle", "流程节点间存在循环依赖"), PROCESS_NODE_S_PARAMETER_INVALID(50020, "process node {0} parameter invalid", "流程节点[{0}]参数无效"), PROCESS_DEFINE_STATE_ONLINE(50021, "process definition {0} is already on line", "工作流定义[{0}]已上线"), DELETE_PROCESS_DEFINE_BY_ID_ERROR(50022, "delete process definition by id error", "删除工作流定义错误"), SCHEDULE_CRON_STATE_ONLINE(50023, "the status of schedule {0} is already on line", "调度配置[{0}]已上线"), DELETE_SCHEDULE_CRON_BY_ID_ERROR(50024, "delete schedule by id error", "删除调度配置错误"), BATCH_DELETE_PROCESS_DEFINE_ERROR(50025, "batch delete process definition error", "批量删除工作流定义错误"), BATCH_DELETE_PROCESS_DEFINE_BY_IDS_ERROR(50026, "batch delete process definition by ids {0} error", "批量删除工作流定义[{0}]错误"), TENANT_NOT_SUITABLE(50027, "there is not any tenant suitable, please choose a tenant available.", "没有合适的租户,请选择可用的租户"), EXPORT_PROCESS_DEFINE_BY_ID_ERROR(50028, "export process definition by id error", "导出工作流定义错误"), BATCH_EXPORT_PROCESS_DEFINE_BY_IDS_ERROR(50028, "batch export process definition by ids error", "批量导出工作流定义错误"), IMPORT_PROCESS_DEFINE_ERROR(50029, "import process definition error", "导入工作流定义错误"), HDFS_NOT_STARTUP(60001, "hdfs not startup", "hdfs未启用"), /** * for monitor */ QUERY_DATABASE_STATE_ERROR(70001, "query database state error", "查询数据库状态错误"), QUERY_ZOOKEEPER_STATE_ERROR(70002, "query zookeeper state error", "查询zookeeper状态错误"), CREATE_ACCESS_TOKEN_ERROR(70010, "create access token error", "创建访问token错误"), GENERATE_TOKEN_ERROR(70011, "generate token error", "生成token错误"), QUERY_ACCESSTOKEN_LIST_PAGING_ERROR(70012, "query access token list paging error", "分页查询访问token列表错误"), UPDATE_ACCESS_TOKEN_ERROR(70013, "update access token error", "更新访问token错误"), DELETE_ACCESS_TOKEN_ERROR(70014, "delete access token error", "删除访问token错误"), ACCESS_TOKEN_NOT_EXIST(70015, "access token not exist", "访问token不存在"), COMMAND_STATE_COUNT_ERROR(80001, "task instance state count error", "查询各状态任务实例数错误"), NEGTIVE_SIZE_NUMBER_ERROR(80002, "query size number error", "查询size错误"), START_TIME_BIGGER_THAN_END_TIME_ERROR(80003, "start time bigger than end time error", "开始时间在结束时间之后错误"), QUEUE_COUNT_ERROR(90001, "queue count error", "查询队列数据错误"), KERBEROS_STARTUP_STATE(100001, "get kerberos startup state error", "获取kerberos启动状态错误"), //plugin PLUGIN_NOT_A_UI_COMPONENT(110001, "query plugin error, this plugin has no UI component", "查询插件错误,此插件无UI组件"), QUERY_PLUGINS_RESULT_IS_NULL(110002, "query plugins result is null", "查询插件为空"), QUERY_PLUGINS_ERROR(110003, "query plugins error", "查询插件错误"), QUERY_PLUGIN_DETAIL_RESULT_IS_NULL(110004, "query plugin detail result is null", "查询插件详情结果为空"), UPDATE_ALERT_PLUGIN_INSTANCE_ERROR(110005, "update alert plugin instance error", "更新告警组和告警组插件实例错误"), DELETE_ALERT_PLUGIN_INSTANCE_ERROR(110006, "delete alert plugin instance error", "删除告警组和告警组插件实例错误"), GET_ALERT_PLUGIN_INSTANCE_ERROR(110007, "get alert plugin instance error", "获取告警组和告警组插件实例错误"), CREATE_ALERT_PLUGIN_INSTANCE_ERROR(110008, "create alert plugin instance error", "创建告警组和告警组插件实例错误"), QUERY_ALL_ALERT_PLUGIN_INSTANCE_ERROR(110009, "query all alert plugin instance error", "查询所有告警实例失败"), PLUGIN_INSTANCE_ALREADY_EXIT(110010, "plugin instance already exit", "该告警插件实例已存在"), LIST_PAGING_ALERT_PLUGIN_INSTANCE_ERROR(110011, "query plugin instance page error", "分页查询告警实例失败"), DELETE_ALERT_PLUGIN_INSTANCE_ERROR_HAS_ALERT_GROUP_ASSOCIATED(110012, "failed to delete the alert instance, there is an alarm group associated with this alert instance", "删除告警实例失败,存在与此告警实例关联的警报组"); private final int code; private final String enMsg; private final String zhMsg; Status(int code, String enMsg, String zhMsg) { this.code = code; this.enMsg = enMsg; this.zhMsg = zhMsg; } public int getCode() { return this.code; } public String getMsg() { if (Locale.SIMPLIFIED_CHINESE.getLanguage().equals(LocaleContextHolder.getLocale().getLanguage())) { return this.zhMsg; } else { return this.enMsg; } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
/* * 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.dolphinscheduler.api.service; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.dao.entity.ProcessData; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.springframework.web.multipart.MultipartFile; import com.fasterxml.jackson.core.JsonProcessingException; /** * process definition service */ public interface ProcessDefinitionService { /** * create process definition * * @param loginUser login user * @param projectName project name * @param name process definition name * @param processDefinitionJson process definition json * @param desc description * @param locations locations for nodes * @param connects connects for nodes * @return create result code * @throws JsonProcessingException JsonProcessingException */ Map<String, Object> createProcessDefinition(User loginUser, String projectName, String name, String processDefinitionJson, String desc, String locations, String connects) throws JsonProcessingException; /** * query process definition list * * @param loginUser login user * @param projectName project name * @return definition list */ Map<String, Object> queryProcessDefinitionList(User loginUser, String projectName); /** * query process definition list paging * * @param loginUser login user * @param projectName project name * @param searchVal search value * @param pageNo page number * @param pageSize page size * @param userId user id * @return process definition page */ Map<String, Object> queryProcessDefinitionListPaging(User loginUser, String projectName, String searchVal, Integer pageNo, Integer pageSize, Integer userId); /** * query datail of process definition * * @param loginUser login user * @param projectName project name * @param processId process definition id * @return process definition detail */ Map<String, Object> queryProcessDefinitionById(User loginUser, String projectName, Integer processId); /** * query datail of process definition * * @param loginUser login user * @param projectName project name * @param processDefinitionName process definition name * @return process definition detail */ Map<String, Object> queryProcessDefinitionByName(User loginUser, String projectName, String processDefinitionName); /** * batch copy process definition * * @param loginUser loginUser * @param projectName projectName * @param processDefinitionIds processDefinitionIds * @param targetProjectId targetProjectId */ Map<String, Object> batchCopyProcessDefinition(User loginUser, String projectName, String processDefinitionIds, int targetProjectId); /** * batch move process definition * * @param loginUser loginUser * @param projectName projectName * @param processDefinitionIds processDefinitionIds * @param targetProjectId targetProjectId */ Map<String, Object> batchMoveProcessDefinition(User loginUser, String projectName, String processDefinitionIds, int targetProjectId); /** * update process definition * * @param loginUser login user * @param projectName project name * @param name process definition name * @param id process definition id * @param processDefinitionJson process definition json * @param desc description * @param locations locations for nodes * @param connects connects for nodes * @return update result code */ Map<String, Object> updateProcessDefinition(User loginUser, String projectName, int id, String name, String processDefinitionJson, String desc, String locations, String connects); /** * verify process definition name unique * * @param loginUser login user * @param projectName project name * @param name name * @return true if process definition name not exists, otherwise false */ Map<String, Object> verifyProcessDefinitionName(User loginUser, String projectName, String name); /** * delete process definition by id * * @param loginUser login user * @param projectName project name * @param processDefinitionId process definition id * @return delete result code */ Map<String, Object> deleteProcessDefinitionById(User loginUser, String projectName, Integer processDefinitionId); /** * release process definition: online / offline * * @param loginUser login user * @param projectName project name * @param id process definition id * @param releaseState release state * @return release result code */ Map<String, Object> releaseProcessDefinition(User loginUser, String projectName, int id, ReleaseState releaseState); /** * batch export process definition by ids * * @param loginUser login user * @param projectName project name * @param processDefinitionIds process definition ids * @param response http servlet response */ void batchExportProcessDefinitionByIds(User loginUser, String projectName, String processDefinitionIds, HttpServletResponse response); /** * import process definition * * @param loginUser login user * @param file process metadata json file * @param currentProjectName current project name * @return import process */ Map<String, Object> importProcessDefinition(User loginUser, MultipartFile file, String currentProjectName); /** * check the process definition node meets the specifications * * @param processData process data * @param processDefinitionJson process definition json * @return check result code */ Map<String, Object> checkProcessNodeList(ProcessData processData, String processDefinitionJson); /** * get task node details based on process definition * * @param defineId define id * @return task node list */ Map<String, Object> getTaskNodeListByDefinitionId(Integer defineId); /** * get task node details based on process definition * * @param defineIdList define id list * @return task node list */ Map<String, Object> getTaskNodeListByDefinitionIdList(String defineIdList); /** * query process definition all by project id * * @param projectId project id * @return process definitions in the project */ Map<String, Object> queryProcessDefinitionAllByProjectId(Integer projectId); /** * Encapsulates the TreeView structure * * @param processId process definition id * @param limit limit * @return tree view json data * @throws Exception exception */ Map<String, Object> viewTree(Integer processId, Integer limit) throws Exception; /** * switch the defined process definition verison * * @param loginUser login user * @param projectName project name * @param processDefinitionId process definition id * @param version the version user want to switch * @return switch process definition version result code */ Map<String, Object> switchProcessDefinitionVersion(User loginUser, String projectName , int processDefinitionId, long version); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
/* * 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.dolphinscheduler.api.service.impl; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_ID; import org.apache.dolphinscheduler.api.dto.ProcessMeta; import org.apache.dolphinscheduler.api.dto.treeview.Instance; import org.apache.dolphinscheduler.api.dto.treeview.TreeViewDto; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.ProcessDefinitionService; import org.apache.dolphinscheduler.api.service.ProcessDefinitionVersionService; import org.apache.dolphinscheduler.api.service.ProcessInstanceService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.service.SchedulerService; import org.apache.dolphinscheduler.api.utils.CheckUtils; import org.apache.dolphinscheduler.api.utils.FileUtils; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.exportprocess.ProcessAddTaskParam; import org.apache.dolphinscheduler.api.utils.exportprocess.TaskNodeParamFactory; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.AuthorizationType; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.TaskType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.graph.DAG; import org.apache.dolphinscheduler.common.model.TaskNode; import org.apache.dolphinscheduler.common.model.TaskNodeRelation; import org.apache.dolphinscheduler.common.process.ProcessDag; import org.apache.dolphinscheduler.common.process.Property; import org.apache.dolphinscheduler.common.process.ResourceInfo; import org.apache.dolphinscheduler.common.task.AbstractParameters; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.StreamUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.common.utils.TaskParametersUtils; import org.apache.dolphinscheduler.dao.entity.ProcessData; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionVersion; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper; import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper; import org.apache.dolphinscheduler.dao.utils.DagHelper; import org.apache.dolphinscheduler.service.permission.PermissionCheck; import org.apache.dolphinscheduler.service.process.ProcessService; import java.io.BufferedOutputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; /** * process definition service impl */ @Service public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements ProcessDefinitionService { private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class); private static final String PROCESSDEFINITIONID = "processDefinitionId"; private static final String RELEASESTATE = "releaseState"; private static final String TASKS = "tasks"; @Autowired private ProjectMapper projectMapper; @Autowired private ProjectService projectService; @Autowired private ProcessDefinitionVersionService processDefinitionVersionService; @Autowired private ProcessDefinitionMapper processDefineMapper; @Autowired private ProcessInstanceService processInstanceService; @Autowired private TaskInstanceMapper taskInstanceMapper; @Autowired private ScheduleMapper scheduleMapper; @Autowired private ProcessService processService; @Autowired private SchedulerService schedulerService; /** * create process definition * * @param loginUser login user * @param projectName project name * @param name process definition name * @param processDefinitionJson process definition json * @param desc description * @param locations locations for nodes * @param connects connects for nodes * @return create result code */ @Override public Map<String, Object> createProcessDefinition(User loginUser, String projectName, String name, String processDefinitionJson, String desc, String locations, String connects) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); // check project auth Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } ProcessDefinition processDefine = new ProcessDefinition(); Date now = new Date(); ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); Map<String, Object> checkProcessJson = checkProcessNodeList(processData, processDefinitionJson); if (checkProcessJson.get(Constants.STATUS) != Status.SUCCESS) { return checkProcessJson; } processDefine.setName(name); processDefine.setReleaseState(ReleaseState.OFFLINE); processDefine.setProjectId(project.getId()); processDefine.setUserId(loginUser.getId()); processDefine.setProcessDefinitionJson(processDefinitionJson); processDefine.setDescription(desc); processDefine.setLocations(locations); processDefine.setConnects(connects); processDefine.setTimeout(processData.getTimeout()); processDefine.setTenantId(processData.getTenantId()); processDefine.setModifyBy(loginUser.getUserName()); processDefine.setResourceIds(getResourceIds(processData)); //custom global params List<Property> globalParamsList = processData.getGlobalParams(); if (CollectionUtils.isNotEmpty(globalParamsList)) { Set<Property> globalParamsSet = new HashSet<>(globalParamsList); globalParamsList = new ArrayList<>(globalParamsSet); processDefine.setGlobalParamList(globalParamsList); } processDefine.setCreateTime(now); processDefine.setUpdateTime(now); processDefine.setFlag(Flag.YES); // save the new process definition processDefineMapper.insert(processDefine); // add process definition version long version = processDefinitionVersionService.addProcessDefinitionVersion(processDefine); processDefine.setVersion(version); processDefineMapper.updateVersionByProcessDefinitionId(processDefine.getId(), version); // return processDefinition object with ID result.put(Constants.DATA_LIST, processDefine.getId()); putMsg(result, Status.SUCCESS); return result; } /** * get resource ids * * @param processData process data * @return resource ids */ private String getResourceIds(ProcessData processData) { List<TaskNode> tasks = processData.getTasks(); Set<Integer> resourceIds = new HashSet<>(); StringBuilder sb = new StringBuilder(); if (CollectionUtils.isEmpty(tasks)) { return sb.toString(); } for (TaskNode taskNode : tasks) { String taskParameter = taskNode.getParams(); AbstractParameters params = TaskParametersUtils.getParameters(taskNode.getType(), taskParameter); if (params == null) { continue; } if (CollectionUtils.isNotEmpty(params.getResourceFilesList())) { Set<Integer> tempSet = params.getResourceFilesList(). stream() .filter(t -> t.getId() != 0) .map(ResourceInfo::getId) .collect(Collectors.toSet()); resourceIds.addAll(tempSet); } } for (int i : resourceIds) { if (sb.length() > 0) { sb.append(","); } sb.append(i); } return sb.toString(); } /** * query process definition list * * @param loginUser login user * @param projectName project name * @return definition list */ @Override public Map<String, Object> queryProcessDefinitionList(User loginUser, String projectName) { HashMap<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } List<ProcessDefinition> resourceList = processDefineMapper.queryAllDefinitionList(project.getId()); result.put(Constants.DATA_LIST, resourceList); putMsg(result, Status.SUCCESS); return result; } /** * query process definition list paging * * @param loginUser login user * @param projectName project name * @param searchVal search value * @param pageNo page number * @param pageSize page size * @param userId user id * @return process definition page */ @Override public Map<String, Object> queryProcessDefinitionListPaging(User loginUser, String projectName, String searchVal, Integer pageNo, Integer pageSize, Integer userId) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } Page<ProcessDefinition> page = new Page<>(pageNo, pageSize); IPage<ProcessDefinition> processDefinitionIPage = processDefineMapper.queryDefineListPaging( page, searchVal, userId, project.getId(), isAdmin(loginUser)); PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotalCount((int) processDefinitionIPage.getTotal()); pageInfo.setLists(processDefinitionIPage.getRecords()); result.put(Constants.DATA_LIST, pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * query datail of process definition * * @param loginUser login user * @param projectName project name * @param processId process definition id * @return process definition detail */ @Override public Map<String, Object> queryProcessDefinitionById(User loginUser, String projectName, Integer processId) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } ProcessDefinition processDefinition = processDefineMapper.selectById(processId); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId); } else { result.put(Constants.DATA_LIST, processDefinition); putMsg(result, Status.SUCCESS); } return result; } @Override public Map<String, Object> queryProcessDefinitionByName(User loginUser, String projectName, String processDefinitionName) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } ProcessDefinition processDefinition = processDefineMapper.queryByDefineName(project.getId(),processDefinitionName); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionName); } else { result.put(Constants.DATA_LIST, processDefinition); putMsg(result, Status.SUCCESS); } return result; } /** * update process definition * * @param loginUser login user * @param projectName project name * @param name process definition name * @param id process definition id * @param processDefinitionJson process definition json * @param desc description * @param locations locations for nodes * @param connects connects for nodes * @return update result code */ @Override public Map<String, Object> updateProcessDefinition(User loginUser, String projectName, int id, String name, String processDefinitionJson, String desc, String locations, String connects) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); Map<String, Object> checkProcessJson = checkProcessNodeList(processData, processDefinitionJson); if ((checkProcessJson.get(Constants.STATUS) != Status.SUCCESS)) { return checkProcessJson; } ProcessDefinition processDefine = processService.findProcessDefineById(id); // check process definition exists if (processDefine == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, id); return result; } if (processDefine.getReleaseState() == ReleaseState.ONLINE) { // online can not permit edit putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefine.getName()); return result; } if (!name.equals(processDefine.getName())) { // check whether the new process define name exist ProcessDefinition definition = processDefineMapper.verifyByDefineName(project.getId(), name); if (definition != null) { putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name); return result; } } // get the processdefinitionjson before saving,and then save the name and taskid String oldJson = processDefine.getProcessDefinitionJson(); processDefinitionJson = processService.changeJson(processData,oldJson); Date now = new Date(); processDefine.setId(id); processDefine.setName(name); processDefine.setReleaseState(ReleaseState.OFFLINE); processDefine.setProjectId(project.getId()); processDefine.setProcessDefinitionJson(processDefinitionJson); processDefine.setDescription(desc); processDefine.setLocations(locations); processDefine.setConnects(connects); processDefine.setTimeout(processData.getTimeout()); processDefine.setTenantId(processData.getTenantId()); processDefine.setModifyBy(loginUser.getUserName()); processDefine.setResourceIds(getResourceIds(processData)); //custom global params List<Property> globalParamsList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(processData.getGlobalParams())) { Set<Property> userDefParamsSet = new HashSet<>(processData.getGlobalParams()); globalParamsList = new ArrayList<>(userDefParamsSet); } processDefine.setGlobalParamList(globalParamsList); processDefine.setUpdateTime(now); processDefine.setFlag(Flag.YES); // add process definition version long version = processDefinitionVersionService.addProcessDefinitionVersion(processDefine); processDefine.setVersion(version); if (processDefineMapper.updateById(processDefine) > 0) { putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefineMapper.queryByDefineId(id)); } else { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); } return result; } /** * verify process definition name unique * * @param loginUser login user * @param projectName project name * @param name name * @return true if process definition name not exists, otherwise false */ @Override public Map<String, Object> verifyProcessDefinitionName(User loginUser, String projectName, String name) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultEnum = (Status) checkResult.get(Constants.STATUS); if (resultEnum != Status.SUCCESS) { return checkResult; } ProcessDefinition processDefinition = processDefineMapper.verifyByDefineName(project.getId(), name); if (processDefinition == null) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name); } return result; } /** * delete process definition by id * * @param loginUser login user * @param projectName project name * @param processDefinitionId process definition id * @return delete result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> deleteProcessDefinitionById(User loginUser, String projectName, Integer processDefinitionId) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultEnum = (Status) checkResult.get(Constants.STATUS); if (resultEnum != Status.SUCCESS) { return checkResult; } ProcessDefinition processDefinition = processDefineMapper.selectById(processDefinitionId); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionId); return result; } // Determine if the login user is the owner of the process definition if (loginUser.getId() != processDefinition.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } // check process definition is already online if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, processDefinitionId); return result; } // check process instances is already running List<ProcessInstance> processInstances = processInstanceService.queryByProcessDefineIdAndStatus(processDefinitionId, Constants.NOT_TERMINATED_STATES); if (CollectionUtils.isNotEmpty(processInstances)) { putMsg(result, Status.DELETE_PROCESS_DEFINITION_BY_ID_FAIL, processInstances.size()); return result; } // get the timing according to the process definition List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionId(processDefinitionId); if (!schedules.isEmpty() && schedules.size() > 1) { logger.warn("scheduler num is {},Greater than 1", schedules.size()); putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR); return result; } else if (schedules.size() == 1) { Schedule schedule = schedules.get(0); if (schedule.getReleaseState() == ReleaseState.OFFLINE) { scheduleMapper.deleteById(schedule.getId()); } else if (schedule.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, schedule.getId()); return result; } } int delete = processDefineMapper.deleteById(processDefinitionId); if (delete > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR); } return result; } /** * release process definition: online / offline * * @param loginUser login user * @param projectName project name * @param id process definition id * @param releaseState release state * @return release result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> releaseProcessDefinition(User loginUser, String projectName, int id, ReleaseState releaseState) { HashMap<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultEnum = (Status) checkResult.get(Constants.STATUS); if (resultEnum != Status.SUCCESS) { return checkResult; } // check state if (null == releaseState) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } ProcessDefinition processDefinition = processDefineMapper.selectById(id); switch (releaseState) { case ONLINE: // To check resources whether they are already cancel authorized or deleted String resourceIds = processDefinition.getResourceIds(); if (StringUtils.isNotBlank(resourceIds)) { Integer[] resourceIdArray = Arrays.stream(resourceIds.split(",")).map(Integer::parseInt).toArray(Integer[]::new); PermissionCheck<Integer> permissionCheck = new PermissionCheck<>(AuthorizationType.RESOURCE_FILE_ID, processService, resourceIdArray, loginUser.getId(), logger); try { permissionCheck.checkPermission(); } catch (Exception e) { logger.error(e.getMessage(), e); putMsg(result, Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION, RELEASESTATE); return result; } } processDefinition.setReleaseState(releaseState); processDefineMapper.updateById(processDefinition); break; case OFFLINE: processDefinition.setReleaseState(releaseState); processDefineMapper.updateById(processDefinition); List<Schedule> scheduleList = scheduleMapper.selectAllByProcessDefineArray( new int[]{processDefinition.getId()} ); for (Schedule schedule : scheduleList) { logger.info("set schedule offline, project id: {}, schedule id: {}, process definition id: {}", project.getId(), schedule.getId(), id); // set status schedule.setReleaseState(ReleaseState.OFFLINE); scheduleMapper.updateById(schedule); schedulerService.deleteSchedule(project.getId(), schedule.getId()); } break; default: putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } putMsg(result, Status.SUCCESS); return result; } /** * batch export process definition by ids */ @Override public void batchExportProcessDefinitionByIds(User loginUser, String projectName, String processDefinitionIds, HttpServletResponse response) { if (StringUtils.isEmpty(processDefinitionIds)) { return; } //export project info Project project = projectMapper.queryByName(projectName); //check user access for project Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return; } List<ProcessMeta> processDefinitionList = getProcessDefinitionList(processDefinitionIds); if (CollectionUtils.isNotEmpty(processDefinitionList)) { downloadProcessDefinitionFile(response, processDefinitionList); } } /** * get process definition list by ids */ private List<ProcessMeta> getProcessDefinitionList(String processDefinitionIds) { List<ProcessMeta> processDefinitionList = new ArrayList<>(); String[] processDefinitionIdArray = processDefinitionIds.split(","); for (String strProcessDefinitionId : processDefinitionIdArray) { //get workflow info int processDefinitionId = Integer.parseInt(strProcessDefinitionId); ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(processDefinitionId); if (null != processDefinition) { processDefinitionList.add(exportProcessMetaData(processDefinitionId, processDefinition)); } } return processDefinitionList; } /** * download the process definition file */ private void downloadProcessDefinitionFile(HttpServletResponse response, List<ProcessMeta> processDefinitionList) { response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE); BufferedOutputStream buff = null; ServletOutputStream out = null; try { out = response.getOutputStream(); buff = new BufferedOutputStream(out); buff.write(JSONUtils.toJsonString(processDefinitionList).getBytes(StandardCharsets.UTF_8)); buff.flush(); buff.close(); } catch (IOException e) { logger.warn("export process fail", e); } finally { if (null != buff) { try { buff.close(); } catch (Exception e) { logger.warn("export process buffer not close", e); } } if (null != out) { try { out.close(); } catch (Exception e) { logger.warn("export process output stream not close", e); } } } } /** * get export process metadata string * * @param processDefinitionId process definition id * @param processDefinition process definition * @return export process metadata string */ public String exportProcessMetaDataStr(Integer processDefinitionId, ProcessDefinition processDefinition) { //create workflow json file return JSONUtils.toJsonString(exportProcessMetaData(processDefinitionId, processDefinition)); } /** * get export process metadata string * * @param processDefinitionId process definition id * @param processDefinition process definition * @return export process metadata string */ public ProcessMeta exportProcessMetaData(Integer processDefinitionId, ProcessDefinition processDefinition) { //correct task param which has data source or dependent param String correctProcessDefinitionJson = addExportTaskNodeSpecialParam(processDefinition.getProcessDefinitionJson()); processDefinition.setProcessDefinitionJson(correctProcessDefinitionJson); //export process metadata ProcessMeta exportProcessMeta = new ProcessMeta(); exportProcessMeta.setProjectName(processDefinition.getProjectName()); exportProcessMeta.setProcessDefinitionName(processDefinition.getName()); exportProcessMeta.setProcessDefinitionJson(processDefinition.getProcessDefinitionJson()); exportProcessMeta.setProcessDefinitionDescription(processDefinition.getDescription()); exportProcessMeta.setProcessDefinitionLocations(processDefinition.getLocations()); exportProcessMeta.setProcessDefinitionConnects(processDefinition.getConnects()); //schedule info List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionId(processDefinitionId); if (!schedules.isEmpty()) { Schedule schedule = schedules.get(0); exportProcessMeta.setScheduleWarningType(schedule.getWarningType().toString()); exportProcessMeta.setScheduleWarningGroupId(schedule.getWarningGroupId()); exportProcessMeta.setScheduleStartTime(DateUtils.dateToString(schedule.getStartTime())); exportProcessMeta.setScheduleEndTime(DateUtils.dateToString(schedule.getEndTime())); exportProcessMeta.setScheduleCrontab(schedule.getCrontab()); exportProcessMeta.setScheduleFailureStrategy(String.valueOf(schedule.getFailureStrategy())); exportProcessMeta.setScheduleReleaseState(String.valueOf(ReleaseState.OFFLINE)); exportProcessMeta.setScheduleProcessInstancePriority(String.valueOf(schedule.getProcessInstancePriority())); exportProcessMeta.setScheduleWorkerGroupName(schedule.getWorkerGroup()); } //create workflow json file return exportProcessMeta; } /** * correct task param which has datasource or dependent * * @param processDefinitionJson processDefinitionJson * @return correct processDefinitionJson */ private String addExportTaskNodeSpecialParam(String processDefinitionJson) { ObjectNode jsonObject = JSONUtils.parseObject(processDefinitionJson); ArrayNode jsonArray = (ArrayNode) jsonObject.path(TASKS); for (int i = 0; i < jsonArray.size(); i++) { JsonNode taskNode = jsonArray.path(i); if (StringUtils.isNotEmpty(taskNode.path("type").asText())) { String taskType = taskNode.path("type").asText(); ProcessAddTaskParam addTaskParam = TaskNodeParamFactory.getByTaskType(taskType); if (null != addTaskParam) { addTaskParam.addExportSpecialParam(taskNode); } } } jsonObject.set(TASKS, jsonArray); return jsonObject.toString(); } /** * check task if has sub process * * @param taskType task type * @return if task has sub process return true else false */ private boolean checkTaskHasSubProcess(String taskType) { return taskType.equals(TaskType.SUB_PROCESS.name()); } /** * import process definition * * @param loginUser login user * @param file process metadata json file * @param currentProjectName current project name * @return import process */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> importProcessDefinition(User loginUser, MultipartFile file, String currentProjectName) { Map<String, Object> result = new HashMap<>(); String processMetaJson = FileUtils.file2String(file); List<ProcessMeta> processMetaList = JSONUtils.toList(processMetaJson, ProcessMeta.class); //check file content if (CollectionUtils.isEmpty(processMetaList)) { putMsg(result, Status.DATA_IS_NULL, "fileContent"); return result; } for (ProcessMeta processMeta : processMetaList) { if (!checkAndImportProcessDefinition(loginUser, currentProjectName, result, processMeta)) { return result; } } return result; } /** * check and import process definition */ private boolean checkAndImportProcessDefinition(User loginUser, String currentProjectName, Map<String, Object> result, ProcessMeta processMeta) { if (!checkImportanceParams(processMeta, result)) { return false; } //deal with process name String processDefinitionName = processMeta.getProcessDefinitionName(); //use currentProjectName to query Project targetProject = projectMapper.queryByName(currentProjectName); if (null != targetProject) { processDefinitionName = recursionProcessDefinitionName(targetProject.getId(), processDefinitionName, 1); } //unique check Map<String, Object> checkResult = verifyProcessDefinitionName(loginUser, currentProjectName, processDefinitionName); Status status = (Status) checkResult.get(Constants.STATUS); if (Status.SUCCESS.equals(status)) { putMsg(result, Status.SUCCESS); } else { result.putAll(checkResult); return false; } // get create process result Map<String, Object> createProcessResult = getCreateProcessResult(loginUser, currentProjectName, result, processMeta, processDefinitionName, addImportTaskNodeParam(loginUser, processMeta.getProcessDefinitionJson(), targetProject)); if (createProcessResult == null) { return false; } //create process definition Integer processDefinitionId = Objects.isNull(createProcessResult.get(Constants.DATA_LIST)) ? null : Integer.parseInt(createProcessResult.get(Constants.DATA_LIST).toString()); //scheduler param return getImportProcessScheduleResult(loginUser, currentProjectName, result, processMeta, processDefinitionName, processDefinitionId); } /** * get create process result */ private Map<String, Object> getCreateProcessResult(User loginUser, String currentProjectName, Map<String, Object> result, ProcessMeta processMeta, String processDefinitionName, String importProcessParam) { Map<String, Object> createProcessResult = null; try { createProcessResult = createProcessDefinition(loginUser , currentProjectName, processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp(), importProcessParam, processMeta.getProcessDefinitionDescription(), processMeta.getProcessDefinitionLocations(), processMeta.getProcessDefinitionConnects()); putMsg(result, Status.SUCCESS); } catch (Exception e) { logger.error("import process meta json data: {}", e.getMessage(), e); putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); } return createProcessResult; } /** * get import process schedule result */ private boolean getImportProcessScheduleResult(User loginUser, String currentProjectName, Map<String, Object> result, ProcessMeta processMeta, String processDefinitionName, Integer processDefinitionId) { if (null != processMeta.getScheduleCrontab() && null != processDefinitionId) { int scheduleInsert = importProcessSchedule(loginUser, currentProjectName, processMeta, processDefinitionName, processDefinitionId); if (0 == scheduleInsert) { putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); return false; } } return true; } /** * check importance params */ private boolean checkImportanceParams(ProcessMeta processMeta, Map<String, Object> result) { if (StringUtils.isEmpty(processMeta.getProjectName())) { putMsg(result, Status.DATA_IS_NULL, "projectName"); return false; } if (StringUtils.isEmpty(processMeta.getProcessDefinitionName())) { putMsg(result, Status.DATA_IS_NULL, "processDefinitionName"); return false; } if (StringUtils.isEmpty(processMeta.getProcessDefinitionJson())) { putMsg(result, Status.DATA_IS_NULL, "processDefinitionJson"); return false; } return true; } /** * import process add special task param * * @param loginUser login user * @param processDefinitionJson process definition json * @param targetProject target project * @return import process param */ private String addImportTaskNodeParam(User loginUser, String processDefinitionJson, Project targetProject) { ObjectNode jsonObject = JSONUtils.parseObject(processDefinitionJson); ArrayNode jsonArray = (ArrayNode) jsonObject.get(TASKS); //add sql and dependent param for (int i = 0; i < jsonArray.size(); i++) { JsonNode taskNode = jsonArray.path(i); String taskType = taskNode.path("type").asText(); ProcessAddTaskParam addTaskParam = TaskNodeParamFactory.getByTaskType(taskType); if (null != addTaskParam) { addTaskParam.addImportSpecialParam(taskNode); } } //recursive sub-process parameter correction map key for old process id value for new process id Map<Integer, Integer> subProcessIdMap = new HashMap<>(); List<Object> subProcessList = StreamUtils.asStream(jsonArray.elements()) .filter(elem -> checkTaskHasSubProcess(JSONUtils.parseObject(elem.toString()).path("type").asText())) .collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(subProcessList)) { importSubProcess(loginUser, targetProject, jsonArray, subProcessIdMap); } jsonObject.set(TASKS, jsonArray); return jsonObject.toString(); } /** * import process schedule * * @param loginUser login user * @param currentProjectName current project name * @param processMeta process meta data * @param processDefinitionName process definition name * @param processDefinitionId process definition id * @return insert schedule flag */ public int importProcessSchedule(User loginUser, String currentProjectName, ProcessMeta processMeta, String processDefinitionName, Integer processDefinitionId) { Date now = new Date(); Schedule scheduleObj = new Schedule(); scheduleObj.setProjectName(currentProjectName); scheduleObj.setProcessDefinitionId(processDefinitionId); scheduleObj.setProcessDefinitionName(processDefinitionName); scheduleObj.setCreateTime(now); scheduleObj.setUpdateTime(now); scheduleObj.setUserId(loginUser.getId()); scheduleObj.setUserName(loginUser.getUserName()); scheduleObj.setCrontab(processMeta.getScheduleCrontab()); if (null != processMeta.getScheduleStartTime()) { scheduleObj.setStartTime(DateUtils.stringToDate(processMeta.getScheduleStartTime())); } if (null != processMeta.getScheduleEndTime()) { scheduleObj.setEndTime(DateUtils.stringToDate(processMeta.getScheduleEndTime())); } if (null != processMeta.getScheduleWarningType()) { scheduleObj.setWarningType(WarningType.valueOf(processMeta.getScheduleWarningType())); } if (null != processMeta.getScheduleWarningGroupId()) { scheduleObj.setWarningGroupId(processMeta.getScheduleWarningGroupId()); } if (null != processMeta.getScheduleFailureStrategy()) { scheduleObj.setFailureStrategy(FailureStrategy.valueOf(processMeta.getScheduleFailureStrategy())); } if (null != processMeta.getScheduleReleaseState()) { scheduleObj.setReleaseState(ReleaseState.valueOf(processMeta.getScheduleReleaseState())); } if (null != processMeta.getScheduleProcessInstancePriority()) { scheduleObj.setProcessInstancePriority(Priority.valueOf(processMeta.getScheduleProcessInstancePriority())); } if (null != processMeta.getScheduleWorkerGroupName()) { scheduleObj.setWorkerGroup(processMeta.getScheduleWorkerGroupName()); } return scheduleMapper.insert(scheduleObj); } /** * check import process has sub process * recursion create sub process * * @param loginUser login user * @param targetProject target project * @param jsonArray process task array * @param subProcessIdMap correct sub process id map */ private void importSubProcess(User loginUser, Project targetProject, ArrayNode jsonArray, Map<Integer, Integer> subProcessIdMap) { for (int i = 0; i < jsonArray.size(); i++) { ObjectNode taskNode = (ObjectNode) jsonArray.path(i); String taskType = taskNode.path("type").asText(); if (!checkTaskHasSubProcess(taskType)) { continue; } //get sub process info ObjectNode subParams = (ObjectNode) taskNode.path("params"); Integer subProcessId = subParams.path(PROCESSDEFINITIONID).asInt(); ProcessDefinition subProcess = processDefineMapper.queryByDefineId(subProcessId); //check is sub process exist in db if (null == subProcess) { continue; } String subProcessJson = subProcess.getProcessDefinitionJson(); //check current project has sub process ProcessDefinition currentProjectSubProcess = processDefineMapper.queryByDefineName(targetProject.getId(), subProcess.getName()); if (null == currentProjectSubProcess) { ArrayNode subJsonArray = (ArrayNode) JSONUtils.parseObject(subProcess.getProcessDefinitionJson()).get(TASKS); List<Object> subProcessList = StreamUtils.asStream(subJsonArray.elements()) .filter(item -> checkTaskHasSubProcess(JSONUtils.parseObject(item.toString()).path("type").asText())) .collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(subProcessList)) { importSubProcess(loginUser, targetProject, subJsonArray, subProcessIdMap); //sub process processId correct if (!subProcessIdMap.isEmpty()) { for (Map.Entry<Integer, Integer> entry : subProcessIdMap.entrySet()) { String oldSubProcessId = "\"processDefinitionId\":" + entry.getKey(); String newSubProcessId = "\"processDefinitionId\":" + entry.getValue(); subProcessJson = subProcessJson.replaceAll(oldSubProcessId, newSubProcessId); } subProcessIdMap.clear(); } } //if sub-process recursion Date now = new Date(); //create sub process in target project ProcessDefinition processDefine = new ProcessDefinition(); processDefine.setName(subProcess.getName()); processDefine.setVersion(subProcess.getVersion()); processDefine.setReleaseState(subProcess.getReleaseState()); processDefine.setProjectId(targetProject.getId()); processDefine.setUserId(loginUser.getId()); processDefine.setProcessDefinitionJson(subProcessJson); processDefine.setDescription(subProcess.getDescription()); processDefine.setLocations(subProcess.getLocations()); processDefine.setConnects(subProcess.getConnects()); processDefine.setTimeout(subProcess.getTimeout()); processDefine.setTenantId(subProcess.getTenantId()); processDefine.setGlobalParams(subProcess.getGlobalParams()); processDefine.setCreateTime(now); processDefine.setUpdateTime(now); processDefine.setFlag(subProcess.getFlag()); processDefine.setWarningGroupId(subProcess.getWarningGroupId()); processDefineMapper.insert(processDefine); logger.info("create sub process, project: {}, process name: {}", targetProject.getName(), processDefine.getName()); //modify task node ProcessDefinition newSubProcessDefine = processDefineMapper.queryByDefineName(processDefine.getProjectId(), processDefine.getName()); if (null != newSubProcessDefine) { subProcessIdMap.put(subProcessId, newSubProcessDefine.getId()); subParams.put(PROCESSDEFINITIONID, newSubProcessDefine.getId()); taskNode.set("params", subParams); } } } } /** * check the process definition node meets the specifications * * @param processData process data * @param processDefinitionJson process definition json * @return check result code */ @Override public Map<String, Object> checkProcessNodeList(ProcessData processData, String processDefinitionJson) { Map<String, Object> result = new HashMap<>(); try { if (processData == null) { logger.error("process data is null"); putMsg(result, Status.DATA_IS_NOT_VALID, processDefinitionJson); return result; } // Check whether the task node is normal List<TaskNode> taskNodes = processData.getTasks(); if (taskNodes == null) { logger.error("process node info is empty"); putMsg(result, Status.DATA_IS_NULL, processDefinitionJson); return result; } // check has cycle if (graphHasCycle(taskNodes)) { logger.error("process DAG has cycle"); putMsg(result, Status.PROCESS_NODE_HAS_CYCLE); return result; } // check whether the process definition json is normal for (TaskNode taskNode : taskNodes) { if (!CheckUtils.checkTaskNodeParameters(taskNode.getParams(), taskNode.getType())) { logger.error("task node {} parameter invalid", taskNode.getName()); putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName()); return result; } // check extra params CheckUtils.checkOtherParams(taskNode.getExtras()); } putMsg(result, Status.SUCCESS); } catch (Exception e) { result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR); result.put(Constants.MSG, e.getMessage()); } return result; } /** * get task node details based on process definition * * @param defineId define id * @return task node list */ @Override public Map<String, Object> getTaskNodeListByDefinitionId(Integer defineId) { Map<String, Object> result = new HashMap<>(); ProcessDefinition processDefinition = processDefineMapper.selectById(defineId); if (processDefinition == null) { logger.info("process define not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineId); return result; } String processDefinitionJson = processDefinition.getProcessDefinitionJson(); ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); //process data check if (null == processData) { logger.error("process data is null"); putMsg(result, Status.DATA_IS_NOT_VALID, processDefinitionJson); return result; } List<TaskNode> taskNodeList = (processData.getTasks() == null) ? new ArrayList<>() : processData.getTasks(); result.put(Constants.DATA_LIST, taskNodeList); putMsg(result, Status.SUCCESS); return result; } /** * get task node details based on process definition * * @param defineIdList define id list * @return task node list */ @Override public Map<String, Object> getTaskNodeListByDefinitionIdList(String defineIdList) { Map<String, Object> result = new HashMap<>(); Map<Integer, List<TaskNode>> taskNodeMap = new HashMap<>(); String[] idList = defineIdList.split(","); List<Integer> idIntList = new ArrayList<>(); for (String definitionId : idList) { idIntList.add(Integer.parseInt(definitionId)); } Integer[] idArray = idIntList.toArray(new Integer[0]); List<ProcessDefinition> processDefinitionList = processDefineMapper.queryDefinitionListByIdList(idArray); if (CollectionUtils.isEmpty(processDefinitionList)) { logger.info("process definition not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineIdList); return result; } for (ProcessDefinition processDefinition : processDefinitionList) { String processDefinitionJson = processDefinition.getProcessDefinitionJson(); ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); List<TaskNode> taskNodeList = (processData.getTasks() == null) ? new ArrayList<>() : processData.getTasks(); taskNodeMap.put(processDefinition.getId(), taskNodeList); } result.put(Constants.DATA_LIST, taskNodeMap); putMsg(result, Status.SUCCESS); return result; } /** * query process definition all by project id * * @param projectId project id * @return process definitions in the project */ @Override public Map<String, Object> queryProcessDefinitionAllByProjectId(Integer projectId) { HashMap<String, Object> result = new HashMap<>(); List<ProcessDefinition> resourceList = processDefineMapper.queryAllDefinitionList(projectId); result.put(Constants.DATA_LIST, resourceList); putMsg(result, Status.SUCCESS); return result; } /** * Encapsulates the TreeView structure * * @param processId process definition id * @param limit limit * @return tree view json data * @throws Exception exception */ @Override public Map<String, Object> viewTree(Integer processId, Integer limit) throws Exception { Map<String, Object> result = new HashMap<>(); ProcessDefinition processDefinition = processDefineMapper.selectById(processId); if (null == processDefinition) { logger.info("process define not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinition); return result; } DAG<String, TaskNode, TaskNodeRelation> dag = genDagGraph(processDefinition); /** * nodes that is running */ Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>(); /** * nodes that is waiting torun */ Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>(); /** * List of process instances */ List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineId(processId, limit); for (ProcessInstance processInstance : processInstanceList) { processInstance.setDuration(DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); } if (limit > processInstanceList.size()) { limit = processInstanceList.size(); } TreeViewDto parentTreeViewDto = new TreeViewDto(); parentTreeViewDto.setName("DAG"); parentTreeViewDto.setType(""); // Specify the process definition, because it is a TreeView for a process definition for (int i = limit - 1; i >= 0; i--) { ProcessInstance processInstance = processInstanceList.get(i); Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime(); parentTreeViewDto.getInstances().add(new Instance(processInstance.getId(), processInstance.getName(), "", processInstance.getState().toString() , processInstance.getStartTime(), endTime, processInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime()))); } List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>(); parentTreeViewDtoList.add(parentTreeViewDto); // Here is the encapsulation task instance for (String startNode : dag.getBeginNode()) { runningNodeMap.put(startNode, parentTreeViewDtoList); } while (Stopper.isRunning()) { Set<String> postNodeList = null; Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<String, List<TreeViewDto>> en = iter.next(); String nodeName = en.getKey(); parentTreeViewDtoList = en.getValue(); TreeViewDto treeViewDto = new TreeViewDto(); treeViewDto.setName(nodeName); TaskNode taskNode = dag.getNode(nodeName); treeViewDto.setType(taskNode.getType()); //set treeViewDto instances for (int i = limit - 1; i >= 0; i--) { ProcessInstance processInstance = processInstanceList.get(i); TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndName(processInstance.getId(), nodeName); if (taskInstance == null) { treeViewDto.getInstances().add(new Instance(-1, "not running", "null")); } else { Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime(); Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime(); int subProcessId = 0; /** * if process is sub process, the return sub id, or sub id=0 */ if (taskInstance.getTaskType().equals(TaskType.SUB_PROCESS.name())) { String taskJson = taskInstance.getTaskJson(); taskNode = JSONUtils.parseObject(taskJson, TaskNode.class); subProcessId = Integer.parseInt(JSONUtils.parseObject( taskNode.getParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_ID).asText()); } treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(), taskInstance.getTaskType(), taskInstance.getState().toString() , taskInstance.getStartTime(), taskInstance.getEndTime(), taskInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessId)); } } for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) { pTreeViewDto.getChildren().add(treeViewDto); } postNodeList = dag.getSubsequentNodes(nodeName); if (CollectionUtils.isNotEmpty(postNodeList)) { for (String nextNodeName : postNodeList) { List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeName); if (CollectionUtils.isEmpty(treeViewDtoList)) { treeViewDtoList = new ArrayList<>(); } treeViewDtoList.add(treeViewDto); waitingRunningNodeMap.put(nextNodeName, treeViewDtoList); } } runningNodeMap.remove(nodeName); } if (waitingRunningNodeMap == null || waitingRunningNodeMap.size() == 0) { break; } else { runningNodeMap.putAll(waitingRunningNodeMap); waitingRunningNodeMap.clear(); } } result.put(Constants.DATA_LIST, parentTreeViewDto); result.put(Constants.STATUS, Status.SUCCESS); result.put(Constants.MSG, Status.SUCCESS.getMsg()); return result; } /** * Generate the DAG Graph based on the process definition id * * @param processDefinition process definition * @return dag graph */ private DAG<String, TaskNode, TaskNodeRelation> genDagGraph(ProcessDefinition processDefinition) { String processDefinitionJson = processDefinition.getProcessDefinitionJson(); ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); //check process data if (null != processData) { List<TaskNode> taskNodeList = processData.getTasks(); processDefinition.setGlobalParamList(processData.getGlobalParams()); ProcessDag processDag = DagHelper.getProcessDag(taskNodeList); // Generate concrete Dag to be executed return DagHelper.buildDagGraph(processDag); } return new DAG<>(); } /** * whether the graph has a ring * * @param taskNodeResponseList task node response list * @return if graph has cycle flag */ private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) { DAG<String, TaskNode, String> graph = new DAG<>(); // Fill the vertices for (TaskNode taskNodeResponse : taskNodeResponseList) { graph.addNode(taskNodeResponse.getName(), taskNodeResponse); } // Fill edge relations for (TaskNode taskNodeResponse : taskNodeResponseList) { taskNodeResponse.getPreTasks(); List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(), String.class); if (CollectionUtils.isNotEmpty(preTasks)) { for (String preTask : preTasks) { if (!graph.addEdge(preTask, taskNodeResponse.getName())) { return true; } } } } return graph.hasCycle(); } private String recursionProcessDefinitionName(Integer projectId, String processDefinitionName, int num) { ProcessDefinition processDefinition = processDefineMapper.queryByDefineName(projectId, processDefinitionName); if (processDefinition != null) { if (num > 1) { String str = processDefinitionName.substring(0, processDefinitionName.length() - 3); processDefinitionName = str + "(" + num + ")"; } else { processDefinitionName = processDefinition.getName() + "(" + num + ")"; } } else { return processDefinitionName; } return recursionProcessDefinitionName(projectId, processDefinitionName, num + 1); } private Map<String, Object> copyProcessDefinition(User loginUser, Integer processId, Project targetProject) throws JsonProcessingException { Map<String, Object> result = new HashMap<>(); ProcessDefinition processDefinition = processDefineMapper.selectById(processId); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId); return result; } else { return createProcessDefinition( loginUser, targetProject.getName(), processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp(), processDefinition.getProcessDefinitionJson(), processDefinition.getDescription(), processDefinition.getLocations(), processDefinition.getConnects()); } } /** * batch copy process definition * * @param loginUser loginUser * @param projectName projectName * @param processDefinitionIds processDefinitionIds * @param targetProjectId targetProjectId */ @Override public Map<String, Object> batchCopyProcessDefinition(User loginUser, String projectName, String processDefinitionIds, int targetProjectId) { Map<String, Object> result = new HashMap<>(); List<String> failedProcessList = new ArrayList<>(); if (StringUtils.isEmpty(processDefinitionIds)) { putMsg(result, Status.PROCESS_DEFINITION_IDS_IS_EMPTY, processDefinitionIds); return result; } //check src project auth Map<String, Object> checkResult = checkProjectAndAuth(loginUser, projectName); if (checkResult != null) { return checkResult; } Project targetProject = projectMapper.queryDetailById(targetProjectId); if (targetProject == null) { putMsg(result, Status.PROJECT_NOT_FOUNT, targetProjectId); return result; } if (!(targetProject.getName()).equals(projectName)) { Map<String, Object> checkTargetProjectResult = checkProjectAndAuth(loginUser, targetProject.getName()); if (checkTargetProjectResult != null) { return checkTargetProjectResult; } } String[] processDefinitionIdList = processDefinitionIds.split(Constants.COMMA); doBatchCopyProcessDefinition(loginUser, targetProject, failedProcessList, processDefinitionIdList); checkBatchOperateResult(projectName, targetProject.getName(), result, failedProcessList, true); return result; } /** * batch move process definition * * @param loginUser loginUser * @param projectName projectName * @param processDefinitionIds processDefinitionIds * @param targetProjectId targetProjectId */ @Override public Map<String, Object> batchMoveProcessDefinition(User loginUser, String projectName, String processDefinitionIds, int targetProjectId) { Map<String, Object> result = new HashMap<>(); List<String> failedProcessList = new ArrayList<>(); //check src project auth Map<String, Object> checkResult = checkProjectAndAuth(loginUser, projectName); if (checkResult != null) { return checkResult; } if (StringUtils.isEmpty(processDefinitionIds)) { putMsg(result, Status.PROCESS_DEFINITION_IDS_IS_EMPTY, processDefinitionIds); return result; } Project targetProject = projectMapper.queryDetailById(targetProjectId); if (targetProject == null) { putMsg(result, Status.PROJECT_NOT_FOUNT, targetProjectId); return result; } if (!(targetProject.getName()).equals(projectName)) { Map<String, Object> checkTargetProjectResult = checkProjectAndAuth(loginUser, targetProject.getName()); if (checkTargetProjectResult != null) { return checkTargetProjectResult; } } String[] processDefinitionIdList = processDefinitionIds.split(Constants.COMMA); doBatchMoveProcessDefinition(targetProject, failedProcessList, processDefinitionIdList); checkBatchOperateResult(projectName, targetProject.getName(), result, failedProcessList, false); return result; } /** * switch the defined process definition verison * * @param loginUser login user * @param projectName project name * @param processDefinitionId process definition id * @param version the version user want to switch * @return switch process definition version result code */ @Override public Map<String, Object> switchProcessDefinitionVersion(User loginUser, String projectName , int processDefinitionId, long version) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); // check project auth Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(processDefinitionId); if (Objects.isNull(processDefinition)) { putMsg(result , Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR , processDefinitionId); return result; } ProcessDefinitionVersion processDefinitionVersion = processDefinitionVersionService .queryByProcessDefinitionIdAndVersion(processDefinitionId, version); if (Objects.isNull(processDefinitionVersion)) { putMsg(result , Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR , processDefinitionId , version); return result; } processDefinition.setVersion(processDefinitionVersion.getVersion()); processDefinition.setProcessDefinitionJson(processDefinitionVersion.getProcessDefinitionJson()); processDefinition.setDescription(processDefinitionVersion.getDescription()); processDefinition.setLocations(processDefinitionVersion.getLocations()); processDefinition.setConnects(processDefinitionVersion.getConnects()); processDefinition.setTimeout(processDefinitionVersion.getTimeout()); processDefinition.setGlobalParams(processDefinitionVersion.getGlobalParams()); processDefinition.setUpdateTime(new Date()); processDefinition.setWarningGroupId(processDefinitionVersion.getWarningGroupId()); processDefinition.setResourceIds(processDefinitionVersion.getResourceIds()); if (processDefineMapper.updateById(processDefinition) > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR); } return result; } /** * do batch move process definition * * @param targetProject targetProject * @param failedProcessList failedProcessList * @param processDefinitionIdList processDefinitionIdList */ private void doBatchMoveProcessDefinition(Project targetProject, List<String> failedProcessList, String[] processDefinitionIdList) { for (String processDefinitionId : processDefinitionIdList) { try { Map<String, Object> moveProcessDefinitionResult = moveProcessDefinition(Integer.valueOf(processDefinitionId), targetProject); if (!Status.SUCCESS.equals(moveProcessDefinitionResult.get(Constants.STATUS))) { setFailedProcessList(failedProcessList, processDefinitionId); logger.error((String) moveProcessDefinitionResult.get(Constants.MSG)); } } catch (Exception e) { setFailedProcessList(failedProcessList, processDefinitionId); } } } /** * batch copy process definition * * @param loginUser loginUser * @param targetProject targetProject * @param failedProcessList failedProcessList * @param processDefinitionIdList processDefinitionIdList */ private void doBatchCopyProcessDefinition(User loginUser, Project targetProject, List<String> failedProcessList, String[] processDefinitionIdList) { for (String processDefinitionId : processDefinitionIdList) { try { Map<String, Object> copyProcessDefinitionResult = copyProcessDefinition(loginUser, Integer.valueOf(processDefinitionId), targetProject); if (!Status.SUCCESS.equals(copyProcessDefinitionResult.get(Constants.STATUS))) { setFailedProcessList(failedProcessList, processDefinitionId); logger.error((String) copyProcessDefinitionResult.get(Constants.MSG)); } } catch (Exception e) { setFailedProcessList(failedProcessList, processDefinitionId); } } } /** * set failed processList * * @param failedProcessList failedProcessList * @param processDefinitionId processDefinitionId */ private void setFailedProcessList(List<String> failedProcessList, String processDefinitionId) { ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(Integer.valueOf(processDefinitionId)); if (processDefinition != null) { failedProcessList.add(processDefinitionId + "[" + processDefinition.getName() + "]"); } else { failedProcessList.add(processDefinitionId + "[null]"); } } /** * check project and auth * * @param loginUser loginUser * @param projectName projectName */ private Map<String, Object> checkProjectAndAuth(User loginUser, String projectName) { Project project = projectMapper.queryByName(projectName); //check user access for project Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } return null; } /** * move process definition * * @param processId processId * @param targetProject targetProject * @return move result code */ private Map<String, Object> moveProcessDefinition(Integer processId, Project targetProject) { Map<String, Object> result = new HashMap<>(); ProcessDefinition processDefinition = processDefineMapper.selectById(processId); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId); return result; } processDefinition.setProjectId(targetProject.getId()); processDefinition.setUpdateTime(new Date()); if (processDefineMapper.updateById(processDefinition) > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); } return result; } /** * check batch operate result * * @param srcProjectName srcProjectName * @param targetProjectName targetProjectName * @param result result * @param failedProcessList failedProcessList * @param isCopy isCopy */ private void checkBatchOperateResult(String srcProjectName, String targetProjectName, Map<String, Object> result, List<String> failedProcessList, boolean isCopy) { if (!failedProcessList.isEmpty()) { if (isCopy) { putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR, srcProjectName, targetProjectName, String.join(",", failedProcessList)); } else { putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR, srcProjectName, targetProjectName, String.join(",", failedProcessList)); } } else { putMsg(result, Status.SUCCESS); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionVersionServiceImpl.java
/* * 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.dolphinscheduler.api.service.impl; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.ProcessDefinitionVersionService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionVersion; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionVersionMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.ImmutableMap; /** * process definition version service impl */ @Service public class ProcessDefinitionVersionServiceImpl extends BaseServiceImpl implements ProcessDefinitionVersionService { @Autowired private ProcessDefinitionVersionMapper processDefinitionVersionMapper; @Autowired private ProjectService projectService; @Autowired private ProjectMapper projectMapper; /** * add the newest version of one process definition * * @param processDefinition the process definition that need to record version * @return the newest version number of this process definition */ @Override public long addProcessDefinitionVersion(ProcessDefinition processDefinition) { long version = this.queryMaxVersionByProcessDefinitionId(processDefinition.getId()) + 1; ProcessDefinitionVersion processDefinitionVersion = ProcessDefinitionVersion .newBuilder() .processDefinitionId(processDefinition.getId()) .version(version) .processDefinitionJson(processDefinition.getProcessDefinitionJson()) .description(processDefinition.getDescription()) .locations(processDefinition.getLocations()) .connects(processDefinition.getConnects()) .timeout(processDefinition.getTimeout()) .globalParams(processDefinition.getGlobalParams()) .createTime(processDefinition.getUpdateTime()) .warningGroupId(processDefinition.getWarningGroupId()) .resourceIds(processDefinition.getResourceIds()) .build(); processDefinitionVersionMapper.insert(processDefinitionVersion); return version; } /** * query the max version number by the process definition id * * @param processDefinitionId process definition id * @return the max version number of this id */ private long queryMaxVersionByProcessDefinitionId(int processDefinitionId) { Long maxVersion = processDefinitionVersionMapper.queryMaxVersionByProcessDefinitionId(processDefinitionId); if (Objects.isNull(maxVersion)) { return 0L; } else { return maxVersion; } } /** * query the pagination versions info by one certain process definition id * * @param loginUser login user info to check auth * @param projectName process definition project name * @param pageNo page number * @param pageSize page size * @param processDefinitionId process definition id * @return the pagination process definition versions info of the certain process definition */ @Override public Map<String, Object> queryProcessDefinitionVersions(User loginUser, String projectName, int pageNo, int pageSize, int processDefinitionId) { Map<String, Object> result = new HashMap<>(); // check the if pageNo or pageSize less than 1 if (pageNo <= 0 || pageSize <= 0) { putMsg(result , Status.QUERY_PROCESS_DEFINITION_VERSIONS_PAGE_NO_OR_PAGE_SIZE_LESS_THAN_1_ERROR , pageNo , pageSize); return result; } Project project = projectMapper.queryByName(projectName); // check project auth Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } PageInfo<ProcessDefinitionVersion> pageInfo = new PageInfo<>(pageNo, pageSize); Page<ProcessDefinitionVersion> page = new Page<>(pageNo, pageSize); IPage<ProcessDefinitionVersion> processDefinitionVersionsPaging = processDefinitionVersionMapper.queryProcessDefinitionVersionsPaging(page, processDefinitionId); List<ProcessDefinitionVersion> processDefinitionVersions = processDefinitionVersionsPaging.getRecords(); pageInfo.setLists(processDefinitionVersions); pageInfo.setTotalCount((int) processDefinitionVersionsPaging.getTotal()); return ImmutableMap.of( Constants.MSG, Status.SUCCESS.getMsg() , Constants.STATUS, Status.SUCCESS , Constants.DATA_LIST, pageInfo); } /** * query one certain process definition version by version number and process definition id * * @param processDefinitionId process definition id * @param version version number * @return the process definition version info */ @Override public ProcessDefinitionVersion queryByProcessDefinitionIdAndVersion(int processDefinitionId, long version) { return processDefinitionVersionMapper.queryByProcessDefinitionIdAndVersion(processDefinitionId, version); } /** * delete one certain process definition by version number and process definition id * * @param loginUser login user info to check auth * @param projectName process definition project name * @param processDefinitionId process definition id * @param version version number * @return delele result code */ @Override public Map<String, Object> deleteByProcessDefinitionIdAndVersion(User loginUser, String projectName, int processDefinitionId, long version) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); // check project auth Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } processDefinitionVersionMapper.deleteByProcessDefinitionIdAndVersion(processDefinitionId, version); putMsg(result, Status.SUCCESS); return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionVersionServiceTest.java
/* * 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.dolphinscheduler.api.service; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionVersionServiceImpl; import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionVersion; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionVersionMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import java.text.MessageFormat; import java.util.HashMap; import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; /** * process definition version service test */ @RunWith(MockitoJUnitRunner.class) public class ProcessDefinitionVersionServiceTest { @InjectMocks private ProcessDefinitionVersionServiceImpl processDefinitionVersionService; @Mock private ProcessDefinitionVersionMapper processDefinitionVersionMapper; @Mock private ProjectMapper projectMapper; @Mock private ProjectServiceImpl projectService; @Test public void testAddProcessDefinitionVersion() { long expectedVersion = 5L; ProcessDefinition processDefinition = getProcessDefinition(); Mockito.when(processDefinitionVersionMapper .queryMaxVersionByProcessDefinitionId(processDefinition.getId())) .thenReturn(expectedVersion); long version = processDefinitionVersionService.addProcessDefinitionVersion(processDefinition); Assert.assertEquals(expectedVersion + 1, version); } @Test @SuppressWarnings("unchecked") public void testQueryProcessDefinitionVersions() { // pageNo <= 0 int pageNo = -1; int pageSize = 10; int processDefinitionId = 66; String projectName = "project_test1"; User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> resultMap1 = processDefinitionVersionService.queryProcessDefinitionVersions( loginUser , projectName , pageNo , pageSize , processDefinitionId); Assert.assertEquals(Status.QUERY_PROCESS_DEFINITION_VERSIONS_PAGE_NO_OR_PAGE_SIZE_LESS_THAN_1_ERROR , resultMap1.get(Constants.STATUS)); // pageSize <= 0 pageNo = 1; pageSize = -1; Map<String, Object> resultMap2 = processDefinitionVersionService.queryProcessDefinitionVersions( loginUser , projectName , pageNo , pageSize , processDefinitionId); Assert.assertEquals(Status.QUERY_PROCESS_DEFINITION_VERSIONS_PAGE_NO_OR_PAGE_SIZE_LESS_THAN_1_ERROR , resultMap2.get(Constants.STATUS)); Map<String, Object> res = new HashMap<>(); putMsg(res, Status.PROJECT_NOT_FOUNT); Project project = getProject(projectName); Mockito.when(projectMapper.queryByName(projectName)) .thenReturn(project); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)) .thenReturn(res); // project auth fail pageNo = 1; pageSize = 10; Map<String, Object> resultMap3 = processDefinitionVersionService.queryProcessDefinitionVersions( loginUser , projectName , pageNo , pageSize , processDefinitionId); Assert.assertEquals(Status.PROJECT_NOT_FOUNT, resultMap3.get(Constants.STATUS)); putMsg(res, Status.SUCCESS); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)) .thenReturn(res); ProcessDefinitionVersion processDefinitionVersion = getProcessDefinitionVersion(getProcessDefinition()); Mockito.when(processDefinitionVersionMapper .queryProcessDefinitionVersionsPaging(Mockito.any(Page.class), Mockito.eq(processDefinitionId))) .thenReturn(new Page<ProcessDefinitionVersion>() .setRecords(Lists.newArrayList(processDefinitionVersion))); Map<String, Object> resultMap4 = processDefinitionVersionService.queryProcessDefinitionVersions( loginUser , projectName , pageNo , pageSize , processDefinitionId); Assert.assertEquals(Status.SUCCESS, resultMap4.get(Constants.STATUS)); Assert.assertEquals(processDefinitionVersion , ((PageInfo<ProcessDefinitionVersion>) resultMap4.get(Constants.DATA_LIST)) .getLists().get(0)); } @Test public void testQueryByProcessDefinitionIdAndVersion() { ProcessDefinitionVersion expectedProcessDefinitionVersion = getProcessDefinitionVersion(getProcessDefinition()); int processDefinitionId = 66; long version = 10; Mockito.when(processDefinitionVersionMapper.queryByProcessDefinitionIdAndVersion(processDefinitionId, version)) .thenReturn(expectedProcessDefinitionVersion); ProcessDefinitionVersion processDefinitionVersion = processDefinitionVersionService .queryByProcessDefinitionIdAndVersion(processDefinitionId, version); Assert.assertEquals(expectedProcessDefinitionVersion, processDefinitionVersion); } @Test public void testDeleteByProcessDefinitionIdAndVersion() { String projectName = "project_test1"; int processDefinitionId = 66; long version = 10; Project project = getProject(projectName); Mockito.when(projectMapper.queryByName(projectName)) .thenReturn(project); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); // project auth fail Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)) .thenReturn(new HashMap<>()); Map<String, Object> resultMap1 = processDefinitionVersionService.deleteByProcessDefinitionIdAndVersion( loginUser , projectName , processDefinitionId , version); Assert.assertEquals(0, resultMap1.size()); Map<String, Object> res = new HashMap<>(); putMsg(res, Status.SUCCESS); Mockito.when(processDefinitionVersionMapper.deleteByProcessDefinitionIdAndVersion(processDefinitionId, version)) .thenReturn(1); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)) .thenReturn(res); Map<String, Object> resultMap2 = processDefinitionVersionService.deleteByProcessDefinitionIdAndVersion( loginUser , projectName , processDefinitionId , version); Assert.assertEquals(Status.SUCCESS, resultMap2.get(Constants.STATUS)); } /** * get mock processDefinitionVersion by processDefinition * * @return processDefinitionVersion */ private ProcessDefinitionVersion getProcessDefinitionVersion(ProcessDefinition processDefinition) { return ProcessDefinitionVersion .newBuilder() .processDefinitionId(processDefinition.getId()) .version(1) .processDefinitionJson(processDefinition.getProcessDefinitionJson()) .description(processDefinition.getDescription()) .locations(processDefinition.getLocations()) .connects(processDefinition.getConnects()) .timeout(processDefinition.getTimeout()) .globalParams(processDefinition.getGlobalParams()) .createTime(processDefinition.getUpdateTime()) .warningGroupId(processDefinition.getWarningGroupId()) .resourceIds(processDefinition.getResourceIds()) .build(); } /** * get mock processDefinition * * @return ProcessDefinition */ private ProcessDefinition getProcessDefinition() { ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setId(66); processDefinition.setName("test_pdf"); processDefinition.setProjectId(2); processDefinition.setTenantId(1); processDefinition.setDescription(""); return processDefinition; } /** * get mock Project * * @param projectName projectName * @return Project */ private Project getProject(String projectName) { Project project = new Project(); project.setId(1); project.setName(projectName); project.setUserId(1); return project; } private void putMsg(Map<String, Object> result, Status status, Object... statusParams) { result.put(Constants.STATUS, status); if (statusParams != null && statusParams.length > 0) { result.put(Constants.MSG, MessageFormat.format(status.getMsg(), statusParams)); } else { result.put(Constants.MSG, status.getMsg()); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.java
/* * 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.dolphinscheduler.dao.mapper; import org.apache.dolphinscheduler.dao.entity.DefinitionGroupByUser; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; /** * process definition mapper interface */ public interface ProcessDefinitionMapper extends BaseMapper<ProcessDefinition> { /** * verify process definition by name * * @param projectId projectId * @param name name * @return process definition */ ProcessDefinition verifyByDefineName(@Param("projectId") int projectId, @Param("processDefinitionName") String name); /** * query process definition by name * * @param projectId projectId * @param name name * @return process definition */ ProcessDefinition queryByDefineName(@Param("projectId") int projectId, @Param("processDefinitionName") String name); /** * query process definition by id * * @param processDefineId processDefineId * @return process definition */ ProcessDefinition queryByDefineId(@Param("processDefineId") int processDefineId); /** * process definition page * * @param page page * @param searchVal searchVal * @param userId userId * @param projectId projectId * @param isAdmin isAdmin * @return process definition IPage */ IPage<ProcessDefinition> queryDefineListPaging(IPage<ProcessDefinition> page, @Param("searchVal") String searchVal, @Param("userId") int userId, @Param("projectId") int projectId, @Param("isAdmin") boolean isAdmin); /** * query all process definition list * * @param projectId projectId * @return process definition list */ List<ProcessDefinition> queryAllDefinitionList(@Param("projectId") int projectId); /** * query process definition by ids * * @param ids ids * @return process definition list */ List<ProcessDefinition> queryDefinitionListByIdList(@Param("ids") Integer[] ids); /** * query process definition by tenant * * @param tenantId tenantId * @return process definition list */ List<ProcessDefinition> queryDefinitionListByTenant(@Param("tenantId") int tenantId); /** * count process definition group by user * * @param userId userId * @param projectIds projectIds * @param isAdmin isAdmin * @return process definition list */ List<DefinitionGroupByUser> countDefinitionGroupByUser( @Param("userId") Integer userId, @Param("projectIds") Integer[] projectIds, @Param("isAdmin") boolean isAdmin); /** * list all resource ids * * @return resource ids list */ @MapKey("id") List<Map<String, Object>> listResources(); /** * list all resource ids by user id * * @return resource ids list */ @MapKey("id") List<Map<String, Object>> listResourcesByUser(@Param("userId") Integer userId); /** * update process definition version by process definitionId * * @param processDefinitionId process definition id * @param version version */ void updateVersionByProcessDefinitionId(@Param("processDefinitionId") int processDefinitionId, @Param("version") long version); /** * list all project ids * @return project ids list */ List<Integer> listProjectIds(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml
<?xml version="1.0" encoding="UTF-8" ?> <!-- ~ 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. --> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper"> <sql id="baseSql"> id , name, version, release_state, project_id, user_id, process_definition_json, description, global_params, flag, locations, connects, warning_group_id, create_time, timeout, tenant_id, update_time, modify_by, resource_ids </sql> <select id="verifyByDefineName" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition"> select pd.id, pd.name, pd.version, pd.release_state, pd.project_id, pd.user_id, pd.process_definition_json, pd.description, pd.global_params, pd.flag, pd.locations, pd.connects, pd.warning_group_id, pd.create_time, pd.timeout, pd.tenant_id, pd.update_time, pd.modify_by, pd.resource_ids from t_ds_process_definition pd WHERE pd.project_id = #{projectId} and pd.name = #{processDefinitionName} </select> <select id="queryByDefineName" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition"> select pd.id, pd.name, pd.version, pd.release_state, pd.project_id, pd.user_id, pd.process_definition_json, pd.description, pd.global_params, pd.flag, pd.locations, pd.connects, pd.warning_group_id, pd.create_time, pd.timeout, pd.tenant_id, pd.update_time, pd.modify_by, pd.resource_ids, u.user_name,p.name as project_name,t.tenant_code,q.queue,q.queue_name from t_ds_process_definition pd JOIN t_ds_user u ON pd.user_id = u.id JOIN t_ds_project p ON pd.project_id = p.id JOIN t_ds_tenant t ON t.id = u.tenant_id JOIN t_ds_queue q ON t.queue_id = q.id WHERE p.id = #{projectId} and pd.name = #{processDefinitionName} </select> <select id="queryDefineListPaging" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition"> SELECT td.id, td.name, td.version, td.release_state, td.project_id, td.user_id, td.description, td.global_params, td.flag, td.warning_group_id, td.timeout, td.tenant_id, td.modify_by, td.update_time, td.create_time, sc.schedule_release_state, tu.user_name FROM t_ds_process_definition td left join (select process_definition_id,release_state as schedule_release_state from t_ds_schedules group by process_definition_id,release_state) sc on sc.process_definition_id = td.id left join t_ds_user tu on td.user_id = tu.id where td.project_id = #{projectId} <if test=" searchVal != null and searchVal != ''"> and td.name like concat('%', #{searchVal}, '%') </if> <if test=" userId != 0"> and td.user_id = #{userId} </if> order by sc.schedule_release_state desc,td.update_time desc </select> <select id="queryAllDefinitionList" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition"> select <include refid="baseSql"/> from t_ds_process_definition where project_id = #{projectId} order by create_time desc </select> <select id="queryDefinitionListByTenant" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition"> select <include refid="baseSql"/> from t_ds_process_definition where tenant_id = #{tenantId} </select> <select id="queryDefinitionListByIdList" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition"> select <include refid="baseSql"/> from t_ds_process_definition where id in <foreach collection="ids" index="index" item="i" open="(" separator="," close=")"> #{i} </foreach> </select> <select id="countDefinitionGroupByUser" resultType="org.apache.dolphinscheduler.dao.entity.DefinitionGroupByUser"> SELECT td.user_id as user_id, tu.user_name as user_name, count(0) as count FROM t_ds_process_definition td JOIN t_ds_user tu on tu.id=td.user_id where 1 = 1 <if test="projectIds != null and projectIds.length != 0"> and td.project_id in <foreach collection="projectIds" index="index" item="i" open="(" separator="," close=")"> #{i} </foreach> </if> group by td.user_id,tu.user_name </select> <select id="queryByDefineId" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition"> SELECT pd.id, pd.name, pd.version, pd.release_state, pd.project_id, pd.user_id, pd.process_definition_json, pd.description, pd.global_params, pd.flag, pd.locations, pd.connects, pd.warning_group_id, pd.create_time, pd.timeout, pd.tenant_id, pd.update_time, pd.modify_by, pd.resource_ids, u.user_name, p.name AS project_name FROM t_ds_process_definition pd, t_ds_user u, t_ds_project p WHERE pd.user_id = u.id AND pd.project_id = p.id AND pd.id = #{processDefineId} </select> <select id="listResources" resultType="java.util.HashMap"> SELECT id,resource_ids FROM t_ds_process_definition WHERE release_state = 1 and resource_ids is not null and resource_ids != '' </select> <select id="listResourcesByUser" resultType="java.util.HashMap"> SELECT id,resource_ids FROM t_ds_process_definition WHERE user_id = #{userId} and release_state = 1 and resource_ids is not null and resource_ids != '' </select> <select id="listProjectIds" resultType="java.lang.Integer"> SELECT DISTINCT(project_id) as project_id FROM t_ds_process_definition </select> <update id="updateVersionByProcessDefinitionId"> update t_ds_process_definition set version = #{version} where id = #{processDefinitionId} </update> </mapper>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/versions.vue
/* * 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. */ <template> <div class="container"> <div class="title-box"> <span class="name">{{$t('Version Info')}}</span> </div> <div class="table-box" v-if="versionData.processDefinitionVersions.length > 0"> <el-table :data="versionData.processDefinitionVersions" size="mini" style="width: 100%"> <el-table-column type="index" :label="$t('#')" width="50"></el-table-column> <el-table-column prop="userName" :label="$t('Version')"> <template slot-scope="scope"> <span v-if="scope.row.version"> <span v-if="scope.row.version === versionData.processDefinition.version" style="color: green"><strong>{{scope.row.version}} {{$t('Current Version')}}</strong></span> <span v-else>{{scope.row.version}}</span> </span> <span v-else>-</span> </template> </el-table-column> <el-table-column prop="description" :label="$t('Description')"></el-table-column> <el-table-column :label="$t('Create Time')" min-width="120"> <template slot-scope="scope"> <span>{{scope.row.createTime | formatDate}}</span> </template> </el-table-column> <el-table-column :label="$t('Operation')" width="100"> <template slot-scope="scope"> <el-tooltip :content="$t('Switch To This Version')" placement="top"> <el-popconfirm :confirmButtonText="$t('Confirm')" :cancelButtonText="$t('Cancel')" icon="el-icon-info" iconColor="red" :title="$t('Confirm Switch To This Version?')" @onConfirm="_mVersionSwitchProcessDefinitionVersion(scope.row)" > <el-button type="primary" size="mini" icon="el-icon-warning" circle slot="reference"></el-button> </el-popconfirm> </el-tooltip> <el-tooltip :content="$t('Delete')" placement="top"> <el-popconfirm :confirmButtonText="$t('Confirm')" :cancelButtonText="$t('Cancel')" icon="el-icon-info" iconColor="red" :title="$t('Delete?')" @onConfirm="_mVersionDeleteProcessDefinitionVersion(scope.row,scope.row.id)" > <el-button type="danger" size="mini" icon="el-icon-delete" circle slot="reference"></el-button> </el-popconfirm> </el-tooltip> </template> </el-table-column> </el-table> </div> <div v-if="versionData.processDefinitionVersions.length === 0"> <m-no-data><!----></m-no-data> </div> <div v-if="versionData.processDefinitionVersions.length > 0"> <div class="bottom-box"> <el-pagination style="float:right" background @current-change="_mVersionGetProcessDefinitionVersionsPage" layout="prev, pager, next" :total="versionData.total"> </el-pagination> <el-button type="text" size="mini" @click="_close()" style="float:right">{{$t('Cancel')}}</el-button> </div> </div> </div> </template> <script> import mNoData from '@/module/components/noData/noData' export default { name: 'versions', data () { return { tableHeaders: [ { label: 'version', prop: 'version' }, { label: 'createTime', prop: 'createTime' } ] } }, props: { versionData: Object }, methods: { /** * switch version in process definition version list */ _mVersionSwitchProcessDefinitionVersion (item) { this.$emit('mVersionSwitchProcessDefinitionVersion', { version: item.version, processDefinitionId: this.versionData.processDefinition.id, fromThis: this }) }, /** * delete one version of process definition */ _mVersionDeleteProcessDefinitionVersion (item) { this.$emit('mVersionDeleteProcessDefinitionVersion', { version: item.version, processDefinitionId: this.versionData.processDefinition.id, fromThis: this }) }, /** * Paging event of process definition versions */ _mVersionGetProcessDefinitionVersionsPage (val) { this.$emit('mVersionGetProcessDefinitionVersionsPage', { pageNo: val, pageSize: this.pageSize, processDefinitionId: this.versionData.processDefinition.id, fromThis: this }) }, /** * Close and destroy component and component internal events */ _close () { // flag Whether to delete a node this.$destroy() this.$emit('closeVersion') } }, created () { }, mounted () { }, components: { mNoData } } </script> <style lang="scss" rel="stylesheet/scss"> .container { width: 500px; position: relative; .title-box { height: 61px; border-bottom: 1px solid #DCDEDC; position: relative; .name { position: absolute; left: 24px; top: 18px; font-size: 16px; } } .bottom-box { position: absolute; bottom: 0; left: 0; width: 100%; text-align: right; height: 60px; line-height: 60px; border-top: 1px solid #DCDEDC; background: #fff; .ans-page { display: inline-block; } } .table-box { overflow-y: scroll; height: calc(100vh - 61px); padding-bottom: 60px; } } </style>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
/* * 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.dolphinscheduler.common; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import java.util.regex.Pattern; /** * Constants */ public final class Constants { private Constants() { throw new UnsupportedOperationException("Construct Constants"); } /** * quartz config */ public static final String ORG_QUARTZ_JOBSTORE_DRIVERDELEGATECLASS = "org.quartz.jobStore.driverDelegateClass"; public static final String ORG_QUARTZ_SCHEDULER_INSTANCENAME = "org.quartz.scheduler.instanceName"; public static final String ORG_QUARTZ_SCHEDULER_INSTANCEID = "org.quartz.scheduler.instanceId"; public static final String ORG_QUARTZ_SCHEDULER_MAKESCHEDULERTHREADDAEMON = "org.quartz.scheduler.makeSchedulerThreadDaemon"; public static final String ORG_QUARTZ_JOBSTORE_USEPROPERTIES = "org.quartz.jobStore.useProperties"; public static final String ORG_QUARTZ_THREADPOOL_CLASS = "org.quartz.threadPool.class"; public static final String ORG_QUARTZ_THREADPOOL_THREADCOUNT = "org.quartz.threadPool.threadCount"; public static final String ORG_QUARTZ_THREADPOOL_MAKETHREADSDAEMONS = "org.quartz.threadPool.makeThreadsDaemons"; public static final String ORG_QUARTZ_THREADPOOL_THREADPRIORITY = "org.quartz.threadPool.threadPriority"; public static final String ORG_QUARTZ_JOBSTORE_CLASS = "org.quartz.jobStore.class"; public static final String ORG_QUARTZ_JOBSTORE_TABLEPREFIX = "org.quartz.jobStore.tablePrefix"; public static final String ORG_QUARTZ_JOBSTORE_ISCLUSTERED = "org.quartz.jobStore.isClustered"; public static final String ORG_QUARTZ_JOBSTORE_MISFIRETHRESHOLD = "org.quartz.jobStore.misfireThreshold"; public static final String ORG_QUARTZ_JOBSTORE_CLUSTERCHECKININTERVAL = "org.quartz.jobStore.clusterCheckinInterval"; public static final String ORG_QUARTZ_JOBSTORE_ACQUIRETRIGGERSWITHINLOCK = "org.quartz.jobStore.acquireTriggersWithinLock"; public static final String ORG_QUARTZ_JOBSTORE_DATASOURCE = "org.quartz.jobStore.dataSource"; public static final String ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS = "org.quartz.dataSource.myDs.connectionProvider.class"; /** * quartz config default value */ public static final String QUARTZ_TABLE_PREFIX = "QRTZ_"; public static final String QUARTZ_MISFIRETHRESHOLD = "60000"; public static final String QUARTZ_CLUSTERCHECKININTERVAL = "5000"; public static final String QUARTZ_DATASOURCE = "myDs"; public static final String QUARTZ_THREADCOUNT = "25"; public static final String QUARTZ_THREADPRIORITY = "5"; public static final String QUARTZ_INSTANCENAME = "DolphinScheduler"; public static final String QUARTZ_INSTANCEID = "AUTO"; public static final String QUARTZ_ACQUIRETRIGGERSWITHINLOCK = "true"; /** * common properties path */ public static final String COMMON_PROPERTIES_PATH = "/common.properties"; /** * fs.defaultFS */ public static final String FS_DEFAULTFS = "fs.defaultFS"; /** * fs s3a endpoint */ public static final String FS_S3A_ENDPOINT = "fs.s3a.endpoint"; /** * fs s3a access key */ public static final String FS_S3A_ACCESS_KEY = "fs.s3a.access.key"; /** * fs s3a secret key */ public static final String FS_S3A_SECRET_KEY = "fs.s3a.secret.key"; /** * yarn.resourcemanager.ha.rm.ids */ public static final String YARN_RESOURCEMANAGER_HA_RM_IDS = "yarn.resourcemanager.ha.rm.ids"; public static final String YARN_RESOURCEMANAGER_HA_XX = "xx"; /** * yarn.application.status.address */ public static final String YARN_APPLICATION_STATUS_ADDRESS = "yarn.application.status.address"; /** * yarn.job.history.status.address */ public static final String YARN_JOB_HISTORY_STATUS_ADDRESS = "yarn.job.history.status.address"; /** * hdfs configuration * hdfs.root.user */ public static final String HDFS_ROOT_USER = "hdfs.root.user"; /** * hdfs/s3 configuration * resource.upload.path */ public static final String RESOURCE_UPLOAD_PATH = "resource.upload.path"; /** * data basedir path */ public static final String DATA_BASEDIR_PATH = "data.basedir.path"; /** * dolphinscheduler.env.path */ public static final String DOLPHINSCHEDULER_ENV_PATH = "dolphinscheduler.env.path"; /** * environment properties default path */ public static final String ENV_PATH = "env/dolphinscheduler_env.sh"; /** * python home */ public static final String PYTHON_HOME = "PYTHON_HOME"; /** * resource.view.suffixs */ public static final String RESOURCE_VIEW_SUFFIXS = "resource.view.suffixs"; public static final String RESOURCE_VIEW_SUFFIXS_DEFAULT_VALUE = "txt,log,sh,bat,conf,cfg,py,java,sql,xml,hql,properties,json,yml,yaml,ini,js"; /** * development.state */ public static final String DEVELOPMENT_STATE = "development.state"; public static final String DEVELOPMENT_STATE_DEFAULT_VALUE = "true"; /** * string true */ public static final String STRING_TRUE = "true"; /** * string false */ public static final String STRING_FALSE = "false"; /** * resource storage type */ public static final String RESOURCE_STORAGE_TYPE = "resource.storage.type"; /** * MasterServer directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_MASTERS = "/nodes/master"; /** * WorkerServer directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_WORKERS = "/nodes/worker"; /** * all servers directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_DEAD_SERVERS = "/dead-servers"; /** * MasterServer lock directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_MASTERS = "/lock/masters"; /** * MasterServer failover directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_MASTERS = "/lock/failover/masters"; /** * WorkerServer failover directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_WORKERS = "/lock/failover/workers"; /** * MasterServer startup failover runing and fault tolerance process */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_STARTUP_MASTERS = "/lock/failover/startup-masters"; /** * comma , */ public static final String COMMA = ","; /** * slash / */ public static final String SLASH = "/"; /** * COLON : */ public static final String COLON = ":"; /** * SPACE " " */ public static final String SPACE = " "; /** * SINGLE_SLASH / */ public static final String SINGLE_SLASH = "/"; /** * DOUBLE_SLASH // */ public static final String DOUBLE_SLASH = "//"; /** * SINGLE_QUOTES "'" */ public static final String SINGLE_QUOTES = "'"; /** * DOUBLE_QUOTES "\"" */ public static final String DOUBLE_QUOTES = "\""; /** * SEMICOLON ; */ public static final String SEMICOLON = ";"; /** * EQUAL SIGN */ public static final String EQUAL_SIGN = "="; /** * AT SIGN */ public static final String AT_SIGN = "@"; public static final String WORKER_MAX_CPULOAD_AVG = "worker.max.cpuload.avg"; public static final String WORKER_RESERVED_MEMORY = "worker.reserved.memory"; public static final String MASTER_MAX_CPULOAD_AVG = "master.max.cpuload.avg"; public static final String MASTER_RESERVED_MEMORY = "master.reserved.memory"; /** * date format of yyyy-MM-dd HH:mm:ss */ public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; /** * date format of yyyyMMddHHmmss */ public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; /** * date format of yyyyMMddHHmmssSSS */ public static final String YYYYMMDDHHMMSSSSS = "yyyyMMddHHmmssSSS"; /** * http connect time out */ public static final int HTTP_CONNECT_TIMEOUT = 60 * 1000; /** * http connect request time out */ public static final int HTTP_CONNECTION_REQUEST_TIMEOUT = 60 * 1000; /** * httpclient soceket time out */ public static final int SOCKET_TIMEOUT = 60 * 1000; /** * http header */ public static final String HTTP_HEADER_UNKNOWN = "unKnown"; /** * http X-Forwarded-For */ public static final String HTTP_X_FORWARDED_FOR = "X-Forwarded-For"; /** * http X-Real-IP */ public static final String HTTP_X_REAL_IP = "X-Real-IP"; /** * UTF-8 */ public static final String UTF_8 = "UTF-8"; /** * user name regex */ public static final Pattern REGEX_USER_NAME = Pattern.compile("^[a-zA-Z0-9._-]{3,39}$"); /** * email regex */ public static final Pattern REGEX_MAIL_NAME = Pattern.compile("^([a-z0-9A-Z]+[_|\\-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"); /** * read permission */ public static final int READ_PERMISSION = 2 * 1; /** * write permission */ public static final int WRITE_PERMISSION = 2 * 2; /** * execute permission */ public static final int EXECUTE_PERMISSION = 1; /** * default admin permission */ public static final int DEFAULT_ADMIN_PERMISSION = 7; /** * all permissions */ public static final int ALL_PERMISSIONS = READ_PERMISSION | WRITE_PERMISSION | EXECUTE_PERMISSION; /** * max task timeout */ public static final int MAX_TASK_TIMEOUT = 24 * 3600; /** * master cpu load */ public static final int DEFAULT_MASTER_CPU_LOAD = Runtime.getRuntime().availableProcessors() * 2; /** * master reserved memory */ public static final double DEFAULT_MASTER_RESERVED_MEMORY = OSUtils.totalMemorySize() / 10; /** * worker cpu load */ public static final int DEFAULT_WORKER_CPU_LOAD = Runtime.getRuntime().availableProcessors() * 2; /** * worker reserved memory */ public static final double DEFAULT_WORKER_RESERVED_MEMORY = OSUtils.totalMemorySize() / 10; /** * worker host weight */ public static final int DEFAULT_WORKER_HOST_WEIGHT = 100; /** * default log cache rows num,output when reach the number */ public static final int DEFAULT_LOG_ROWS_NUM = 4 * 16; /** * log flush interval?output when reach the interval */ public static final int DEFAULT_LOG_FLUSH_INTERVAL = 1000; /** * time unit secong to minutes */ public static final int SEC_2_MINUTES_TIME_UNIT = 60; /*** * * rpc port */ public static final int RPC_PORT = 50051; /*** * alert rpc port */ public static final int ALERT_RPC_PORT = 50052; /** * forbid running task */ public static final String FLOWNODE_RUN_FLAG_FORBIDDEN = "FORBIDDEN"; /** * datasource configuration path */ public static final String DATASOURCE_PROPERTIES = "/datasource.properties"; public static final String TASK_RECORD_URL = "task.record.datasource.url"; public static final String TASK_RECORD_FLAG = "task.record.flag"; public static final String TASK_RECORD_USER = "task.record.datasource.username"; public static final String TASK_RECORD_PWD = "task.record.datasource.password"; public static final String DEFAULT = "Default"; public static final String USER = "user"; public static final String PASSWORD = "password"; public static final String XXXXXX = "******"; public static final String NULL = "NULL"; public static final String THREAD_NAME_MASTER_SERVER = "Master-Server"; public static final String THREAD_NAME_WORKER_SERVER = "Worker-Server"; public static final String TASK_RECORD_TABLE_HIVE_LOG = "eamp_hive_log_hd"; public static final String TASK_RECORD_TABLE_HISTORY_HIVE_LOG = "eamp_hive_hist_log_hd"; /** * command parameter keys */ public static final String CMD_PARAM_RECOVER_PROCESS_ID_STRING = "ProcessInstanceId"; public static final String CMD_PARAM_RECOVERY_START_NODE_STRING = "StartNodeIdList"; public static final String CMD_PARAM_RECOVERY_WAITING_THREAD = "WaitingThreadInstanceId"; public static final String CMD_PARAM_SUB_PROCESS = "processInstanceId"; public static final String CMD_PARAM_EMPTY_SUB_PROCESS = "0"; public static final String CMD_PARAM_SUB_PROCESS_PARENT_INSTANCE_ID = "parentProcessInstanceId"; public static final String CMD_PARAM_SUB_PROCESS_DEFINE_ID = "processDefinitionId"; public static final String CMD_PARAM_START_NODE_NAMES = "StartNodeNameList"; public static final String CMD_PARAM_START_PARAMS = "StartParams"; /** * complement data start date */ public static final String CMDPARAM_COMPLEMENT_DATA_START_DATE = "complementStartDate"; /** * complement data end date */ public static final String CMDPARAM_COMPLEMENT_DATA_END_DATE = "complementEndDate"; /** * hadoop configuration */ public static final String HADOOP_RM_STATE_ACTIVE = "ACTIVE"; public static final String HADOOP_RM_STATE_STANDBY = "STANDBY"; public static final String HADOOP_RESOURCE_MANAGER_HTTPADDRESS_PORT = "resource.manager.httpaddress.port"; /** * data source config */ public static final String SPRING_DATASOURCE_DRIVER_CLASS_NAME = "spring.datasource.driver-class-name"; public static final String SPRING_DATASOURCE_URL = "spring.datasource.url"; public static final String SPRING_DATASOURCE_USERNAME = "spring.datasource.username"; public static final String SPRING_DATASOURCE_PASSWORD = "spring.datasource.password"; public static final String SPRING_DATASOURCE_VALIDATION_QUERY_TIMEOUT = "spring.datasource.validationQueryTimeout"; public static final String SPRING_DATASOURCE_INITIAL_SIZE = "spring.datasource.initialSize"; public static final String SPRING_DATASOURCE_MIN_IDLE = "spring.datasource.minIdle"; public static final String SPRING_DATASOURCE_MAX_ACTIVE = "spring.datasource.maxActive"; public static final String SPRING_DATASOURCE_MAX_WAIT = "spring.datasource.maxWait"; public static final String SPRING_DATASOURCE_TIME_BETWEEN_EVICTION_RUNS_MILLIS = "spring.datasource.timeBetweenEvictionRunsMillis"; public static final String SPRING_DATASOURCE_TIME_BETWEEN_CONNECT_ERROR_MILLIS = "spring.datasource.timeBetweenConnectErrorMillis"; public static final String SPRING_DATASOURCE_MIN_EVICTABLE_IDLE_TIME_MILLIS = "spring.datasource.minEvictableIdleTimeMillis"; public static final String SPRING_DATASOURCE_VALIDATION_QUERY = "spring.datasource.validationQuery"; public static final String SPRING_DATASOURCE_TEST_WHILE_IDLE = "spring.datasource.testWhileIdle"; public static final String SPRING_DATASOURCE_TEST_ON_BORROW = "spring.datasource.testOnBorrow"; public static final String SPRING_DATASOURCE_TEST_ON_RETURN = "spring.datasource.testOnReturn"; public static final String SPRING_DATASOURCE_POOL_PREPARED_STATEMENTS = "spring.datasource.poolPreparedStatements"; public static final String SPRING_DATASOURCE_DEFAULT_AUTO_COMMIT = "spring.datasource.defaultAutoCommit"; public static final String SPRING_DATASOURCE_KEEP_ALIVE = "spring.datasource.keepAlive"; public static final String SPRING_DATASOURCE_MAX_POOL_PREPARED_STATEMENT_PER_CONNECTION_SIZE = "spring.datasource.maxPoolPreparedStatementPerConnectionSize"; public static final String DEVELOPMENT = "development"; public static final String QUARTZ_PROPERTIES_PATH = "quartz.properties"; /** * sleep time */ public static final int SLEEP_TIME_MILLIS = 1000; /** * heartbeat for zk info length */ public static final int HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH = 10; public static final int HEARTBEAT_WITH_WEIGHT_FOR_ZOOKEEPER_INFO_LENGTH = 11; /** * jar */ public static final String JAR = "jar"; /** * hadoop */ public static final String HADOOP = "hadoop"; /** * -D <property>=<value> */ public static final String D = "-D"; /** * -D mapreduce.job.name=name */ public static final String MR_NAME = "mapreduce.job.name"; /** * -D mapreduce.job.queuename=queuename */ public static final String MR_QUEUE = "mapreduce.job.queuename"; /** * spark params constant */ public static final String MASTER = "--master"; public static final String DEPLOY_MODE = "--deploy-mode"; /** * --class CLASS_NAME */ public static final String MAIN_CLASS = "--class"; /** * --driver-cores NUM */ public static final String DRIVER_CORES = "--driver-cores"; /** * --driver-memory MEM */ public static final String DRIVER_MEMORY = "--driver-memory"; /** * --num-executors NUM */ public static final String NUM_EXECUTORS = "--num-executors"; /** * --executor-cores NUM */ public static final String EXECUTOR_CORES = "--executor-cores"; /** * --executor-memory MEM */ public static final String EXECUTOR_MEMORY = "--executor-memory"; /** * --name NAME */ public static final String SPARK_NAME = "--name"; /** * --queue QUEUE */ public static final String SPARK_QUEUE = "--queue"; /** * exit code success */ public static final int EXIT_CODE_SUCCESS = 0; /** * exit code kill */ public static final int EXIT_CODE_KILL = 137; /** * exit code failure */ public static final int EXIT_CODE_FAILURE = -1; /** * date format of yyyyMMdd */ public static final String PARAMETER_FORMAT_DATE = "yyyyMMdd"; /** * date format of yyyyMMddHHmmss */ public static final String PARAMETER_FORMAT_TIME = "yyyyMMddHHmmss"; /** * system date(yyyyMMddHHmmss) */ public static final String PARAMETER_DATETIME = "system.datetime"; /** * system date(yyyymmdd) today */ public static final String PARAMETER_CURRENT_DATE = "system.biz.curdate"; /** * system date(yyyymmdd) yesterday */ public static final String PARAMETER_BUSINESS_DATE = "system.biz.date"; /** * ACCEPTED */ public static final String ACCEPTED = "ACCEPTED"; /** * SUCCEEDED */ public static final String SUCCEEDED = "SUCCEEDED"; /** * NEW */ public static final String NEW = "NEW"; /** * NEW_SAVING */ public static final String NEW_SAVING = "NEW_SAVING"; /** * SUBMITTED */ public static final String SUBMITTED = "SUBMITTED"; /** * FAILED */ public static final String FAILED = "FAILED"; /** * KILLED */ public static final String KILLED = "KILLED"; /** * RUNNING */ public static final String RUNNING = "RUNNING"; /** * underline "_" */ public static final String UNDERLINE = "_"; /** * quartz job prifix */ public static final String QUARTZ_JOB_PRIFIX = "job"; /** * quartz job group prifix */ public static final String QUARTZ_JOB_GROUP_PRIFIX = "jobgroup"; /** * projectId */ public static final String PROJECT_ID = "projectId"; /** * processId */ public static final String SCHEDULE_ID = "scheduleId"; /** * schedule */ public static final String SCHEDULE = "schedule"; /** * application regex */ public static final String APPLICATION_REGEX = "application_\\d+_\\d+"; public static final String PID = OSUtils.isWindows() ? "handle" : "pid"; /** * month_begin */ public static final String MONTH_BEGIN = "month_begin"; /** * add_months */ public static final String ADD_MONTHS = "add_months"; /** * month_end */ public static final String MONTH_END = "month_end"; /** * week_begin */ public static final String WEEK_BEGIN = "week_begin"; /** * week_end */ public static final String WEEK_END = "week_end"; /** * timestamp */ public static final String TIMESTAMP = "timestamp"; public static final char SUBTRACT_CHAR = '-'; public static final char ADD_CHAR = '+'; public static final char MULTIPLY_CHAR = '*'; public static final char DIVISION_CHAR = '/'; public static final char LEFT_BRACE_CHAR = '('; public static final char RIGHT_BRACE_CHAR = ')'; public static final String ADD_STRING = "+"; public static final String MULTIPLY_STRING = "*"; public static final String DIVISION_STRING = "/"; public static final String LEFT_BRACE_STRING = "("; public static final char P = 'P'; public static final char N = 'N'; public static final String SUBTRACT_STRING = "-"; public static final String GLOBAL_PARAMS = "globalParams"; public static final String LOCAL_PARAMS = "localParams"; public static final String LOCAL_PARAMS_LIST = "localParamsList"; public static final String SUBPROCESS_INSTANCE_ID = "subProcessInstanceId"; public static final String PROCESS_INSTANCE_STATE = "processInstanceState"; public static final String PARENT_WORKFLOW_INSTANCE = "parentWorkflowInstance"; public static final String TASK_TYPE = "taskType"; public static final String TASK_LIST = "taskList"; public static final String RWXR_XR_X = "rwxr-xr-x"; public static final String QUEUE = "queue"; public static final String QUEUE_NAME = "queueName"; public static final int LOG_QUERY_SKIP_LINE_NUMBER = 0; public static final int LOG_QUERY_LIMIT = 4096; /** * master/worker server use for zk */ public static final String MASTER_PREFIX = "master"; public static final String WORKER_PREFIX = "worker"; public static final String DELETE_ZK_OP = "delete"; public static final String ADD_ZK_OP = "add"; public static final String ALIAS = "alias"; public static final String CONTENT = "content"; public static final String DEPENDENT_SPLIT = ":||"; public static final String DEPENDENT_ALL = "ALL"; /** * preview schedule execute count */ public static final int PREVIEW_SCHEDULE_EXECUTE_COUNT = 5; /** * kerberos */ public static final String KERBEROS = "kerberos"; /** * kerberos expire time */ public static final String KERBEROS_EXPIRE_TIME = "kerberos.expire.time"; /** * java.security.krb5.conf */ public static final String JAVA_SECURITY_KRB5_CONF = "java.security.krb5.conf"; /** * java.security.krb5.conf.path */ public static final String JAVA_SECURITY_KRB5_CONF_PATH = "java.security.krb5.conf.path"; /** * hadoop.security.authentication */ public static final String HADOOP_SECURITY_AUTHENTICATION = "hadoop.security.authentication"; /** * hadoop.security.authentication */ public static final String HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE = "hadoop.security.authentication.startup.state"; /** * com.amazonaws.services.s3.enableV4 */ public static final String AWS_S3_V4 = "com.amazonaws.services.s3.enableV4"; /** * loginUserFromKeytab user */ public static final String LOGIN_USER_KEY_TAB_USERNAME = "login.user.keytab.username"; /** * default worker group id */ public static final int DEFAULT_WORKER_ID = -1; /** * loginUserFromKeytab path */ public static final String LOGIN_USER_KEY_TAB_PATH = "login.user.keytab.path"; /** * task log info format */ public static final String TASK_LOG_INFO_FORMAT = "TaskLogInfo-%s"; /** * hive conf */ public static final String HIVE_CONF = "hiveconf:"; /** * flink */ public static final String FLINK_YARN_CLUSTER = "yarn-cluster"; public static final String FLINK_RUN_MODE = "-m"; public static final String FLINK_YARN_SLOT = "-ys"; public static final String FLINK_APP_NAME = "-ynm"; public static final String FLINK_QUEUE = "-yqu"; public static final String FLINK_TASK_MANAGE = "-yn"; public static final String FLINK_JOB_MANAGE_MEM = "-yjm"; public static final String FLINK_TASK_MANAGE_MEM = "-ytm"; public static final String FLINK_MAIN_CLASS = "-c"; public static final String FLINK_PARALLELISM = "-p"; public static final String FLINK_SHUTDOWN_ON_ATTACHED_EXIT = "-sae"; public static final int[] NOT_TERMINATED_STATES = new int[] { ExecutionStatus.SUBMITTED_SUCCESS.ordinal(), ExecutionStatus.RUNNING_EXECUTION.ordinal(), ExecutionStatus.DELAY_EXECUTION.ordinal(), ExecutionStatus.READY_PAUSE.ordinal(), ExecutionStatus.READY_STOP.ordinal(), ExecutionStatus.NEED_FAULT_TOLERANCE.ordinal(), ExecutionStatus.WAITTING_THREAD.ordinal(), ExecutionStatus.WAITTING_DEPEND.ordinal() }; /** * status */ public static final String STATUS = "status"; /** * message */ public static final String MSG = "msg"; /** * data total */ public static final String COUNT = "count"; /** * page size */ public static final String PAGE_SIZE = "pageSize"; /** * current page no */ public static final String PAGE_NUMBER = "pageNo"; /** * */ public static final String DATA_LIST = "data"; public static final String TOTAL_LIST = "totalList"; public static final String CURRENT_PAGE = "currentPage"; public static final String TOTAL_PAGE = "totalPage"; public static final String TOTAL = "total"; /** * workflow */ public static final String WORKFLOW_LIST = "workFlowList"; public static final String WORKFLOW_RELATION_LIST = "workFlowRelationList"; /** * session user */ public static final String SESSION_USER = "session.user"; public static final String SESSION_ID = "sessionId"; public static final String PASSWORD_DEFAULT = "******"; /** * locale */ public static final String LOCALE_LANGUAGE = "language"; /** * driver */ public static final String ORG_POSTGRESQL_DRIVER = "org.postgresql.Driver"; public static final String COM_MYSQL_JDBC_DRIVER = "com.mysql.jdbc.Driver"; public static final String ORG_APACHE_HIVE_JDBC_HIVE_DRIVER = "org.apache.hive.jdbc.HiveDriver"; public static final String COM_CLICKHOUSE_JDBC_DRIVER = "ru.yandex.clickhouse.ClickHouseDriver"; public static final String COM_ORACLE_JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver"; public static final String COM_SQLSERVER_JDBC_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; public static final String COM_DB2_JDBC_DRIVER = "com.ibm.db2.jcc.DB2Driver"; public static final String COM_PRESTO_JDBC_DRIVER = "com.facebook.presto.jdbc.PrestoDriver"; /** * database type */ public static final String MYSQL = "MYSQL"; public static final String POSTGRESQL = "POSTGRESQL"; public static final String HIVE = "HIVE"; public static final String SPARK = "SPARK"; public static final String CLICKHOUSE = "CLICKHOUSE"; public static final String ORACLE = "ORACLE"; public static final String SQLSERVER = "SQLSERVER"; public static final String DB2 = "DB2"; public static final String PRESTO = "PRESTO"; /** * jdbc url */ public static final String JDBC_MYSQL = "jdbc:mysql://"; public static final String JDBC_POSTGRESQL = "jdbc:postgresql://"; public static final String JDBC_HIVE_2 = "jdbc:hive2://"; public static final String JDBC_CLICKHOUSE = "jdbc:clickhouse://"; public static final String JDBC_ORACLE_SID = "jdbc:oracle:thin:@"; public static final String JDBC_ORACLE_SERVICE_NAME = "jdbc:oracle:thin:@//"; public static final String JDBC_SQLSERVER = "jdbc:sqlserver://"; public static final String JDBC_DB2 = "jdbc:db2://"; public static final String JDBC_PRESTO = "jdbc:presto://"; public static final String ADDRESS = "address"; public static final String DATABASE = "database"; public static final String JDBC_URL = "jdbcUrl"; public static final String PRINCIPAL = "principal"; public static final String OTHER = "other"; public static final String ORACLE_DB_CONNECT_TYPE = "connectType"; public static final String KERBEROS_KRB5_CONF_PATH = "javaSecurityKrb5Conf"; public static final String KERBEROS_KEY_TAB_USERNAME = "loginUserKeytabUsername"; public static final String KERBEROS_KEY_TAB_PATH = "loginUserKeytabPath"; /** * session timeout */ public static final int SESSION_TIME_OUT = 7200; public static final int MAX_FILE_SIZE = 1024 * 1024 * 1024; public static final String UDF = "UDF"; public static final String CLASS = "class"; public static final String RECEIVERS = "receivers"; public static final String RECEIVERS_CC = "receiversCc"; /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))"; /** * default worker group */ public static final String DEFAULT_WORKER_GROUP = "default"; public static final Integer TASK_INFO_LENGTH = 5; /** * new * schedule time */ public static final String PARAMETER_SHECDULE_TIME = "schedule.time"; /** * authorize writable perm */ public static final int AUTHORIZE_WRITABLE_PERM = 7; /** * authorize readable perm */ public static final int AUTHORIZE_READABLE_PERM = 4; /** * plugin configurations */ public static final String PLUGIN_JAR_SUFFIX = ".jar"; public static final int NORMAL_NODE_STATUS = 0; public static final int ABNORMAL_NODE_STATUS = 1; public static final String START_TIME = "start time"; public static final String END_TIME = "end time"; public static final String START_END_DATE = "startDate,endDate"; /** * system line separator */ public static final String SYSTEM_LINE_SEPARATOR = System.getProperty("line.separator"); /** * net system properties */ public static final String DOLPHIN_SCHEDULER_PREFERRED_NETWORK_INTERFACE = "dolphin.scheduler.network.interface.preferred"; public static final String EXCEL_SUFFIX_XLS = ".xls"; /** * datasource encryption salt */ public static final String DATASOURCE_ENCRYPTION_SALT_DEFAULT = "!@#$%^&*"; public static final String DATASOURCE_ENCRYPTION_ENABLE = "datasource.encryption.enable"; public static final String DATASOURCE_ENCRYPTION_SALT = "datasource.encryption.salt"; /** * Network IP gets priority, default inner outer */ public static final String NETWORK_PRIORITY_STRATEGY = "dolphin.scheduler.network.priority.strategy"; /** * exec shell scripts */ public static final String SH = "sh"; /** * pstree, get pud and sub pid */ public static final String PSTREE = "pstree"; /** * docker & kubernetes */ public static final boolean DOCKER_MODE = StringUtils.isNotEmpty(System.getenv("DOCKER")); public static final boolean KUBERNETES_MODE = StringUtils.isNotEmpty(System.getenv("KUBERNETES_SERVICE_HOST")) && StringUtils.isNotEmpty(System.getenv("KUBERNETES_SERVICE_PORT")); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java
/* * 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.dolphinscheduler.server.master.runner; import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE; import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_RECOVERY_START_NODE_STRING; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_START_NODE_NAMES; import static org.apache.dolphinscheduler.common.Constants.DEFAULT_WORKER_GROUP; import static org.apache.dolphinscheduler.common.Constants.LOCAL_PARAMS; import static org.apache.dolphinscheduler.common.Constants.SEC_2_MINUTES_TIME_UNIT; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.DependResult; import org.apache.dolphinscheduler.common.enums.Direct; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.TaskDependType; import org.apache.dolphinscheduler.common.graph.DAG; import org.apache.dolphinscheduler.common.model.TaskNode; import org.apache.dolphinscheduler.common.model.TaskNodeRelation; import org.apache.dolphinscheduler.common.process.ProcessDag; import org.apache.dolphinscheduler.common.process.Property; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.common.thread.ThreadUtils; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.CommonUtils; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.ParameterUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.common.utils.VarPoolUtils; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.ProjectUser; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.utils.DagHelper; import org.apache.dolphinscheduler.remote.NettyRemotingClient; import org.apache.dolphinscheduler.server.master.config.MasterConfig; import org.apache.dolphinscheduler.server.utils.AlertManager; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.quartz.cron.CronUtils; import org.apache.dolphinscheduler.service.queue.PeerTaskInstancePriorityQueue; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; import java.text.ParseException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.Lists; /** * master exec thread,split dag */ public class MasterExecThread implements Runnable { /** * logger of MasterExecThread */ private static final Logger logger = LoggerFactory.getLogger(MasterExecThread.class); /** * runing TaskNode */ private final Map<MasterBaseTaskExecThread, Future<Boolean>> activeTaskNode = new ConcurrentHashMap<>(); /** * task exec service */ private final ExecutorService taskExecService; /** * process instance */ private ProcessInstance processInstance; /** * submit failure nodes */ private boolean taskFailedSubmit = false; /** * recover node id list */ private List<TaskInstance> recoverNodeIdList = new ArrayList<>(); /** * error task list */ private Map<String, TaskInstance> errorTaskList = new ConcurrentHashMap<>(); /** * complete task list */ private Map<String, TaskInstance> completeTaskList = new ConcurrentHashMap<>(); /** * ready to submit task queue */ private PeerTaskInstancePriorityQueue readyToSubmitTaskQueue = new PeerTaskInstancePriorityQueue(); /** * depend failed task map */ private Map<String, TaskInstance> dependFailedTask = new ConcurrentHashMap<>(); /** * forbidden task map */ private Map<String, TaskNode> forbiddenTaskList = new ConcurrentHashMap<>(); /** * skip task map */ private Map<String, TaskNode> skipTaskNodeList = new ConcurrentHashMap<>(); /** * recover tolerance fault task list */ private List<TaskInstance> recoverToleranceFaultTaskList = new ArrayList<>(); /** * alert manager */ private AlertManager alertManager; /** * the object of DAG */ private DAG<String, TaskNode, TaskNodeRelation> dag; /** * process service */ private ProcessService processService; /** * master config */ private MasterConfig masterConfig; /** * */ private NettyRemotingClient nettyRemotingClient; /** * submit post node * * @param parentNodeName parent node name */ private Map<String, Object> propToValue = new ConcurrentHashMap<String, Object>(); /** * constructor of MasterExecThread * * @param processInstance processInstance * @param processService processService * @param nettyRemotingClient nettyRemotingClient */ public MasterExecThread(ProcessInstance processInstance , ProcessService processService , NettyRemotingClient nettyRemotingClient , AlertManager alertManager , MasterConfig masterConfig) { this.processService = processService; this.processInstance = processInstance; this.masterConfig = masterConfig; int masterTaskExecNum = masterConfig.getMasterExecTaskNum(); this.taskExecService = ThreadUtils.newDaemonFixedThreadExecutor("Master-Task-Exec-Thread", masterTaskExecNum); this.nettyRemotingClient = nettyRemotingClient; this.alertManager = alertManager; } @Override public void run() { // process instance is null if (processInstance == null) { logger.info("process instance is not exists"); return; } // check to see if it's done if (processInstance.getState().typeIsFinished()) { logger.info("process instance is done : {}", processInstance.getId()); return; } try { if (processInstance.isComplementData() && Flag.NO == processInstance.getIsSubProcess()) { // sub process complement data executeComplementProcess(); } else { // execute flow executeProcess(); } } catch (Exception e) { logger.error("master exec thread exception", e); logger.error("process execute failed, process id:{}", processInstance.getId()); processInstance.setState(ExecutionStatus.FAILURE); processInstance.setEndTime(new Date()); processService.updateProcessInstance(processInstance); } finally { taskExecService.shutdown(); // post handle postHandle(); } } /** * execute process * * @throws Exception exception */ private void executeProcess() throws Exception { prepareProcess(); runProcess(); endProcess(); } /** * execute complement process * * @throws Exception exception */ private void executeComplementProcess() throws Exception { Map<String, String> cmdParam = JSONUtils.toMap(processInstance.getCommandParam()); Date startDate = DateUtils.getScheduleDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE)); Date endDate = DateUtils.getScheduleDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE)); processService.saveProcessInstance(processInstance); // get schedules int processDefinitionId = processInstance.getProcessDefinitionId(); List<Schedule> schedules = processService.queryReleaseSchedulerListByProcessDefinitionId(processDefinitionId); List<Date> listDate = Lists.newLinkedList(); if (!CollectionUtils.isEmpty(schedules)) { for (Schedule schedule : schedules) { listDate.addAll(CronUtils.getSelfFireDateList(startDate, endDate, schedule.getCrontab())); } } // get first fire date Iterator<Date> iterator = null; Date scheduleDate = null; if (!CollectionUtils.isEmpty(listDate)) { iterator = listDate.iterator(); scheduleDate = iterator.next(); processInstance.setScheduleTime(scheduleDate); processService.updateProcessInstance(processInstance); } else { scheduleDate = processInstance.getScheduleTime(); if (scheduleDate == null) { scheduleDate = startDate; } } while (Stopper.isRunning()) { logger.info("process {} start to complement {} data", processInstance.getId(), DateUtils.dateToString(scheduleDate)); // prepare dag and other info prepareProcess(); if (dag == null) { logger.error("process {} dag is null, please check out parameters", processInstance.getId()); processInstance.setState(ExecutionStatus.SUCCESS); processService.updateProcessInstance(processInstance); return; } // execute process ,waiting for end runProcess(); endProcess(); // process instance failure ,no more complements if (!processInstance.getState().typeIsSuccess()) { logger.info("process {} state {}, complement not completely!", processInstance.getId(), processInstance.getState()); break; } // current process instance success ,next execute if (null == iterator) { // loop by day scheduleDate = DateUtils.getSomeDay(scheduleDate, 1); if (scheduleDate.after(endDate)) { // all success logger.info("process {} complement completely!", processInstance.getId()); break; } } else { // loop by schedule date if (!iterator.hasNext()) { // all success logger.info("process {} complement completely!", processInstance.getId()); break; } scheduleDate = iterator.next(); } // flow end // execute next process instance complement data processInstance.setScheduleTime(scheduleDate); if (cmdParam.containsKey(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING)) { cmdParam.remove(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING); processInstance.setCommandParam(JSONUtils.toJsonString(cmdParam)); } processInstance.setState(ExecutionStatus.RUNNING_EXECUTION); processInstance.setGlobalParams(ParameterUtils.curingGlobalParams( processInstance.getProcessDefinition().getGlobalParamMap(), processInstance.getProcessDefinition().getGlobalParamList(), CommandType.COMPLEMENT_DATA, processInstance.getScheduleTime())); processInstance.setId(0); processInstance.setStartTime(new Date()); processInstance.setEndTime(null); processService.saveProcessInstance(processInstance); } } /** * prepare process parameter * * @throws Exception exception */ private void prepareProcess() throws Exception { // gen process dag buildFlowDag(); // init task queue initTaskQueue(); logger.info("prepare process :{} end", processInstance.getId()); } /** * process end handle */ private void endProcess() { processInstance.setEndTime(new Date()); processService.updateProcessInstance(processInstance); if (processInstance.getState().typeIsWaitingThread()) { processService.createRecoveryWaitingThreadCommand(null, processInstance); } List<TaskInstance> taskInstances = processService.findValidTaskListByProcessId(processInstance.getId()); ProjectUser projectUser = processService.queryProjectWithUserByProcessInstanceId(processInstance.getId()); alertManager.sendAlertProcessInstance(processInstance, taskInstances, projectUser); } /** * generate process dag * * @throws Exception exception */ private void buildFlowDag() throws Exception { recoverNodeIdList = getStartTaskInstanceList(processInstance.getCommandParam()); forbiddenTaskList = DagHelper.getForbiddenTaskNodeMaps(processInstance.getProcessInstanceJson()); // generate process to get DAG info List<String> recoveryNameList = getRecoveryNodeNameList(); List<String> startNodeNameList = parseStartNodeName(processInstance.getCommandParam()); ProcessDag processDag = generateFlowDag(processInstance.getProcessInstanceJson(), startNodeNameList, recoveryNameList, processInstance.getTaskDependType()); if (processDag == null) { logger.error("processDag is null"); return; } // generate process dag dag = DagHelper.buildDagGraph(processDag); } /** * init task queue */ private void initTaskQueue() { taskFailedSubmit = false; activeTaskNode.clear(); dependFailedTask.clear(); completeTaskList.clear(); errorTaskList.clear(); List<TaskInstance> taskInstanceList = processService.findValidTaskListByProcessId(processInstance.getId()); for (TaskInstance task : taskInstanceList) { if (task.isTaskComplete()) { completeTaskList.put(task.getName(), task); } if (task.isConditionsTask() || DagHelper.haveConditionsAfterNode(task.getName(), dag)) { continue; } if (task.getState().typeIsFailure() && !task.taskCanRetry()) { errorTaskList.put(task.getName(), task); } } } /** * process post handle */ private void postHandle() { logger.info("develop mode is: {}", CommonUtils.isDevelopMode()); if (!CommonUtils.isDevelopMode()) { // get exec dir String execLocalPath = org.apache.dolphinscheduler.common.utils.FileUtils .getProcessExecDir(processInstance.getProcessDefinition().getProjectId(), processInstance.getProcessDefinitionId(), processInstance.getId()); try { FileUtils.deleteDirectory(new File(execLocalPath)); } catch (IOException e) { logger.error("delete exec dir failed ", e); } } } /** * submit task to execute * * @param taskInstance task instance * @return TaskInstance */ private TaskInstance submitTaskExec(TaskInstance taskInstance) { MasterBaseTaskExecThread abstractExecThread = null; if (taskInstance.isSubProcess()) { abstractExecThread = new SubProcessTaskExecThread(taskInstance); } else if (taskInstance.isDependTask()) { abstractExecThread = new DependentTaskExecThread(taskInstance); } else if (taskInstance.isConditionsTask()) { abstractExecThread = new ConditionsTaskExecThread(taskInstance); } else { abstractExecThread = new MasterTaskExecThread(taskInstance); } Future<Boolean> future = taskExecService.submit(abstractExecThread); activeTaskNode.putIfAbsent(abstractExecThread, future); return abstractExecThread.getTaskInstance(); } /** * find task instance in db. * in case submit more than one same name task in the same time. * * @param taskName task name * @return TaskInstance */ private TaskInstance findTaskIfExists(String taskName) { List<TaskInstance> taskInstanceList = processService.findValidTaskListByProcessId(this.processInstance.getId()); for (TaskInstance taskInstance : taskInstanceList) { if (taskInstance.getName().equals(taskName)) { return taskInstance; } } return null; } /** * encapsulation task * * @param processInstance process instance * @param nodeName node name * @return TaskInstance */ private TaskInstance createTaskInstance(ProcessInstance processInstance, String nodeName, TaskNode taskNode) { //update processInstance for update the globalParams this.processInstance = this.processService.findProcessInstanceById(this.processInstance.getId()); TaskInstance taskInstance = findTaskIfExists(nodeName); if (taskInstance == null) { taskInstance = new TaskInstance(); // task name taskInstance.setName(nodeName); // process instance define id taskInstance.setProcessDefinitionId(processInstance.getProcessDefinitionId()); // task instance state taskInstance.setState(ExecutionStatus.SUBMITTED_SUCCESS); // process instance id taskInstance.setProcessInstanceId(processInstance.getId()); // task instance node json taskInstance.setTaskJson(JSONUtils.toJsonString(taskNode)); // task instance type taskInstance.setTaskType(taskNode.getType()); // task instance whether alert taskInstance.setAlertFlag(Flag.NO); // task instance start time taskInstance.setStartTime(null); // task instance flag taskInstance.setFlag(Flag.YES); // task instance retry times taskInstance.setRetryTimes(0); // max task instance retry times taskInstance.setMaxRetryTimes(taskNode.getMaxRetryTimes()); // retry task instance interval taskInstance.setRetryInterval(taskNode.getRetryInterval()); // task instance priority if (taskNode.getTaskInstancePriority() == null) { taskInstance.setTaskInstancePriority(Priority.MEDIUM); } else { taskInstance.setTaskInstancePriority(taskNode.getTaskInstancePriority()); } String processWorkerGroup = processInstance.getWorkerGroup(); processWorkerGroup = StringUtils.isBlank(processWorkerGroup) ? DEFAULT_WORKER_GROUP : processWorkerGroup; String taskWorkerGroup = StringUtils.isBlank(taskNode.getWorkerGroup()) ? processWorkerGroup : taskNode.getWorkerGroup(); if (!processWorkerGroup.equals(DEFAULT_WORKER_GROUP) && taskWorkerGroup.equals(DEFAULT_WORKER_GROUP)) { taskInstance.setWorkerGroup(processWorkerGroup); } else { taskInstance.setWorkerGroup(taskWorkerGroup); } //get process global setProcessGlobal(taskNode, taskInstance); // delay execution time taskInstance.setDelayTime(taskNode.getDelayTime()); } return taskInstance; } private void setProcessGlobal(TaskNode taskNode, TaskInstance taskInstance) { String globalParams = this.processInstance.getGlobalParams(); if (StringUtils.isNotEmpty(globalParams)) { Map<String, String> globalMap = getGlobalParamMap(globalParams); if (globalMap != null && globalMap.size() != 0) { setGlobalMapToTask(taskNode, taskInstance, globalMap); } } } private void setGlobalMapToTask(TaskNode taskNode, TaskInstance taskInstance, Map<String, String> globalMap) { // the param save in localParams Map<String, Object> result = JSONUtils.toMap(taskNode.getParams(), String.class, Object.class); Object localParams = result.get(LOCAL_PARAMS); if (localParams != null) { List<Property> allParam = JSONUtils.toList(JSONUtils.toJsonString(localParams), Property.class); for (Property info : allParam) { if (info.getDirect().equals(Direct.IN)) { String paramName = info.getProp(); String value = globalMap.get(paramName); if (StringUtils.isNotEmpty(value)) { info.setValue(value); } } } result.put(LOCAL_PARAMS, allParam); taskNode.setParams(JSONUtils.toJsonString(result)); // task instance node json taskInstance.setTaskJson(JSONUtils.toJsonString(taskNode)); } } public Map<String, String> getGlobalParamMap(String globalParams) { List<Property> propList; Map<String,String> globalParamMap = new HashMap<>(); if (StringUtils.isNotEmpty(globalParams)) { propList = JSONUtils.toList(globalParams, Property.class); globalParamMap = propList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue)); } return globalParamMap; } private void submitPostNode(String parentNodeName) { Set<String> submitTaskNodeList = DagHelper.parsePostNodes(parentNodeName, skipTaskNodeList, dag, completeTaskList); List<TaskInstance> taskInstances = new ArrayList<>(); for (String taskNode : submitTaskNodeList) { try { VarPoolUtils.convertVarPoolToMap(propToValue, processInstance.getVarPool()); } catch (ParseException e) { logger.error("parse {} exception", processInstance.getVarPool(), e); throw new RuntimeException(); } TaskNode taskNodeObject = dag.getNode(taskNode); VarPoolUtils.setTaskNodeLocalParams(taskNodeObject, propToValue); taskInstances.add(createTaskInstance(processInstance, taskNode, taskNodeObject)); } // if previous node success , post node submit for (TaskInstance task : taskInstances) { if (readyToSubmitTaskQueue.contains(task)) { continue; } if (completeTaskList.containsKey(task.getName())) { logger.info("task {} has already run success", task.getName()); continue; } if (task.getState().typeIsPause() || task.getState().typeIsCancel()) { logger.info("task {} stopped, the state is {}", task.getName(), task.getState()); } else { addTaskToStandByList(task); } } } /** * determine whether the dependencies of the task node are complete * * @return DependResult */ private DependResult isTaskDepsComplete(String taskName) { Collection<String> startNodes = dag.getBeginNode(); // if vertex,returns true directly if (startNodes.contains(taskName)) { return DependResult.SUCCESS; } TaskNode taskNode = dag.getNode(taskName); List<String> depNameList = taskNode.getDepList(); for (String depsNode : depNameList) { if (!dag.containsNode(depsNode) || forbiddenTaskList.containsKey(depsNode) || skipTaskNodeList.containsKey(depsNode)) { continue; } // dependencies must be fully completed if (!completeTaskList.containsKey(depsNode)) { return DependResult.WAITING; } ExecutionStatus depTaskState = completeTaskList.get(depsNode).getState(); if (depTaskState.typeIsPause() || depTaskState.typeIsCancel()) { return DependResult.WAITING; } // ignore task state if current task is condition if (taskNode.isConditionsTask()) { continue; } if (!dependTaskSuccess(depsNode, taskName)) { return DependResult.FAILED; } } logger.info("taskName: {} completeDependTaskList: {}", taskName, Arrays.toString(completeTaskList.keySet().toArray())); return DependResult.SUCCESS; } /** * depend node is completed, but here need check the condition task branch is the next node */ private boolean dependTaskSuccess(String dependNodeName, String nextNodeName) { if (dag.getNode(dependNodeName).isConditionsTask()) { //condition task need check the branch to run List<String> nextTaskList = DagHelper.parseConditionTask(dependNodeName, skipTaskNodeList, dag, completeTaskList); if (!nextTaskList.contains(nextNodeName)) { return false; } } else { ExecutionStatus depTaskState = completeTaskList.get(dependNodeName).getState(); if (depTaskState.typeIsFailure()) { return false; } } return true; } /** * query task instance by complete state * * @param state state * @return task instance list */ private List<TaskInstance> getCompleteTaskByState(ExecutionStatus state) { List<TaskInstance> resultList = new ArrayList<>(); for (Map.Entry<String, TaskInstance> entry : completeTaskList.entrySet()) { if (entry.getValue().getState() == state) { resultList.add(entry.getValue()); } } return resultList; } /** * where there are ongoing tasks * * @param state state * @return ExecutionStatus */ private ExecutionStatus runningState(ExecutionStatus state) { if (state == ExecutionStatus.READY_STOP || state == ExecutionStatus.READY_PAUSE || state == ExecutionStatus.WAITTING_THREAD || state == ExecutionStatus.DELAY_EXECUTION) { // if the running task is not completed, the state remains unchanged return state; } else { return ExecutionStatus.RUNNING_EXECUTION; } } /** * exists failure task,contains submit failure、dependency failure,execute failure(retry after) * * @return Boolean whether has failed task */ private boolean hasFailedTask() { if (this.taskFailedSubmit) { return true; } if (this.errorTaskList.size() > 0) { return true; } return this.dependFailedTask.size() > 0; } /** * process instance failure * * @return Boolean whether process instance failed */ private boolean processFailed() { if (hasFailedTask()) { if (processInstance.getFailureStrategy() == FailureStrategy.END) { return true; } if (processInstance.getFailureStrategy() == FailureStrategy.CONTINUE) { return readyToSubmitTaskQueue.size() == 0 || activeTaskNode.size() == 0; } } return false; } /** * whether task for waiting thread * * @return Boolean whether has waiting thread task */ private boolean hasWaitingThreadTask() { List<TaskInstance> waitingList = getCompleteTaskByState(ExecutionStatus.WAITTING_THREAD); return CollectionUtils.isNotEmpty(waitingList); } /** * prepare for pause * 1,failed retry task in the preparation queue , returns to failure directly * 2,exists pause task,complement not completed, pending submission of tasks, return to suspension * 3,success * * @return ExecutionStatus */ private ExecutionStatus processReadyPause() { if (hasRetryTaskInStandBy()) { return ExecutionStatus.FAILURE; } List<TaskInstance> pauseList = getCompleteTaskByState(ExecutionStatus.PAUSE); if (CollectionUtils.isNotEmpty(pauseList) || !isComplementEnd() || readyToSubmitTaskQueue.size() > 0) { return ExecutionStatus.PAUSE; } else { return ExecutionStatus.SUCCESS; } } /** * generate the latest process instance status by the tasks state * * @return process instance execution status */ private ExecutionStatus getProcessInstanceState() { ProcessInstance instance = processService.findProcessInstanceById(processInstance.getId()); ExecutionStatus state = instance.getState(); if (activeTaskNode.size() > 0 || hasRetryTaskInStandBy()) { // active task and retry task exists return runningState(state); } // process failure if (processFailed()) { return ExecutionStatus.FAILURE; } // waiting thread if (hasWaitingThreadTask()) { return ExecutionStatus.WAITTING_THREAD; } // pause if (state == ExecutionStatus.READY_PAUSE) { return processReadyPause(); } // stop if (state == ExecutionStatus.READY_STOP) { List<TaskInstance> stopList = getCompleteTaskByState(ExecutionStatus.STOP); List<TaskInstance> killList = getCompleteTaskByState(ExecutionStatus.KILL); if (CollectionUtils.isNotEmpty(stopList) || CollectionUtils.isNotEmpty(killList) || !isComplementEnd()) { return ExecutionStatus.STOP; } else { return ExecutionStatus.SUCCESS; } } // success if (state == ExecutionStatus.RUNNING_EXECUTION) { List<TaskInstance> killTasks = getCompleteTaskByState(ExecutionStatus.KILL); if (readyToSubmitTaskQueue.size() > 0) { //tasks currently pending submission, no retries, indicating that depend is waiting to complete return ExecutionStatus.RUNNING_EXECUTION; } else if (CollectionUtils.isNotEmpty(killTasks)) { // tasks maybe killed manually return ExecutionStatus.FAILURE; } else { // if the waiting queue is empty and the status is in progress, then success return ExecutionStatus.SUCCESS; } } return state; } /** * whether standby task list have retry tasks */ private boolean retryTaskExists() { boolean result = false; for (Iterator<TaskInstance> iter = readyToSubmitTaskQueue.iterator(); iter.hasNext(); ) { TaskInstance task = iter.next(); if (task.getState().typeIsFailure()) { result = true; break; } } return result; } /** * whether complement end * * @return Boolean whether is complement end */ private boolean isComplementEnd() { if (!processInstance.isComplementData()) { return true; } try { Map<String, String> cmdParam = JSONUtils.toMap(processInstance.getCommandParam()); Date endTime = DateUtils.getScheduleDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE)); return processInstance.getScheduleTime().equals(endTime); } catch (Exception e) { logger.error("complement end failed ", e); return false; } } /** * updateProcessInstance process instance state * after each batch of tasks is executed, the status of the process instance is updated */ private void updateProcessInstanceState() { ExecutionStatus state = getProcessInstanceState(); if (processInstance.getState() != state) { logger.info( "work flow process instance [id: {}, name:{}], state change from {} to {}, cmd type: {}", processInstance.getId(), processInstance.getName(), processInstance.getState(), state, processInstance.getCommandType()); ProcessInstance instance = processService.findProcessInstanceById(processInstance.getId()); instance.setState(state); instance.setProcessDefinition(processInstance.getProcessDefinition()); processService.updateProcessInstance(instance); processInstance = instance; } } /** * get task dependency result * * @param taskInstance task instance * @return DependResult */ private DependResult getDependResultForTask(TaskInstance taskInstance) { return isTaskDepsComplete(taskInstance.getName()); } /** * add task to standby list * * @param taskInstance task instance */ private void addTaskToStandByList(TaskInstance taskInstance) { logger.info("add task to stand by list: {}", taskInstance.getName()); try { readyToSubmitTaskQueue.put(taskInstance); } catch (Exception e) { logger.error("add task instance to readyToSubmitTaskQueue error"); } } /** * remove task from stand by list * * @param taskInstance task instance */ private void removeTaskFromStandbyList(TaskInstance taskInstance) { logger.info("remove task from stand by list: {}", taskInstance.getName()); try { readyToSubmitTaskQueue.remove(taskInstance); } catch (Exception e) { logger.error("remove task instance from readyToSubmitTaskQueue error"); } } /** * has retry task in standby * * @return Boolean whether has retry task in standby */ private boolean hasRetryTaskInStandBy() { for (Iterator<TaskInstance> iter = readyToSubmitTaskQueue.iterator(); iter.hasNext(); ) { if (iter.next().getState().typeIsFailure()) { return true; } } return false; } /** * submit and watch the tasks, until the work flow stop */ private void runProcess() { // submit start node submitPostNode(null); boolean sendTimeWarning = false; while (!processInstance.isProcessInstanceStop() && Stopper.isRunning()) { // send warning email if process time out. if (!sendTimeWarning && checkProcessTimeOut(processInstance)) { alertManager.sendProcessTimeoutAlert(processInstance, processService.findProcessDefineById(processInstance.getProcessDefinitionId())); sendTimeWarning = true; } for (Map.Entry<MasterBaseTaskExecThread, Future<Boolean>> entry : activeTaskNode.entrySet()) { Future<Boolean> future = entry.getValue(); TaskInstance task = entry.getKey().getTaskInstance(); if (!future.isDone()) { continue; } // node monitor thread complete task = this.processService.findTaskInstanceById(task.getId()); if (task == null) { this.taskFailedSubmit = true; activeTaskNode.remove(entry.getKey()); continue; } // node monitor thread complete if (task.getState().typeIsFinished()) { activeTaskNode.remove(entry.getKey()); } logger.info("task :{}, id:{} complete, state is {} ", task.getName(), task.getId(), task.getState()); // node success , post node submit if (task.getState() == ExecutionStatus.SUCCESS) { processInstance = processService.findProcessInstanceById(processInstance.getId()); processInstance.setVarPool(task.getVarPool()); processService.updateProcessInstance(processInstance); completeTaskList.put(task.getName(), task); submitPostNode(task.getName()); continue; } // node fails, retry first, and then execute the failure process if (task.getState().typeIsFailure()) { if (task.getState() == ExecutionStatus.NEED_FAULT_TOLERANCE) { this.recoverToleranceFaultTaskList.add(task); } if (task.taskCanRetry()) { addTaskToStandByList(task); } else { completeTaskList.put(task.getName(), task); if (task.isConditionsTask() || DagHelper.haveConditionsAfterNode(task.getName(), dag)) { submitPostNode(task.getName()); } else { errorTaskList.put(task.getName(), task); if (processInstance.getFailureStrategy() == FailureStrategy.END) { killTheOtherTasks(); } } } continue; } // other status stop/pause completeTaskList.put(task.getName(), task); } // send alert if (CollectionUtils.isNotEmpty(this.recoverToleranceFaultTaskList)) { alertManager.sendAlertWorkerToleranceFault(processInstance, recoverToleranceFaultTaskList); this.recoverToleranceFaultTaskList.clear(); } // updateProcessInstance completed task status // failure priority is higher than pause // if a task fails, other suspended tasks need to be reset kill // check if there exists forced success nodes in errorTaskList if (errorTaskList.size() > 0) { for (Map.Entry<String, TaskInstance> entry : completeTaskList.entrySet()) { TaskInstance completeTask = entry.getValue(); if (completeTask.getState() == ExecutionStatus.PAUSE) { completeTask.setState(ExecutionStatus.KILL); completeTaskList.put(entry.getKey(), completeTask); processService.updateTaskInstance(completeTask); } } for (Map.Entry<String, TaskInstance> entry : errorTaskList.entrySet()) { TaskInstance errorTask = entry.getValue(); TaskInstance currentTask = processService.findTaskInstanceById(errorTask.getId()); if (currentTask == null) { continue; } // for nodes that have been forced success if (errorTask.getState().typeIsFailure() && currentTask.getState().equals(ExecutionStatus.FORCED_SUCCESS)) { // update state in this thread and remove from errorTaskList errorTask.setState(currentTask.getState()); logger.info("task: {} has been forced success, remove it from error task list", errorTask.getName()); errorTaskList.remove(errorTask.getName()); // submit post nodes submitPostNode(errorTask.getName()); } } } if (canSubmitTaskToQueue()) { submitStandByTask(); } try { Thread.sleep(Constants.SLEEP_TIME_MILLIS); } catch (InterruptedException e) { logger.error(e.getMessage(), e); Thread.currentThread().interrupt(); } updateProcessInstanceState(); } logger.info("process:{} end, state :{}", processInstance.getId(), processInstance.getState()); } /** * whether check process time out * * @param processInstance task instance * @return true if time out of process instance > running time of process instance */ private boolean checkProcessTimeOut(ProcessInstance processInstance) { if (processInstance.getTimeout() == 0) { return false; } Date now = new Date(); long runningTime = DateUtils.diffMin(now, processInstance.getStartTime()); return runningTime > processInstance.getTimeout(); } /** * whether can submit task to queue * * @return boolean */ private boolean canSubmitTaskToQueue() { return OSUtils.checkResource(masterConfig.getMasterMaxCpuloadAvg(), masterConfig.getMasterReservedMemory()); } /** * close the on going tasks */ private void killTheOtherTasks() { logger.info("kill called on process instance id: {}, num: {}", processInstance.getId(), activeTaskNode.size()); for (Map.Entry<MasterBaseTaskExecThread, Future<Boolean>> entry : activeTaskNode.entrySet()) { MasterBaseTaskExecThread taskExecThread = entry.getKey(); Future<Boolean> future = entry.getValue(); TaskInstance taskInstance = taskExecThread.getTaskInstance(); taskInstance = processService.findTaskInstanceById(taskInstance.getId()); if (taskInstance != null && taskInstance.getState().typeIsFinished()) { continue; } if (!future.isDone()) { // record kill info logger.info("kill process instance, id: {}, task: {}", processInstance.getId(), taskExecThread.getTaskInstance().getId()); // kill node taskExecThread.kill(); } } } /** * whether the retry interval is timed out * * @param taskInstance task instance * @return Boolean */ private boolean retryTaskIntervalOverTime(TaskInstance taskInstance) { if (taskInstance.getState() != ExecutionStatus.FAILURE) { return true; } if (taskInstance.getId() == 0 || taskInstance.getMaxRetryTimes() == 0 || taskInstance.getRetryInterval() == 0) { return true; } Date now = new Date(); long failedTimeInterval = DateUtils.differSec(now, taskInstance.getEndTime()); // task retry does not over time, return false return taskInstance.getRetryInterval() * SEC_2_MINUTES_TIME_UNIT < failedTimeInterval; } /** * handling the list of tasks to be submitted */ private void submitStandByTask() { try { int length = readyToSubmitTaskQueue.size(); for (int i = 0; i < length; i++) { TaskInstance task = readyToSubmitTaskQueue.peek(); // stop tasks which is retrying if forced success happens if (task.taskCanRetry()) { TaskInstance retryTask = processService.findTaskInstanceById(task.getId()); if (retryTask != null && retryTask.getState().equals(ExecutionStatus.FORCED_SUCCESS)) { task.setState(retryTask.getState()); logger.info("task: {} has been forced success, put it into complete task list and stop retrying", task.getName()); removeTaskFromStandbyList(task); completeTaskList.put(task.getName(), task); submitPostNode(task.getName()); continue; } } DependResult dependResult = getDependResultForTask(task); if (DependResult.SUCCESS == dependResult) { if (retryTaskIntervalOverTime(task)) { submitTaskExec(task); removeTaskFromStandbyList(task); } } else if (DependResult.FAILED == dependResult) { // if the dependency fails, the current node is not submitted and the state changes to failure. dependFailedTask.put(task.getName(), task); removeTaskFromStandbyList(task); logger.info("task {},id:{} depend result : {}", task.getName(), task.getId(), dependResult); } } } catch (Exception e) { logger.error("submit standby task error", e); } } /** * get recovery task instance * * @param taskId task id * @return recovery task instance */ private TaskInstance getRecoveryTaskInstance(String taskId) { if (!StringUtils.isNotEmpty(taskId)) { return null; } try { Integer intId = Integer.valueOf(taskId); TaskInstance task = processService.findTaskInstanceById(intId); if (task == null) { logger.error("start node id cannot be found: {}", taskId); } else { return task; } } catch (Exception e) { logger.error("get recovery task instance failed ", e); } return null; } /** * get start task instance list * * @param cmdParam command param * @return task instance list */ private List<TaskInstance> getStartTaskInstanceList(String cmdParam) { List<TaskInstance> instanceList = new ArrayList<>(); Map<String, String> paramMap = JSONUtils.toMap(cmdParam); if (paramMap != null && paramMap.containsKey(CMD_PARAM_RECOVERY_START_NODE_STRING)) { String[] idList = paramMap.get(CMD_PARAM_RECOVERY_START_NODE_STRING).split(Constants.COMMA); for (String nodeId : idList) { TaskInstance task = getRecoveryTaskInstance(nodeId); if (task != null) { instanceList.add(task); } } } return instanceList; } /** * parse "StartNodeNameList" from cmd param * * @param cmdParam command param * @return start node name list */ private List<String> parseStartNodeName(String cmdParam) { List<String> startNodeNameList = new ArrayList<>(); Map<String, String> paramMap = JSONUtils.toMap(cmdParam); if (paramMap == null) { return startNodeNameList; } if (paramMap.containsKey(CMD_PARAM_START_NODE_NAMES)) { startNodeNameList = Arrays.asList(paramMap.get(CMD_PARAM_START_NODE_NAMES).split(Constants.COMMA)); } return startNodeNameList; } /** * generate start node name list from parsing command param; * if "StartNodeIdList" exists in command param, return StartNodeIdList * * @return recovery node name list */ private List<String> getRecoveryNodeNameList() { List<String> recoveryNodeNameList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(recoverNodeIdList)) { for (TaskInstance task : recoverNodeIdList) { recoveryNodeNameList.add(task.getName()); } } return recoveryNodeNameList; } /** * generate flow dag * * @param processDefinitionJson process definition json * @param startNodeNameList start node name list * @param recoveryNodeNameList recovery node name list * @param depNodeType depend node type * @return ProcessDag process dag * @throws Exception exception */ public ProcessDag generateFlowDag(String processDefinitionJson, List<String> startNodeNameList, List<String> recoveryNodeNameList, TaskDependType depNodeType) throws Exception { return DagHelper.generateFlowDag(processDefinitionJson, startNodeNameList, recoveryNodeNameList, depNodeType); } }