status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
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 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,529 | [Bug] [Task] Failed to get environment variables when I used the python task. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I didn't get environment variables that is set in the file 'dolphinscheduler_env.sh" when I was running a python task.
The Python script is as follows:

But the result was not what I want. The detail information is as follows:
```
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : tenantCode :calvin, task dir:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : generate command file:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50/py_36_50.command
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : #-*- encoding=utf8 -*-
import os
import sys
print("Python version:%s\n" %(sys.version))
print("HADOOP_HOME=%s\n" %(os.getenv('HADOOP_HOME')))
print("HADOOP_CONF_DIR=%s\n" %(os.getenv('HADOOP_CONF_DIR')))
print("SPARK_HOME1=%s\n" %(os.getenv('SPARK_HOME1')))
print("SPARK_HOME2=%s\n" %(os.getenv('SPARK_HOME2')))
print("PYTHON_HOME=%s\n" %(os.getenv('PYTHON_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("HIVE_HOME=%s\n" %(os.getenv('HIVE_HOME')))
print("FLINK_HOME=%s\n" %(os.getenv('FLINK_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("DATAX_HOME=%s\n" %(os.getenv('DATAX_HOME')))
print("PATH=%s\n" %(os.getenv('PATH')))
2021-10-14 14:43:15.926 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : task run command: sudo -u calvin python /tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50/py_36_50.command
2021-10-14 14:43:15.930 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : process start, process id is: 86802
2021-10-14 14:43:16.297 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : process has exited, execute path:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50, processId:86802 ,exitStatusCode:0 ,processWaitForStatus:true ,processExitValue:0
2021-10-14 14:43:16.298 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : task instance id : 50,task final status : SUCCESS
2021-10-14 14:43:16.298 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : develop mode is: false
2021-10-14 14:43:16.301 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : exec local path: /tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50 cleared.
2021-10-14 14:43:16.931 INFO 86302 --- [skLogInfo-36_50] [taskAppId=TASK-806053553881088_2-36-50] : -> welcome to use bigdata scheduling system...
Python version:2.7.16 (default, Jun 18 2021, 03:23:53)
[GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy
HADOOP_HOME=None
HADOOP_CONF_DIR=None
SPARK_HOME1=None
SPARK_HOME2=None
PYTHON_HOME=None
JAVA_HOME=None
HIVE_HOME=None
FLINK_HOME=None
JAVA_HOME=None
DATAX_HOME=None
PATH=/usr/local/Cellar/pyenv/1.2.16/libexec:/usr/local/Cellar/pyenv/1.2.16/libexec:/usr/local/opt/nvm/versions/node/v12.4.0/bin:/usr/local/Cellar/pyenv-virtualenv/1.1.3/shims:/Users/calvin/.pyenv/shims:/usr/local/bin:/usr/local/cuda/bin:/Users/calvin/opt/hadoop-2.6.5/bin:/Users/calvin/redis-4.0.8/src:/Users/calvin/btrace/bin:/Library/java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin:/usr/local/opt/maven3/bin:/Users/calvin/phantomjs-2.1.1/bin:/Users/calvin/sysdir/apache-flume-1.7.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/opt/apache-tinkerpop-gremlin-console-3.4.3/bin:/usr/local/Cellar/postgresql@10/10.11/bin:/usr/local/sbin:/opt/gradle/gradle-7.2/bin:/opt/javacc-javacc-7.0.10/scripts
2021-10-14 14:43:16.931 INFO 86302 --- [skLogInfo-36_50] [taskAppId=TASK-806053553881088_2-36-50] : FINALIZE_SESSION
```
### What you expected to happen
I expect that I can get environment variables in the python script.
### How to reproduce
1. First you can create a python task and set the script content as follows:
```
import os
import sys
print("Python version:%s\n" %(sys.version))
print("HADOOP_HOME=%s\n" %(os.getenv('HADOOP_HOME')))
print("HADOOP_CONF_DIR=%s\n" %(os.getenv('HADOOP_CONF_DIR')))
print("SPARK_HOME1=%s\n" %(os.getenv('SPARK_HOME1')))
print("SPARK_HOME2=%s\n" %(os.getenv('SPARK_HOME2')))
print("PYTHON_HOME=%s\n" %(os.getenv('PYTHON_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("HIVE_HOME=%s\n" %(os.getenv('HIVE_HOME')))
print("FLINK_HOME=%s\n" %(os.getenv('FLINK_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("DATAX_HOME=%s\n" %(os.getenv('DATAX_HOME')))
print("PATH=%s\n" %(os.getenv('PATH')))
```
2. And then You save it and run this task manually.
3. Finally you will see the result without environment variables in the 'dolphinscheduler_env.sh';
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6529 | https://github.com/apache/dolphinscheduler/pull/6531 | 4d0869fcc085f7b4d8af2182bb8b16b70ff6482c | 8200bc14526364fa1908b1df82befc984b0419aa | "2021-10-14T07:01:47Z" | java | "2021-10-18T09:33:16Z" | dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonCommandExecutor.java | String[] arrs = result.split(PythonConstants.EQUAL_SIGN);
if (arrs.length == 2) {
return arrs[1];
}
} catch (IOException e) {
logger.error("read file failure", e);
}
return null;
}
/**
* Gets the command path to which Python can execute
* @return python command path
*/
@Override
protected String commandInterpreter() {
String pythonHome = getPythonHome(taskRequest.getEnvFile());
if (StringUtils.isNotBlank(taskRequest.getEnvironmentConfig())) {
pythonHome = getPythonHomeFromEnvironmentConfig(taskRequest.getEnvironmentConfig());
}
return getPythonCommand(pythonHome);
}
/**
* get python command
*
* @param pythonHome python home
* @return python command
*/
public static String getPythonCommand(String pythonHome) {
if (StringUtils.isEmpty(pythonHome)) {
return PYTHON; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,529 | [Bug] [Task] Failed to get environment variables when I used the python task. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I didn't get environment variables that is set in the file 'dolphinscheduler_env.sh" when I was running a python task.
The Python script is as follows:

But the result was not what I want. The detail information is as follows:
```
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : tenantCode :calvin, task dir:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : generate command file:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50/py_36_50.command
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : #-*- encoding=utf8 -*-
import os
import sys
print("Python version:%s\n" %(sys.version))
print("HADOOP_HOME=%s\n" %(os.getenv('HADOOP_HOME')))
print("HADOOP_CONF_DIR=%s\n" %(os.getenv('HADOOP_CONF_DIR')))
print("SPARK_HOME1=%s\n" %(os.getenv('SPARK_HOME1')))
print("SPARK_HOME2=%s\n" %(os.getenv('SPARK_HOME2')))
print("PYTHON_HOME=%s\n" %(os.getenv('PYTHON_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("HIVE_HOME=%s\n" %(os.getenv('HIVE_HOME')))
print("FLINK_HOME=%s\n" %(os.getenv('FLINK_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("DATAX_HOME=%s\n" %(os.getenv('DATAX_HOME')))
print("PATH=%s\n" %(os.getenv('PATH')))
2021-10-14 14:43:15.926 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : task run command: sudo -u calvin python /tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50/py_36_50.command
2021-10-14 14:43:15.930 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : process start, process id is: 86802
2021-10-14 14:43:16.297 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : process has exited, execute path:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50, processId:86802 ,exitStatusCode:0 ,processWaitForStatus:true ,processExitValue:0
2021-10-14 14:43:16.298 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : task instance id : 50,task final status : SUCCESS
2021-10-14 14:43:16.298 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : develop mode is: false
2021-10-14 14:43:16.301 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : exec local path: /tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50 cleared.
2021-10-14 14:43:16.931 INFO 86302 --- [skLogInfo-36_50] [taskAppId=TASK-806053553881088_2-36-50] : -> welcome to use bigdata scheduling system...
Python version:2.7.16 (default, Jun 18 2021, 03:23:53)
[GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy
HADOOP_HOME=None
HADOOP_CONF_DIR=None
SPARK_HOME1=None
SPARK_HOME2=None
PYTHON_HOME=None
JAVA_HOME=None
HIVE_HOME=None
FLINK_HOME=None
JAVA_HOME=None
DATAX_HOME=None
PATH=/usr/local/Cellar/pyenv/1.2.16/libexec:/usr/local/Cellar/pyenv/1.2.16/libexec:/usr/local/opt/nvm/versions/node/v12.4.0/bin:/usr/local/Cellar/pyenv-virtualenv/1.1.3/shims:/Users/calvin/.pyenv/shims:/usr/local/bin:/usr/local/cuda/bin:/Users/calvin/opt/hadoop-2.6.5/bin:/Users/calvin/redis-4.0.8/src:/Users/calvin/btrace/bin:/Library/java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin:/usr/local/opt/maven3/bin:/Users/calvin/phantomjs-2.1.1/bin:/Users/calvin/sysdir/apache-flume-1.7.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/opt/apache-tinkerpop-gremlin-console-3.4.3/bin:/usr/local/Cellar/postgresql@10/10.11/bin:/usr/local/sbin:/opt/gradle/gradle-7.2/bin:/opt/javacc-javacc-7.0.10/scripts
2021-10-14 14:43:16.931 INFO 86302 --- [skLogInfo-36_50] [taskAppId=TASK-806053553881088_2-36-50] : FINALIZE_SESSION
```
### What you expected to happen
I expect that I can get environment variables in the python script.
### How to reproduce
1. First you can create a python task and set the script content as follows:
```
import os
import sys
print("Python version:%s\n" %(sys.version))
print("HADOOP_HOME=%s\n" %(os.getenv('HADOOP_HOME')))
print("HADOOP_CONF_DIR=%s\n" %(os.getenv('HADOOP_CONF_DIR')))
print("SPARK_HOME1=%s\n" %(os.getenv('SPARK_HOME1')))
print("SPARK_HOME2=%s\n" %(os.getenv('SPARK_HOME2')))
print("PYTHON_HOME=%s\n" %(os.getenv('PYTHON_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("HIVE_HOME=%s\n" %(os.getenv('HIVE_HOME')))
print("FLINK_HOME=%s\n" %(os.getenv('FLINK_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("DATAX_HOME=%s\n" %(os.getenv('DATAX_HOME')))
print("PATH=%s\n" %(os.getenv('PATH')))
```
2. And then You save it and run this task manually.
3. Finally you will see the result without environment variables in the 'dolphinscheduler_env.sh';
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6529 | https://github.com/apache/dolphinscheduler/pull/6531 | 4d0869fcc085f7b4d8af2182bb8b16b70ff6482c | 8200bc14526364fa1908b1df82befc984b0419aa | "2021-10-14T07:01:47Z" | java | "2021-10-18T09:33:16Z" | dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonCommandExecutor.java | }
File file = new File(pythonHome);
if (file.exists() && file.isFile()) {
return pythonHome;
}
if (PYTHON_PATH_PATTERN.matcher(pythonHome).find()) {
return pythonHome;
}
return Paths.get(pythonHome, "/bin/python").toString();
}
/**
* get python home from the environment config
*
* @param environmentConfig env config
* @return python home
*/
public static String getPythonHomeFromEnvironmentConfig(String environmentConfig) {
String[] lines = environmentConfig.split("\n");
String pythonHomeConfig = Arrays.stream(lines).filter(line -> line.contains(PythonConstants.PYTHON_HOME)).findFirst().get();
if (StringUtils.isEmpty(pythonHomeConfig)) {
return null;
}
String[] arrs = pythonHomeConfig.split(PythonConstants.EQUAL_SIGN);
if (arrs.length == 2) {
return arrs[1];
}
return null;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,529 | [Bug] [Task] Failed to get environment variables when I used the python task. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I didn't get environment variables that is set in the file 'dolphinscheduler_env.sh" when I was running a python task.
The Python script is as follows:

But the result was not what I want. The detail information is as follows:
```
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : tenantCode :calvin, task dir:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : generate command file:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50/py_36_50.command
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : #-*- encoding=utf8 -*-
import os
import sys
print("Python version:%s\n" %(sys.version))
print("HADOOP_HOME=%s\n" %(os.getenv('HADOOP_HOME')))
print("HADOOP_CONF_DIR=%s\n" %(os.getenv('HADOOP_CONF_DIR')))
print("SPARK_HOME1=%s\n" %(os.getenv('SPARK_HOME1')))
print("SPARK_HOME2=%s\n" %(os.getenv('SPARK_HOME2')))
print("PYTHON_HOME=%s\n" %(os.getenv('PYTHON_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("HIVE_HOME=%s\n" %(os.getenv('HIVE_HOME')))
print("FLINK_HOME=%s\n" %(os.getenv('FLINK_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("DATAX_HOME=%s\n" %(os.getenv('DATAX_HOME')))
print("PATH=%s\n" %(os.getenv('PATH')))
2021-10-14 14:43:15.926 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : task run command: sudo -u calvin python /tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50/py_36_50.command
2021-10-14 14:43:15.930 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : process start, process id is: 86802
2021-10-14 14:43:16.297 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : process has exited, execute path:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50, processId:86802 ,exitStatusCode:0 ,processWaitForStatus:true ,processExitValue:0
2021-10-14 14:43:16.298 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : task instance id : 50,task final status : SUCCESS
2021-10-14 14:43:16.298 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : develop mode is: false
2021-10-14 14:43:16.301 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : exec local path: /tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50 cleared.
2021-10-14 14:43:16.931 INFO 86302 --- [skLogInfo-36_50] [taskAppId=TASK-806053553881088_2-36-50] : -> welcome to use bigdata scheduling system...
Python version:2.7.16 (default, Jun 18 2021, 03:23:53)
[GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy
HADOOP_HOME=None
HADOOP_CONF_DIR=None
SPARK_HOME1=None
SPARK_HOME2=None
PYTHON_HOME=None
JAVA_HOME=None
HIVE_HOME=None
FLINK_HOME=None
JAVA_HOME=None
DATAX_HOME=None
PATH=/usr/local/Cellar/pyenv/1.2.16/libexec:/usr/local/Cellar/pyenv/1.2.16/libexec:/usr/local/opt/nvm/versions/node/v12.4.0/bin:/usr/local/Cellar/pyenv-virtualenv/1.1.3/shims:/Users/calvin/.pyenv/shims:/usr/local/bin:/usr/local/cuda/bin:/Users/calvin/opt/hadoop-2.6.5/bin:/Users/calvin/redis-4.0.8/src:/Users/calvin/btrace/bin:/Library/java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin:/usr/local/opt/maven3/bin:/Users/calvin/phantomjs-2.1.1/bin:/Users/calvin/sysdir/apache-flume-1.7.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/opt/apache-tinkerpop-gremlin-console-3.4.3/bin:/usr/local/Cellar/postgresql@10/10.11/bin:/usr/local/sbin:/opt/gradle/gradle-7.2/bin:/opt/javacc-javacc-7.0.10/scripts
2021-10-14 14:43:16.931 INFO 86302 --- [skLogInfo-36_50] [taskAppId=TASK-806053553881088_2-36-50] : FINALIZE_SESSION
```
### What you expected to happen
I expect that I can get environment variables in the python script.
### How to reproduce
1. First you can create a python task and set the script content as follows:
```
import os
import sys
print("Python version:%s\n" %(sys.version))
print("HADOOP_HOME=%s\n" %(os.getenv('HADOOP_HOME')))
print("HADOOP_CONF_DIR=%s\n" %(os.getenv('HADOOP_CONF_DIR')))
print("SPARK_HOME1=%s\n" %(os.getenv('SPARK_HOME1')))
print("SPARK_HOME2=%s\n" %(os.getenv('SPARK_HOME2')))
print("PYTHON_HOME=%s\n" %(os.getenv('PYTHON_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("HIVE_HOME=%s\n" %(os.getenv('HIVE_HOME')))
print("FLINK_HOME=%s\n" %(os.getenv('FLINK_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("DATAX_HOME=%s\n" %(os.getenv('DATAX_HOME')))
print("PATH=%s\n" %(os.getenv('PATH')))
```
2. And then You save it and run this task manually.
3. Finally you will see the result without environment variables in the 'dolphinscheduler_env.sh';
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6529 | https://github.com/apache/dolphinscheduler/pull/6531 | 4d0869fcc085f7b4d8af2182bb8b16b70ff6482c | 8200bc14526364fa1908b1df82befc984b0419aa | "2021-10-14T07:01:47Z" | java | "2021-10-18T09:33:16Z" | dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.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.task.python;
import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor;
import org.apache.dolphinscheduler.plugin.task.api.TaskException;
import org.apache.dolphinscheduler.plugin.task.api.TaskResponse;
import org.apache.dolphinscheduler.plugin.task.util.MapUtils;
import org.apache.dolphinscheduler.spi.task.AbstractParameters;
import org.apache.dolphinscheduler.spi.task.Property;
import org.apache.dolphinscheduler.spi.task.TaskConstants;
import org.apache.dolphinscheduler.spi.task.paramparser.ParamUtils;
import org.apache.dolphinscheduler.spi.task.paramparser.ParameterUtils;
import org.apache.dolphinscheduler.spi.task.request.TaskRequest;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import java.util.HashMap;
import java.util.Map; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,529 | [Bug] [Task] Failed to get environment variables when I used the python task. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I didn't get environment variables that is set in the file 'dolphinscheduler_env.sh" when I was running a python task.
The Python script is as follows:

But the result was not what I want. The detail information is as follows:
```
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : tenantCode :calvin, task dir:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : generate command file:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50/py_36_50.command
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : #-*- encoding=utf8 -*-
import os
import sys
print("Python version:%s\n" %(sys.version))
print("HADOOP_HOME=%s\n" %(os.getenv('HADOOP_HOME')))
print("HADOOP_CONF_DIR=%s\n" %(os.getenv('HADOOP_CONF_DIR')))
print("SPARK_HOME1=%s\n" %(os.getenv('SPARK_HOME1')))
print("SPARK_HOME2=%s\n" %(os.getenv('SPARK_HOME2')))
print("PYTHON_HOME=%s\n" %(os.getenv('PYTHON_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("HIVE_HOME=%s\n" %(os.getenv('HIVE_HOME')))
print("FLINK_HOME=%s\n" %(os.getenv('FLINK_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("DATAX_HOME=%s\n" %(os.getenv('DATAX_HOME')))
print("PATH=%s\n" %(os.getenv('PATH')))
2021-10-14 14:43:15.926 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : task run command: sudo -u calvin python /tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50/py_36_50.command
2021-10-14 14:43:15.930 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : process start, process id is: 86802
2021-10-14 14:43:16.297 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : process has exited, execute path:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50, processId:86802 ,exitStatusCode:0 ,processWaitForStatus:true ,processExitValue:0
2021-10-14 14:43:16.298 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : task instance id : 50,task final status : SUCCESS
2021-10-14 14:43:16.298 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : develop mode is: false
2021-10-14 14:43:16.301 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : exec local path: /tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50 cleared.
2021-10-14 14:43:16.931 INFO 86302 --- [skLogInfo-36_50] [taskAppId=TASK-806053553881088_2-36-50] : -> welcome to use bigdata scheduling system...
Python version:2.7.16 (default, Jun 18 2021, 03:23:53)
[GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy
HADOOP_HOME=None
HADOOP_CONF_DIR=None
SPARK_HOME1=None
SPARK_HOME2=None
PYTHON_HOME=None
JAVA_HOME=None
HIVE_HOME=None
FLINK_HOME=None
JAVA_HOME=None
DATAX_HOME=None
PATH=/usr/local/Cellar/pyenv/1.2.16/libexec:/usr/local/Cellar/pyenv/1.2.16/libexec:/usr/local/opt/nvm/versions/node/v12.4.0/bin:/usr/local/Cellar/pyenv-virtualenv/1.1.3/shims:/Users/calvin/.pyenv/shims:/usr/local/bin:/usr/local/cuda/bin:/Users/calvin/opt/hadoop-2.6.5/bin:/Users/calvin/redis-4.0.8/src:/Users/calvin/btrace/bin:/Library/java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin:/usr/local/opt/maven3/bin:/Users/calvin/phantomjs-2.1.1/bin:/Users/calvin/sysdir/apache-flume-1.7.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/opt/apache-tinkerpop-gremlin-console-3.4.3/bin:/usr/local/Cellar/postgresql@10/10.11/bin:/usr/local/sbin:/opt/gradle/gradle-7.2/bin:/opt/javacc-javacc-7.0.10/scripts
2021-10-14 14:43:16.931 INFO 86302 --- [skLogInfo-36_50] [taskAppId=TASK-806053553881088_2-36-50] : FINALIZE_SESSION
```
### What you expected to happen
I expect that I can get environment variables in the python script.
### How to reproduce
1. First you can create a python task and set the script content as follows:
```
import os
import sys
print("Python version:%s\n" %(sys.version))
print("HADOOP_HOME=%s\n" %(os.getenv('HADOOP_HOME')))
print("HADOOP_CONF_DIR=%s\n" %(os.getenv('HADOOP_CONF_DIR')))
print("SPARK_HOME1=%s\n" %(os.getenv('SPARK_HOME1')))
print("SPARK_HOME2=%s\n" %(os.getenv('SPARK_HOME2')))
print("PYTHON_HOME=%s\n" %(os.getenv('PYTHON_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("HIVE_HOME=%s\n" %(os.getenv('HIVE_HOME')))
print("FLINK_HOME=%s\n" %(os.getenv('FLINK_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("DATAX_HOME=%s\n" %(os.getenv('DATAX_HOME')))
print("PATH=%s\n" %(os.getenv('PATH')))
```
2. And then You save it and run this task manually.
3. Finally you will see the result without environment variables in the 'dolphinscheduler_env.sh';
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6529 | https://github.com/apache/dolphinscheduler/pull/6531 | 4d0869fcc085f7b4d8af2182bb8b16b70ff6482c | 8200bc14526364fa1908b1df82befc984b0419aa | "2021-10-14T07:01:47Z" | java | "2021-10-18T09:33:16Z" | dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java | /**
* python task
*/
public class PythonTask extends AbstractTaskExecutor {
/**
* python parameters
*/
private PythonParameters pythonParameters;
/**
* task dir
*/
private String taskDir;
/**
* python command executor
*/
private PythonCommandExecutor pythonCommandExecutor;
private TaskRequest taskRequest;
/**
* constructor
*
* @param taskRequest taskRequest
*/
public PythonTask(TaskRequest taskRequest) {
super(taskRequest);
this.taskRequest = taskRequest;
this.pythonCommandExecutor = new PythonCommandExecutor(this::logHandle,
taskRequest,
logger);
}
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,529 | [Bug] [Task] Failed to get environment variables when I used the python task. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I didn't get environment variables that is set in the file 'dolphinscheduler_env.sh" when I was running a python task.
The Python script is as follows:

But the result was not what I want. The detail information is as follows:
```
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : tenantCode :calvin, task dir:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : generate command file:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50/py_36_50.command
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : #-*- encoding=utf8 -*-
import os
import sys
print("Python version:%s\n" %(sys.version))
print("HADOOP_HOME=%s\n" %(os.getenv('HADOOP_HOME')))
print("HADOOP_CONF_DIR=%s\n" %(os.getenv('HADOOP_CONF_DIR')))
print("SPARK_HOME1=%s\n" %(os.getenv('SPARK_HOME1')))
print("SPARK_HOME2=%s\n" %(os.getenv('SPARK_HOME2')))
print("PYTHON_HOME=%s\n" %(os.getenv('PYTHON_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("HIVE_HOME=%s\n" %(os.getenv('HIVE_HOME')))
print("FLINK_HOME=%s\n" %(os.getenv('FLINK_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("DATAX_HOME=%s\n" %(os.getenv('DATAX_HOME')))
print("PATH=%s\n" %(os.getenv('PATH')))
2021-10-14 14:43:15.926 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : task run command: sudo -u calvin python /tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50/py_36_50.command
2021-10-14 14:43:15.930 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : process start, process id is: 86802
2021-10-14 14:43:16.297 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : process has exited, execute path:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50, processId:86802 ,exitStatusCode:0 ,processWaitForStatus:true ,processExitValue:0
2021-10-14 14:43:16.298 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : task instance id : 50,task final status : SUCCESS
2021-10-14 14:43:16.298 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : develop mode is: false
2021-10-14 14:43:16.301 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : exec local path: /tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50 cleared.
2021-10-14 14:43:16.931 INFO 86302 --- [skLogInfo-36_50] [taskAppId=TASK-806053553881088_2-36-50] : -> welcome to use bigdata scheduling system...
Python version:2.7.16 (default, Jun 18 2021, 03:23:53)
[GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy
HADOOP_HOME=None
HADOOP_CONF_DIR=None
SPARK_HOME1=None
SPARK_HOME2=None
PYTHON_HOME=None
JAVA_HOME=None
HIVE_HOME=None
FLINK_HOME=None
JAVA_HOME=None
DATAX_HOME=None
PATH=/usr/local/Cellar/pyenv/1.2.16/libexec:/usr/local/Cellar/pyenv/1.2.16/libexec:/usr/local/opt/nvm/versions/node/v12.4.0/bin:/usr/local/Cellar/pyenv-virtualenv/1.1.3/shims:/Users/calvin/.pyenv/shims:/usr/local/bin:/usr/local/cuda/bin:/Users/calvin/opt/hadoop-2.6.5/bin:/Users/calvin/redis-4.0.8/src:/Users/calvin/btrace/bin:/Library/java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin:/usr/local/opt/maven3/bin:/Users/calvin/phantomjs-2.1.1/bin:/Users/calvin/sysdir/apache-flume-1.7.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/opt/apache-tinkerpop-gremlin-console-3.4.3/bin:/usr/local/Cellar/postgresql@10/10.11/bin:/usr/local/sbin:/opt/gradle/gradle-7.2/bin:/opt/javacc-javacc-7.0.10/scripts
2021-10-14 14:43:16.931 INFO 86302 --- [skLogInfo-36_50] [taskAppId=TASK-806053553881088_2-36-50] : FINALIZE_SESSION
```
### What you expected to happen
I expect that I can get environment variables in the python script.
### How to reproduce
1. First you can create a python task and set the script content as follows:
```
import os
import sys
print("Python version:%s\n" %(sys.version))
print("HADOOP_HOME=%s\n" %(os.getenv('HADOOP_HOME')))
print("HADOOP_CONF_DIR=%s\n" %(os.getenv('HADOOP_CONF_DIR')))
print("SPARK_HOME1=%s\n" %(os.getenv('SPARK_HOME1')))
print("SPARK_HOME2=%s\n" %(os.getenv('SPARK_HOME2')))
print("PYTHON_HOME=%s\n" %(os.getenv('PYTHON_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("HIVE_HOME=%s\n" %(os.getenv('HIVE_HOME')))
print("FLINK_HOME=%s\n" %(os.getenv('FLINK_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("DATAX_HOME=%s\n" %(os.getenv('DATAX_HOME')))
print("PATH=%s\n" %(os.getenv('PATH')))
```
2. And then You save it and run this task manually.
3. Finally you will see the result without environment variables in the 'dolphinscheduler_env.sh';
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6529 | https://github.com/apache/dolphinscheduler/pull/6531 | 4d0869fcc085f7b4d8af2182bb8b16b70ff6482c | 8200bc14526364fa1908b1df82befc984b0419aa | "2021-10-14T07:01:47Z" | java | "2021-10-18T09:33:16Z" | dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java | public void init() {
logger.info("python task params {}", taskRequest.getTaskParams());
pythonParameters = JSONUtils.parseObject(taskRequest.getTaskParams(), PythonParameters.class);
if (!pythonParameters.checkParameters()) {
throw new TaskException("python task params is not valid");
}
}
@Override
public String getPreScript() {
String rawPythonScript = pythonParameters.getRawScript().replaceAll("\\r\\n", "\n");
try {
rawPythonScript = convertPythonScriptPlaceholders(rawPythonScript);
} catch (StringIndexOutOfBoundsException e) {
logger.error("setShareVar field format error, raw python script : {}", rawPythonScript);
}
return rawPythonScript;
}
@Override
public void handle() throws Exception {
try {
String command = buildCommand();
TaskResponse taskResponse = pythonCommandExecutor.run(command);
setExitStatusCode(taskResponse.getExitStatusCode());
setAppIds(taskResponse.getAppIds());
setProcessId(taskResponse.getProcessId());
setVarPool(pythonCommandExecutor.getVarPool());
} catch (Exception e) {
logger.error("python task failure", e);
setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,529 | [Bug] [Task] Failed to get environment variables when I used the python task. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I didn't get environment variables that is set in the file 'dolphinscheduler_env.sh" when I was running a python task.
The Python script is as follows:

But the result was not what I want. The detail information is as follows:
```
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : tenantCode :calvin, task dir:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : generate command file:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50/py_36_50.command
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : #-*- encoding=utf8 -*-
import os
import sys
print("Python version:%s\n" %(sys.version))
print("HADOOP_HOME=%s\n" %(os.getenv('HADOOP_HOME')))
print("HADOOP_CONF_DIR=%s\n" %(os.getenv('HADOOP_CONF_DIR')))
print("SPARK_HOME1=%s\n" %(os.getenv('SPARK_HOME1')))
print("SPARK_HOME2=%s\n" %(os.getenv('SPARK_HOME2')))
print("PYTHON_HOME=%s\n" %(os.getenv('PYTHON_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("HIVE_HOME=%s\n" %(os.getenv('HIVE_HOME')))
print("FLINK_HOME=%s\n" %(os.getenv('FLINK_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("DATAX_HOME=%s\n" %(os.getenv('DATAX_HOME')))
print("PATH=%s\n" %(os.getenv('PATH')))
2021-10-14 14:43:15.926 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : task run command: sudo -u calvin python /tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50/py_36_50.command
2021-10-14 14:43:15.930 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : process start, process id is: 86802
2021-10-14 14:43:16.297 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : process has exited, execute path:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50, processId:86802 ,exitStatusCode:0 ,processWaitForStatus:true ,processExitValue:0
2021-10-14 14:43:16.298 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : task instance id : 50,task final status : SUCCESS
2021-10-14 14:43:16.298 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : develop mode is: false
2021-10-14 14:43:16.301 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : exec local path: /tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50 cleared.
2021-10-14 14:43:16.931 INFO 86302 --- [skLogInfo-36_50] [taskAppId=TASK-806053553881088_2-36-50] : -> welcome to use bigdata scheduling system...
Python version:2.7.16 (default, Jun 18 2021, 03:23:53)
[GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy
HADOOP_HOME=None
HADOOP_CONF_DIR=None
SPARK_HOME1=None
SPARK_HOME2=None
PYTHON_HOME=None
JAVA_HOME=None
HIVE_HOME=None
FLINK_HOME=None
JAVA_HOME=None
DATAX_HOME=None
PATH=/usr/local/Cellar/pyenv/1.2.16/libexec:/usr/local/Cellar/pyenv/1.2.16/libexec:/usr/local/opt/nvm/versions/node/v12.4.0/bin:/usr/local/Cellar/pyenv-virtualenv/1.1.3/shims:/Users/calvin/.pyenv/shims:/usr/local/bin:/usr/local/cuda/bin:/Users/calvin/opt/hadoop-2.6.5/bin:/Users/calvin/redis-4.0.8/src:/Users/calvin/btrace/bin:/Library/java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin:/usr/local/opt/maven3/bin:/Users/calvin/phantomjs-2.1.1/bin:/Users/calvin/sysdir/apache-flume-1.7.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/opt/apache-tinkerpop-gremlin-console-3.4.3/bin:/usr/local/Cellar/postgresql@10/10.11/bin:/usr/local/sbin:/opt/gradle/gradle-7.2/bin:/opt/javacc-javacc-7.0.10/scripts
2021-10-14 14:43:16.931 INFO 86302 --- [skLogInfo-36_50] [taskAppId=TASK-806053553881088_2-36-50] : FINALIZE_SESSION
```
### What you expected to happen
I expect that I can get environment variables in the python script.
### How to reproduce
1. First you can create a python task and set the script content as follows:
```
import os
import sys
print("Python version:%s\n" %(sys.version))
print("HADOOP_HOME=%s\n" %(os.getenv('HADOOP_HOME')))
print("HADOOP_CONF_DIR=%s\n" %(os.getenv('HADOOP_CONF_DIR')))
print("SPARK_HOME1=%s\n" %(os.getenv('SPARK_HOME1')))
print("SPARK_HOME2=%s\n" %(os.getenv('SPARK_HOME2')))
print("PYTHON_HOME=%s\n" %(os.getenv('PYTHON_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("HIVE_HOME=%s\n" %(os.getenv('HIVE_HOME')))
print("FLINK_HOME=%s\n" %(os.getenv('FLINK_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("DATAX_HOME=%s\n" %(os.getenv('DATAX_HOME')))
print("PATH=%s\n" %(os.getenv('PATH')))
```
2. And then You save it and run this task manually.
3. Finally you will see the result without environment variables in the 'dolphinscheduler_env.sh';
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6529 | https://github.com/apache/dolphinscheduler/pull/6531 | 4d0869fcc085f7b4d8af2182bb8b16b70ff6482c | 8200bc14526364fa1908b1df82befc984b0419aa | "2021-10-14T07:01:47Z" | java | "2021-10-18T09:33:16Z" | dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java | throw new TaskException("run python task error", e);
}
}
@Override
public void cancelApplication(boolean cancelApplication) throws Exception {
pythonCommandExecutor.cancelApplication();
}
@Override
public AbstractParameters getParameters() {
return pythonParameters;
}
/**
* convertPythonScriptPlaceholders
*
* @param rawScript rawScript
* @return String
* @throws StringIndexOutOfBoundsException StringIndexOutOfBoundsException
*/
private static String convertPythonScriptPlaceholders(String rawScript) throws StringIndexOutOfBoundsException {
int len = "${setShareVar(${".length();
int scriptStart = 0;
while ((scriptStart = rawScript.indexOf("${setShareVar(${", scriptStart)) != -1) {
int start = -1;
int end = rawScript.indexOf('}', scriptStart + len);
String prop = rawScript.substring(scriptStart + len, end);
start = rawScript.indexOf(',', end);
end = rawScript.indexOf(')', start);
String value = rawScript.substring(start + 1, end);
start = rawScript.indexOf('}', start) + 1; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,529 | [Bug] [Task] Failed to get environment variables when I used the python task. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I didn't get environment variables that is set in the file 'dolphinscheduler_env.sh" when I was running a python task.
The Python script is as follows:

But the result was not what I want. The detail information is as follows:
```
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : tenantCode :calvin, task dir:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : generate command file:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50/py_36_50.command
2021-10-14 14:43:15.919 INFO 86302 --- [-Execute-Thread] o.a.d.p.t.python.PythonCommandExecutor : #-*- encoding=utf8 -*-
import os
import sys
print("Python version:%s\n" %(sys.version))
print("HADOOP_HOME=%s\n" %(os.getenv('HADOOP_HOME')))
print("HADOOP_CONF_DIR=%s\n" %(os.getenv('HADOOP_CONF_DIR')))
print("SPARK_HOME1=%s\n" %(os.getenv('SPARK_HOME1')))
print("SPARK_HOME2=%s\n" %(os.getenv('SPARK_HOME2')))
print("PYTHON_HOME=%s\n" %(os.getenv('PYTHON_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("HIVE_HOME=%s\n" %(os.getenv('HIVE_HOME')))
print("FLINK_HOME=%s\n" %(os.getenv('FLINK_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("DATAX_HOME=%s\n" %(os.getenv('DATAX_HOME')))
print("PATH=%s\n" %(os.getenv('PATH')))
2021-10-14 14:43:15.926 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : task run command: sudo -u calvin python /tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50/py_36_50.command
2021-10-14 14:43:15.930 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : process start, process id is: 86802
2021-10-14 14:43:16.297 INFO 86302 --- [-Execute-Thread] [taskAppId=TASK-806053553881088_2-36-50] : process has exited, execute path:/tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50, processId:86802 ,exitStatusCode:0 ,processWaitForStatus:true ,processExitValue:0
2021-10-14 14:43:16.298 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : task instance id : 50,task final status : SUCCESS
2021-10-14 14:43:16.298 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : develop mode is: false
2021-10-14 14:43:16.301 INFO 86302 --- [-Execute-Thread] o.a.d.s.worker.runner.TaskExecuteThread : exec local path: /tmp/dolphinscheduler/exec/process/723800319311872/806053553881088_2/36/50 cleared.
2021-10-14 14:43:16.931 INFO 86302 --- [skLogInfo-36_50] [taskAppId=TASK-806053553881088_2-36-50] : -> welcome to use bigdata scheduling system...
Python version:2.7.16 (default, Jun 18 2021, 03:23:53)
[GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy
HADOOP_HOME=None
HADOOP_CONF_DIR=None
SPARK_HOME1=None
SPARK_HOME2=None
PYTHON_HOME=None
JAVA_HOME=None
HIVE_HOME=None
FLINK_HOME=None
JAVA_HOME=None
DATAX_HOME=None
PATH=/usr/local/Cellar/pyenv/1.2.16/libexec:/usr/local/Cellar/pyenv/1.2.16/libexec:/usr/local/opt/nvm/versions/node/v12.4.0/bin:/usr/local/Cellar/pyenv-virtualenv/1.1.3/shims:/Users/calvin/.pyenv/shims:/usr/local/bin:/usr/local/cuda/bin:/Users/calvin/opt/hadoop-2.6.5/bin:/Users/calvin/redis-4.0.8/src:/Users/calvin/btrace/bin:/Library/java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin:/usr/local/opt/maven3/bin:/Users/calvin/phantomjs-2.1.1/bin:/Users/calvin/sysdir/apache-flume-1.7.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/opt/apache-tinkerpop-gremlin-console-3.4.3/bin:/usr/local/Cellar/postgresql@10/10.11/bin:/usr/local/sbin:/opt/gradle/gradle-7.2/bin:/opt/javacc-javacc-7.0.10/scripts
2021-10-14 14:43:16.931 INFO 86302 --- [skLogInfo-36_50] [taskAppId=TASK-806053553881088_2-36-50] : FINALIZE_SESSION
```
### What you expected to happen
I expect that I can get environment variables in the python script.
### How to reproduce
1. First you can create a python task and set the script content as follows:
```
import os
import sys
print("Python version:%s\n" %(sys.version))
print("HADOOP_HOME=%s\n" %(os.getenv('HADOOP_HOME')))
print("HADOOP_CONF_DIR=%s\n" %(os.getenv('HADOOP_CONF_DIR')))
print("SPARK_HOME1=%s\n" %(os.getenv('SPARK_HOME1')))
print("SPARK_HOME2=%s\n" %(os.getenv('SPARK_HOME2')))
print("PYTHON_HOME=%s\n" %(os.getenv('PYTHON_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("HIVE_HOME=%s\n" %(os.getenv('HIVE_HOME')))
print("FLINK_HOME=%s\n" %(os.getenv('FLINK_HOME')))
print("JAVA_HOME=%s\n" %(os.getenv('JAVA_HOME')))
print("DATAX_HOME=%s\n" %(os.getenv('DATAX_HOME')))
print("PATH=%s\n" %(os.getenv('PATH')))
```
2. And then You save it and run this task manually.
3. Finally you will see the result without environment variables in the 'dolphinscheduler_env.sh';
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6529 | https://github.com/apache/dolphinscheduler/pull/6531 | 4d0869fcc085f7b4d8af2182bb8b16b70ff6482c | 8200bc14526364fa1908b1df82befc984b0419aa | "2021-10-14T07:01:47Z" | java | "2021-10-18T09:33:16Z" | dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java | end = rawScript.length();
String replaceScript = String.format("print(\"${{setValue({},{})}}\".format(\"%s\",%s))", prop, value);
rawScript = rawScript.substring(0, scriptStart) + replaceScript + rawScript.substring(start, end);
scriptStart += replaceScript.length();
}
return rawScript;
}
/**
* build command
*
* @return raw python script
* @throws Exception exception
*/
private String buildCommand() throws Exception {
String rawPythonScript = pythonParameters.getRawScript().replaceAll("\\r\\n", "\n");
Map<String, Property> paramsMap = ParamUtils.convert(taskRequest, pythonParameters);
if (MapUtils.isEmpty(paramsMap)) {
paramsMap = new HashMap<>();
}
if (MapUtils.isNotEmpty(taskRequest.getParamsMap())) {
paramsMap.putAll(taskRequest.getParamsMap());
}
rawPythonScript = ParameterUtils.convertParameterPlaceholders(rawPythonScript, ParamUtils.convert(paramsMap));
logger.info("raw python script : {}", pythonParameters.getRawScript());
logger.info("task dir : {}", taskDir);
return rawPythonScript;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,572 | [Bug] [API] import processDefinition report json parse error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
[ERROR] 2021-10-20 20:40:03.391 org.apache.dolphinscheduler.common.utils.JSONUtils:[167] - parse list exception!
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `org.apache.dolphinscheduler.api.dto.DagDataSchedule` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
at [Source: (String)"[{"processDefinition":{"id":73,"code":818174268579840,"name":"hello-shell-2","version":1,"releaseState":"OFFLINE","projectCode":724559144984576,"description":"","globalParams":"[]","globalParamList":[],"globalParamMap":{},"createTime":"2021-10-16 23:44:57","updateTime":"2021-10-16 23:44:57","flag":"YES","userId":1,"userName":null,"projectName":null,"locations":"[{\"taskCode\":818173332135936,\"x\":202,\"y\":376}]","scheduleReleaseState":null,"timeout":0,"tenantId":-1,"tenantCode":null,"modifyBy""[truncated 1139 chars]; line: 1, column: 3] (through reference chain: java.util.ArrayList[0])
at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1592)
### What you expected to happen
It can be import successfully
### How to reproduce
Export a processDefinition and then import it
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6572 | https://github.com/apache/dolphinscheduler/pull/6573 | 251255009a857656abf0fe7776b5ae4d68eb4cf7 | 095e2e206a8d428a0048baa38704a3de3a1e037b | "2021-10-20T13:33:36Z" | java | "2021-10-20T15:45:38Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/DagDataSchedule.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.dto;
import org.apache.dolphinscheduler.dao.entity.DagData;
import org.apache.dolphinscheduler.dao.entity.Schedule;
/**
* DagDataSchedule
*/
public class DagDataSchedule extends DagData { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,572 | [Bug] [API] import processDefinition report json parse error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
[ERROR] 2021-10-20 20:40:03.391 org.apache.dolphinscheduler.common.utils.JSONUtils:[167] - parse list exception!
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `org.apache.dolphinscheduler.api.dto.DagDataSchedule` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
at [Source: (String)"[{"processDefinition":{"id":73,"code":818174268579840,"name":"hello-shell-2","version":1,"releaseState":"OFFLINE","projectCode":724559144984576,"description":"","globalParams":"[]","globalParamList":[],"globalParamMap":{},"createTime":"2021-10-16 23:44:57","updateTime":"2021-10-16 23:44:57","flag":"YES","userId":1,"userName":null,"projectName":null,"locations":"[{\"taskCode\":818173332135936,\"x\":202,\"y\":376}]","scheduleReleaseState":null,"timeout":0,"tenantId":-1,"tenantCode":null,"modifyBy""[truncated 1139 chars]; line: 1, column: 3] (through reference chain: java.util.ArrayList[0])
at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1592)
### What you expected to happen
It can be import successfully
### How to reproduce
Export a processDefinition and then import it
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6572 | https://github.com/apache/dolphinscheduler/pull/6573 | 251255009a857656abf0fe7776b5ae4d68eb4cf7 | 095e2e206a8d428a0048baa38704a3de3a1e037b | "2021-10-20T13:33:36Z" | java | "2021-10-20T15:45:38Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/DagDataSchedule.java | /**
* schedule
*/
private Schedule schedule;
public DagDataSchedule(DagData dagData) {
super();
this.setProcessDefinition(dagData.getProcessDefinition());
this.setTaskDefinitionList(dagData.getTaskDefinitionList());
this.setProcessTaskRelationList(dagData.getProcessTaskRelationList());
}
public Schedule getSchedule() {
return schedule;
}
public void setSchedule(Schedule schedule) {
this.schedule = schedule;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,582 | [Bug] [Master] condition task fail when log show it's result is success | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
the condition task log show: `the conditions task depend result : SUCCESS`, but task state is failed.
### What you expected to happen
condition task state is right.
### How to reproduce
use condition task in your dag.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6582 | https://github.com/apache/dolphinscheduler/pull/6583 | 9b1984c2449538e5f0e547297762fdafc5e0211c | b642e9ca546d8ea21bbd9f193ff6ff9729037f75 | "2021-10-21T10:59:46Z" | java | "2021-10-21T11:27:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/ConditionTaskProcessor.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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,582 | [Bug] [Master] condition task fail when log show it's result is success | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
the condition task log show: `the conditions task depend result : SUCCESS`, but task state is failed.
### What you expected to happen
condition task state is right.
### How to reproduce
use condition task in your dag.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6582 | https://github.com/apache/dolphinscheduler/pull/6583 | 9b1984c2449538e5f0e547297762fdafc5e0211c | b642e9ca546d8ea21bbd9f193ff6ff9729037f75 | "2021-10-21T10:59:46Z" | java | "2021-10-21T11:27:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/ConditionTaskProcessor.java | * limitations under the License.
*/
package org.apache.dolphinscheduler.server.master.runner.task;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.DependResult;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.common.enums.TaskType;
import org.apache.dolphinscheduler.common.model.DependentItem;
import org.apache.dolphinscheduler.common.model.DependentTaskModel;
import org.apache.dolphinscheduler.common.task.dependent.DependentParameters;
import org.apache.dolphinscheduler.common.utils.DependentUtils;
import org.apache.dolphinscheduler.common.utils.LoggerUtils;
import org.apache.dolphinscheduler.common.utils.NetUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.utils.LogUtils;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.slf4j.LoggerFactory;
/**
* condition task processor
*/
public class ConditionTaskProcessor extends BaseTaskProcessor { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,582 | [Bug] [Master] condition task fail when log show it's result is success | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
the condition task log show: `the conditions task depend result : SUCCESS`, but task state is failed.
### What you expected to happen
condition task state is right.
### How to reproduce
use condition task in your dag.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6582 | https://github.com/apache/dolphinscheduler/pull/6583 | 9b1984c2449538e5f0e547297762fdafc5e0211c | b642e9ca546d8ea21bbd9f193ff6ff9729037f75 | "2021-10-21T10:59:46Z" | java | "2021-10-21T11:27:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/ConditionTaskProcessor.java | /**
* dependent parameters
*/
private DependentParameters dependentParameters;
ProcessInstance processInstance;
/**
* condition result
*/
private DependResult conditionResult = DependResult.WAITING;
/**
* complete task map
*/
private Map<String, ExecutionStatus> completeTaskList = new ConcurrentHashMap<>();
MasterConfig masterConfig = SpringApplicationContext.getBean(MasterConfig.class);
private TaskDefinition taskDefinition;
@Override
public boolean submit(TaskInstance task, ProcessInstance processInstance, int masterTaskCommitRetryTimes, int masterTaskCommitInterval) {
this.processInstance = processInstance; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,582 | [Bug] [Master] condition task fail when log show it's result is success | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
the condition task log show: `the conditions task depend result : SUCCESS`, but task state is failed.
### What you expected to happen
condition task state is right.
### How to reproduce
use condition task in your dag.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6582 | https://github.com/apache/dolphinscheduler/pull/6583 | 9b1984c2449538e5f0e547297762fdafc5e0211c | b642e9ca546d8ea21bbd9f193ff6ff9729037f75 | "2021-10-21T10:59:46Z" | java | "2021-10-21T11:27:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/ConditionTaskProcessor.java | this.taskInstance = processService.submitTask(task, masterTaskCommitRetryTimes, masterTaskCommitInterval);
if (this.taskInstance == null) {
return false;
}
taskDefinition = processService.findTaskDefinition(
taskInstance.getTaskCode(), taskInstance.getTaskDefinitionVersion()
);
logger = LoggerFactory.getLogger(LoggerUtils.buildTaskId(LoggerUtils.TASK_LOGGER_INFO_PREFIX,
processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion(),
taskInstance.getProcessInstanceId(),
taskInstance.getId()));
String threadLoggerInfoName = String.format(Constants.TASK_LOG_INFO_FORMAT, processService.formatTaskAppId(this.taskInstance));
Thread.currentThread().setName(threadLoggerInfoName);
initTaskParameters();
logger.info("dependent task start");
endTask();
return true;
}
@Override
public ExecutionStatus taskState() {
return this.taskInstance.getState();
}
@Override
public void run() {
if (conditionResult.equals(DependResult.WAITING)) {
setConditionResult();
} else {
endTask();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,582 | [Bug] [Master] condition task fail when log show it's result is success | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
the condition task log show: `the conditions task depend result : SUCCESS`, but task state is failed.
### What you expected to happen
condition task state is right.
### How to reproduce
use condition task in your dag.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6582 | https://github.com/apache/dolphinscheduler/pull/6583 | 9b1984c2449538e5f0e547297762fdafc5e0211c | b642e9ca546d8ea21bbd9f193ff6ff9729037f75 | "2021-10-21T10:59:46Z" | java | "2021-10-21T11:27:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/ConditionTaskProcessor.java | }
@Override
protected boolean pauseTask() {
this.taskInstance.setState(ExecutionStatus.PAUSE);
this.taskInstance.setEndTime(new Date());
processService.saveTaskInstance(taskInstance);
return true;
}
@Override
protected boolean taskTimeout() {
TaskTimeoutStrategy taskTimeoutStrategy =
taskDefinition.getTimeoutNotifyStrategy();
if (taskTimeoutStrategy == TaskTimeoutStrategy.WARN) {
return true;
}
logger.info("condition task {} timeout, strategy {} ",
taskInstance.getId(), taskTimeoutStrategy.getDescp());
conditionResult = DependResult.FAILED;
endTask();
return true;
}
@Override
protected boolean killTask() {
this.taskInstance.setState(ExecutionStatus.KILL);
this.taskInstance.setEndTime(new Date());
processService.saveTaskInstance(taskInstance);
return true;
}
@Override
public String getType() { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,582 | [Bug] [Master] condition task fail when log show it's result is success | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
the condition task log show: `the conditions task depend result : SUCCESS`, but task state is failed.
### What you expected to happen
condition task state is right.
### How to reproduce
use condition task in your dag.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6582 | https://github.com/apache/dolphinscheduler/pull/6583 | 9b1984c2449538e5f0e547297762fdafc5e0211c | b642e9ca546d8ea21bbd9f193ff6ff9729037f75 | "2021-10-21T10:59:46Z" | java | "2021-10-21T11:27:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/ConditionTaskProcessor.java | return TaskType.CONDITIONS.getDesc();
}
private void initTaskParameters() {
taskInstance.setLogPath(LogUtils.getTaskLogPath(processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion(),
taskInstance.getProcessInstanceId(),
taskInstance.getId()));
this.taskInstance.setHost(NetUtils.getAddr(masterConfig.getListenPort()));
taskInstance.setState(ExecutionStatus.RUNNING_EXECUTION);
taskInstance.setStartTime(new Date());
this.processService.saveTaskInstance(taskInstance);
this.dependentParameters = taskInstance.getDependency();
}
private void setConditionResult() {
List<TaskInstance> taskInstances = processService.findValidTaskListByProcessId(taskInstance.getProcessInstanceId());
for (TaskInstance task : taskInstances) {
completeTaskList.putIfAbsent(task.getName(), task.getState());
}
List<DependResult> modelResultList = new ArrayList<>();
for (DependentTaskModel dependentTaskModel : dependentParameters.getDependTaskList()) {
List<DependResult> itemDependResult = new ArrayList<>();
for (DependentItem item : dependentTaskModel.getDependItemList()) {
itemDependResult.add(getDependResultForItem(item));
}
DependResult modelResult = DependentUtils.getDependResultForRelation(dependentTaskModel.getRelation(), itemDependResult);
modelResultList.add(modelResult);
}
conditionResult = DependentUtils.getDependResultForRelation(dependentParameters.getRelation(), modelResultList);
logger.info("the conditions task depend result : {}", conditionResult);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,582 | [Bug] [Master] condition task fail when log show it's result is success | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
the condition task log show: `the conditions task depend result : SUCCESS`, but task state is failed.
### What you expected to happen
condition task state is right.
### How to reproduce
use condition task in your dag.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6582 | https://github.com/apache/dolphinscheduler/pull/6583 | 9b1984c2449538e5f0e547297762fdafc5e0211c | b642e9ca546d8ea21bbd9f193ff6ff9729037f75 | "2021-10-21T10:59:46Z" | java | "2021-10-21T11:27:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/ConditionTaskProcessor.java | /**
* depend result for depend item
*/
private DependResult getDependResultForItem(DependentItem item) {
DependResult dependResult = DependResult.SUCCESS;
if (!completeTaskList.containsKey(item.getDepTasks())) {
logger.info("depend item: {} have not completed yet.", item.getDepTasks());
dependResult = DependResult.FAILED;
return dependResult;
}
ExecutionStatus executionStatus = completeTaskList.get(item.getDepTasks());
if (executionStatus != item.getStatus()) {
logger.info("depend item : {} expect status: {}, actual status: {}", item.getDepTasks(), item.getStatus(), executionStatus);
dependResult = DependResult.FAILED;
}
logger.info("dependent item complete {} {},{}",
Constants.DEPENDENT_SPLIT, item.getDepTasks(), dependResult);
return dependResult;
}
/**
*
*/
private void endTask() {
ExecutionStatus status = (conditionResult == DependResult.SUCCESS) ? ExecutionStatus.SUCCESS : ExecutionStatus.FAILURE;
taskInstance.setState(status);
taskInstance.setEndTime(new Date());
processService.updateTaskInstance(taskInstance);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | 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, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * 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.DagDataSchedule;
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.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
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.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.UserType;
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.thread.Stopper;
import org.apache.dolphinscheduler.common.utils.CollectionUtils;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | import org.apache.dolphinscheduler.common.utils.SnowFlakeUtils;
import org.apache.dolphinscheduler.common.utils.SnowFlakeUtils.SnowFlakeException;
import org.apache.dolphinscheduler.dao.entity.DagData;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.Schedule;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
import org.apache.dolphinscheduler.dao.mapper.UserMapper;
import org.apache.dolphinscheduler.service.permission.PermissionCheck;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.commons.lang.StringUtils;
import java.io.BufferedOutputStream; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | import java.io.IOException;
import java.nio.charset.StandardCharsets;
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.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.google.common.collect.Lists;
/**
* process definition service impl
*/
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements ProcessDefinitionService {
private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class);
private static final String RELEASESTATE = "releaseState";
@Autowired
private ProjectMapper projectMapper;
@Autowired
private ProjectService projectService;
@Autowired
private UserMapper userMapper;
@Autowired
private ProcessDefinitionLogMapper processDefinitionLogMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
@Autowired
private ProcessInstanceService processInstanceService;
@Autowired
private TaskInstanceMapper taskInstanceMapper;
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
private ProcessService processService;
@Autowired
private ProcessTaskRelationMapper processTaskRelationMapper;
@Autowired
private ProcessTaskRelationLogMapper processTaskRelationLogMapper;
@Autowired
TaskDefinitionLogMapper taskDefinitionLogMapper;
@Autowired |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | private TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private SchedulerService schedulerService;
@Autowired
private TenantMapper tenantMapper;
/**
* create process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
* @param globalParams global params
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @return create result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> createProcessDefinition(User loginUser,
long projectCode,
String name,
String description,
String globalParams,
String locations,
int timeout,
String tenantCode, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | String taskRelationJson,
String taskDefinitionJson) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
Map<String, Object> checkTaskDefinitions = checkTaskDefinitionList(taskDefinitionLogs, taskDefinitionJson);
if (checkTaskDefinitions.get(Constants.STATUS) != Status.SUCCESS) {
return checkTaskDefinitions;
}
List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class);
Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs);
if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) {
return checkRelationJson;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
tenantId = tenant.getId();
}
long processDefinitionCode;
try {
processDefinitionCode = SnowFlakeUtils.getInstance().nextId();
} catch (SnowFlakeException e) {
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
return result;
}
ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description,
globalParams, locations, timeout, loginUser.getId(), tenantId);
return createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs);
}
private Map<String, Object> createDagDefine(User loginUser,
List<ProcessTaskRelationLog> taskRelationList,
ProcessDefinition processDefinition,
List<TaskDefinitionLog> taskDefinitionLogs) {
Map<String, Object> result = new HashMap<>();
int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs);
if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) {
logger.info("The task has not changed, so skip");
}
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
}
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, true);
if (insertVersion == 0) {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR);
}
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
putMsg(result, Status.CREATE_PROCESS_TASK_RELATION_ERROR);
throw new ServiceException(Status.CREATE_PROCESS_TASK_RELATION_ERROR);
}
return result;
}
private Map<String, Object> checkTaskDefinitionList(List<TaskDefinitionLog> taskDefinitionLogs, String taskDefinitionJson) {
Map<String, Object> result = new HashMap<>();
try {
if (taskDefinitionLogs.isEmpty()) {
logger.error("taskDefinitionJson invalid: {}", taskDefinitionJson);
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson);
return result;
}
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (!CheckUtils.checkTaskDefinitionParameters(taskDefinitionLog)) {
logger.error("task definition {} parameter invalid", taskDefinitionLog.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName());
return result;
}
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | result.put(Constants.MSG, e.getMessage());
}
return result;
}
private Map<String, Object> checkTaskRelationList(List<ProcessTaskRelationLog> taskRelationList, String taskRelationJson, List<TaskDefinitionLog> taskDefinitionLogs) {
Map<String, Object> result = new HashMap<>();
try {
if (taskRelationList == null || taskRelationList.isEmpty()) {
logger.error("task relation list is null");
putMsg(result, Status.DATA_IS_NOT_VALID, taskRelationJson);
return result;
}
List<ProcessTaskRelation> processTaskRelations = taskRelationList.stream()
.map(processTaskRelationLog -> JSONUtils.parseObject(JSONUtils.toJsonString(processTaskRelationLog), ProcessTaskRelation.class))
.collect(Collectors.toList());
List<TaskNode> taskNodeList = processService.transformTask(processTaskRelations, taskDefinitionLogs);
if (taskNodeList.size() != taskRelationList.size()) {
Set<Long> postTaskCodes = taskRelationList.stream().map(ProcessTaskRelationLog::getPostTaskCode).collect(Collectors.toSet());
Set<Long> taskNodeCodes = taskNodeList.stream().map(TaskNode::getCode).collect(Collectors.toSet());
Collection<Long> codes = CollectionUtils.subtract(postTaskCodes, taskNodeCodes);
if (CollectionUtils.isNotEmpty(codes)) {
logger.error("the task code is not exit");
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, StringUtils.join(codes, Constants.COMMA));
return result;
}
}
if (graphHasCycle(taskNodeList)) {
logger.error("process DAG has cycle");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) {
if (processTaskRelationLog.getPostTaskCode() == 0) {
logger.error("the post_task_code or post_task_version can't be zero");
putMsg(result, Status.CHECK_PROCESS_TASK_RELATION_ERROR);
return result;
}
}
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;
}
/**
* query process definition list
*
* @param loginUser login user
* @param projectCode project code
* @return definition list
*/
@Override
public Map<String, Object> queryProcessDefinitionList(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
List<ProcessDefinition> resourceList = processDefinitionMapper.queryAllDefinitionList(projectCode);
List<DagData> dagDataList = resourceList.stream().map(processService::genDagData).collect(Collectors.toList());
result.put(Constants.DATA_LIST, dagDataList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition list paging
*
* @param loginUser login user
* @param projectCode project code
* @param searchVal search value
* @param userId user id
* @param pageNo page number
* @param pageSize page size
* @return process definition page
*/
@Override
public Result queryProcessDefinitionListPaging(User loginUser, long projectCode, String searchVal, Integer userId, Integer pageNo, Integer pageSize) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
putMsg(result, resultStatus);
return result;
}
Page<ProcessDefinition> page = new Page<>(pageNo, pageSize); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | IPage<ProcessDefinition> processDefinitionIPage = processDefinitionMapper.queryDefineListPaging(
page, searchVal, userId, project.getCode(), isAdmin(loginUser));
List<ProcessDefinition> records = processDefinitionIPage.getRecords();
for (ProcessDefinition pd : records) {
ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(pd.getCode(), pd.getVersion());
User user = userMapper.selectById(processDefinitionLog.getOperator());
pd.setModifyBy(user.getUserName());
}
processDefinitionIPage.setRecords(records);
PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) processDefinitionIPage.getTotal());
pageInfo.setTotalList(processDefinitionIPage.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query detail of process definition
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @return process definition detail
*/
@Override
public Map<String, Object> queryProcessDefinitionByCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
} else {
Tenant tenant = tenantMapper.queryById(processDefinition.getTenantId());
if (tenant != null) {
processDefinition.setTenantCode(tenant.getTenantCode());
}
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData);
putMsg(result, Status.SUCCESS);
}
return result;
}
@Override
public Map<String, Object> queryProcessDefinitionByName(User loginUser, long projectCode, String name) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, name);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, name);
} else {
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* update process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param code process definition code
* @param description description
* @param globalParams global params
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @return update result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> updateProcessDefinition(User loginUser,
long projectCode,
String name,
long code,
String description,
String globalParams,
String locations,
int timeout, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | String tenantCode,
String taskRelationJson,
String taskDefinitionJson) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
Map<String, Object> checkTaskDefinitions = checkTaskDefinitionList(taskDefinitionLogs, taskDefinitionJson);
if (checkTaskDefinitions.get(Constants.STATUS) != Status.SUCCESS) {
return checkTaskDefinitions;
}
List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class);
Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs);
if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) {
return checkRelationJson;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName());
return result;
}
if (!name.equals(processDefinition.getName())) {
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
}
ProcessDefinition processDefinitionDeepCopy = JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class);
processDefinition.set(projectCode, name, description, globalParams, locations, timeout, tenantId);
return updateDagDefine(loginUser, taskRelationList, processDefinition, processDefinitionDeepCopy, taskDefinitionLogs);
}
private Map<String, Object> updateDagDefine(User loginUser,
List<ProcessTaskRelationLog> taskRelationList,
ProcessDefinition processDefinition,
ProcessDefinition processDefinitionDeepCopy,
List<TaskDefinitionLog> taskDefinitionLogs) {
Map<String, Object> result = new HashMap<>();
int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs);
if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) {
logger.info("The task has not changed, so skip"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR);
}
int insertVersion;
if (processDefinition.equals(processDefinitionDeepCopy)) {
insertVersion = processDefinitionDeepCopy.getVersion();
} else {
processDefinition.setUpdateTime(new Date());
insertVersion = processService.saveProcessDefine(loginUser, processDefinition, true);
}
if (insertVersion == 0) {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(),
processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
return result;
}
/**
* verify process definition name unique
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param loginUser login user
* @param projectCode project code
* @param name name
* @return true if process definition name not exists, otherwise false
*/
@Override
public Map<String, Object> verifyProcessDefinitionName(User loginUser, long projectCode, String name) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.verifyByDefineName(project.getCode(), name.trim());
if (processDefinition == null) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name.trim());
}
return result;
}
/**
* delete process definition by code
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @return delete result code
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | @Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> deleteProcessDefinitionByCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
return result;
}
if (loginUser.getId() != processDefinition.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, code);
return result;
}
List<ProcessInstance> processInstances = processInstanceService.queryByProcessDefineCodeAndStatus(processDefinition.getCode(), Constants.NOT_TERMINATED_STATES);
if (CollectionUtils.isNotEmpty(processInstances)) {
putMsg(result, Status.DELETE_PROCESS_DEFINITION_BY_CODE_FAIL, processInstances.size());
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionCode(code);
if (!schedules.isEmpty() && schedules.size() > 1) {
logger.warn("scheduler num is {},Greater than 1", schedules.size());
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
return result;
} else if (schedules.size() == 1) {
Schedule schedule = schedules.get(0);
if (schedule.getReleaseState() == ReleaseState.OFFLINE) {
int delete = scheduleMapper.deleteById(schedule.getId());
if (delete == 0) {
putMsg(result, Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR);
throw new ServiceException(Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR);
}
} else if (schedule.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, schedule.getId());
return result;
}
}
int delete = processDefinitionMapper.deleteById(processDefinition.getId());
int deleteRelation = processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode());
if (delete == 0 || deleteRelation == 0) {
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* release process definition: online / offline
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState release state
* @return release result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> releaseProcessDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (null == releaseState) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
switch (releaseState) {
case ONLINE:
String resourceIds = processDefinition.getResourceIds();
if (StringUtils.isNotBlank(resourceIds)) {
Integer[] resourceIdArray = Arrays.stream(resourceIds.split(Constants.COMMA)).map(Integer::parseInt).toArray(Integer[]::new);
PermissionCheck<Integer> permissionCheck = new PermissionCheck<>(AuthorizationType.RESOURCE_FILE_ID, processService, resourceIdArray, loginUser.getId(), logger);
try {
permissionCheck.checkPermission(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | } catch (Exception e) {
logger.error(e.getMessage(), e);
putMsg(result, Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION, RELEASESTATE);
return result;
}
}
processDefinition.setReleaseState(releaseState);
processDefinitionMapper.updateById(processDefinition);
break;
case OFFLINE:
processDefinition.setReleaseState(releaseState);
int updateProcess = processDefinitionMapper.updateById(processDefinition);
List<Schedule> scheduleList = scheduleMapper.selectAllByProcessDefineArray(
new long[]{processDefinition.getCode()}
);
if (updateProcess > 0 && scheduleList.size() == 1) {
Schedule schedule = scheduleList.get(0);
logger.info("set schedule offline, project id: {}, schedule id: {}, process definition code: {}", project.getId(), schedule.getId(), code);
schedule.setReleaseState(ReleaseState.OFFLINE);
int updateSchedule = scheduleMapper.updateById(schedule);
if (updateSchedule == 0) {
putMsg(result, Status.OFFLINE_SCHEDULE_ERROR);
throw new ServiceException(Status.OFFLINE_SCHEDULE_ERROR);
}
schedulerService.deleteSchedule(project.getId(), schedule.getId());
}
break;
default:
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return result;
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* batch export process definition by codes
*/
@Override
public void batchExportProcessDefinitionByCodes(User loginUser, long projectCode, String codes, HttpServletResponse response) {
if (StringUtils.isEmpty(codes)) {
return;
}
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return;
}
Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet);
List<DagDataSchedule> dagDataSchedules = processDefinitionList.stream().map(this::exportProcessDagData).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(dagDataSchedules)) {
downloadProcessDefinitionFile(response, dagDataSchedules);
}
}
/**
* download the process definition file
*/
private void downloadProcessDefinitionFile(HttpServletResponse response, List<DagDataSchedule> dagDataSchedules) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | 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(dagDataSchedules).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 dag data |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | *
* @param processDefinition process definition
* @return DagDataSchedule
*/
public DagDataSchedule exportProcessDagData(ProcessDefinition processDefinition) {
List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionCode(processDefinition.getCode());
DagDataSchedule dagDataSchedule = new DagDataSchedule(processService.genDagData(processDefinition));
if (!schedules.isEmpty()) {
Schedule schedule = schedules.get(0);
schedule.setReleaseState(ReleaseState.OFFLINE);
dagDataSchedule.setSchedule(schedule);
}
return dagDataSchedule;
}
/**
* import process definition
*
* @param loginUser login user
* @param projectCode project code
* @param file process metadata json file
* @return import process
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> importProcessDefinition(User loginUser, long projectCode, MultipartFile file) {
Map<String, Object> result = new HashMap<>();
String dagDataScheduleJson = FileUtils.file2String(file);
List<DagDataSchedule> dagDataScheduleList = JSONUtils.toList(dagDataScheduleJson, DagDataSchedule.class);
if (CollectionUtils.isEmpty(dagDataScheduleList)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.DATA_IS_NULL, "fileContent");
return result;
}
for (DagDataSchedule dagDataSchedule : dagDataScheduleList) {
if (!checkAndImport(loginUser, projectCode, result, dagDataSchedule)) {
return result;
}
}
return result;
}
/**
* check and import
*/
private boolean checkAndImport(User loginUser, long projectCode, Map<String, Object> result, DagDataSchedule dagDataSchedule) {
if (!checkImportanceParams(dagDataSchedule, result)) {
return false;
}
ProcessDefinition processDefinition = dagDataSchedule.getProcessDefinition();
Map<String, Object> checkResult = verifyProcessDefinitionName(loginUser, projectCode, processDefinition.getName());
if (Status.SUCCESS.equals(checkResult.get(Constants.STATUS))) {
putMsg(result, Status.SUCCESS);
} else {
result.putAll(checkResult);
return false;
}
String processDefinitionName = recursionProcessDefinitionName(projectCode, processDefinition.getName(), 1);
processDefinition.setName(processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp());
processDefinition.setUserId(loginUser.getId());
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | processDefinition.setCode(SnowFlakeUtils.getInstance().nextId());
} catch (SnowFlakeException e) {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
return false;
}
List<TaskDefinition> taskDefinitionList = dagDataSchedule.getTaskDefinitionList();
Map<Long, Long> taskCodeMap = new HashMap<>();
Date now = new Date();
List<TaskDefinitionLog> taskDefinitionLogList = new ArrayList<>();
for (TaskDefinition taskDefinition : taskDefinitionList) {
TaskDefinitionLog taskDefinitionLog = new TaskDefinitionLog(taskDefinition);
taskDefinitionLog.setName(taskDefinitionLog.getName() + "_import_" + DateUtils.getCurrentTimeStamp());
taskDefinitionLog.setProjectCode(projectCode);
taskDefinitionLog.setUserId(loginUser.getId());
taskDefinitionLog.setVersion(Constants.VERSION_FIRST);
taskDefinitionLog.setCreateTime(now);
taskDefinitionLog.setUpdateTime(now);
taskDefinitionLog.setOperator(loginUser.getId());
taskDefinitionLog.setOperateTime(now);
try {
long code = SnowFlakeUtils.getInstance().nextId();
taskCodeMap.put(taskDefinitionLog.getCode(), code);
taskDefinitionLog.setCode(code);
} catch (SnowFlakeException e) {
logger.error("Task code get error, ", e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code");
return false;
}
taskDefinitionLogList.add(taskDefinitionLog);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | int insert = taskDefinitionMapper.batchInsert(taskDefinitionLogList);
int logInsert = taskDefinitionLogMapper.batchInsert(taskDefinitionLogList);
if ((logInsert & insert) == 0) {
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
}
List<ProcessTaskRelation> taskRelationList = dagDataSchedule.getProcessTaskRelationList();
List<ProcessTaskRelationLog> taskRelationLogList = new ArrayList<>();
for (ProcessTaskRelation processTaskRelation : taskRelationList) {
ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog(processTaskRelation);
processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode()));
processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode()));
processTaskRelationLog.setPreTaskVersion(Constants.VERSION_FIRST);
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST);
taskRelationLogList.add(processTaskRelationLog);
}
Map<String, Object> createDagResult = createDagDefine(loginUser, taskRelationLogList, processDefinition, Lists.newArrayList());
if (Status.SUCCESS.equals(createDagResult.get(Constants.STATUS))) {
putMsg(createDagResult, Status.SUCCESS);
} else {
result.putAll(createDagResult);
throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR);
}
Schedule schedule = dagDataSchedule.getSchedule();
if (null != schedule) {
ProcessDefinition newProcessDefinition = processDefinitionMapper.queryByCode(processDefinition.getCode());
schedule.setProcessDefinitionCode(newProcessDefinition.getCode());
schedule.setUserId(loginUser.getId());
schedule.setCreateTime(now);
schedule.setUpdateTime(now); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | int scheduleInsert = scheduleMapper.insert(schedule);
if (0 == scheduleInsert) {
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR);
}
}
return true;
}
/**
* check importance params
*/
private boolean checkImportanceParams(DagDataSchedule dagDataSchedule, Map<String, Object> result) {
if (dagDataSchedule.getProcessDefinition() == null) {
putMsg(result, Status.DATA_IS_NULL, "ProcessDefinition");
return false;
}
if (CollectionUtils.isEmpty(dagDataSchedule.getTaskDefinitionList())) {
putMsg(result, Status.DATA_IS_NULL, "TaskDefinitionList");
return false;
}
if (CollectionUtils.isEmpty(dagDataSchedule.getProcessTaskRelationList())) {
putMsg(result, Status.DATA_IS_NULL, "ProcessTaskRelationList");
return false;
}
return true;
}
private String recursionProcessDefinitionName(long projectCode, String processDefinitionName, int num) {
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName);
if (processDefinition != null) {
if (num > 1) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | String str = processDefinitionName.substring(0, processDefinitionName.length() - 3);
processDefinitionName = str + "(" + num + ")";
} else {
processDefinitionName = processDefinition.getName() + "(" + num + ")";
}
} else {
return processDefinitionName;
}
return recursionProcessDefinitionName(projectCode, processDefinitionName, num + 1);
}
/**
* check the process task relation json
*
* @param processTaskRelationJson process task relation json
* @return check result code
*/
@Override
public Map<String, Object> checkProcessNodeList(String processTaskRelationJson) {
Map<String, Object> result = new HashMap<>();
try {
if (processTaskRelationJson == null) {
logger.error("process data is null");
putMsg(result, Status.DATA_IS_NOT_VALID, processTaskRelationJson);
return result;
}
List<ProcessTaskRelation> taskRelationList = JSONUtils.toList(processTaskRelationJson, ProcessTaskRelation.class);
List<TaskNode> taskNodes = processService.transformTask(taskRelationList, Lists.newArrayList());
if (CollectionUtils.isEmpty(taskNodes)) {
logger.error("process node info is empty"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
if (graphHasCycle(taskNodes)) {
logger.error("process DAG has cycle");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result;
}
for (TaskNode taskNode : taskNodes) {
if (!CheckUtils.checkTaskNodeParameters(taskNode)) {
logger.error("task node {} parameter invalid", taskNode.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName());
return result;
}
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 loginUser loginUser |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param projectCode project code
* @param code process definition code
* @return task node list
*/
@Override
public Map<String, Object> getTaskNodeListByDefinitionCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
return result;
}
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData.getTaskDefinitionList());
putMsg(result, Status.SUCCESS);
return result;
}
/**
* get task node details map based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param codes define codes
* @return task node list |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | */
@Override
public Map<String, Object> getNodeListMapByDefinitionCodes(User loginUser, long projectCode, String codes) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet);
if (CollectionUtils.isEmpty(processDefinitionList)) {
logger.info("process definition not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes);
return result;
}
Map<Long, List<TaskDefinition>> taskNodeMap = new HashMap<>();
for (ProcessDefinition processDefinition : processDefinitionList) {
DagData dagData = processService.genDagData(processDefinition);
taskNodeMap.put(processDefinition.getCode(), dagData.getTaskDefinitionList());
}
result.put(Constants.DATA_LIST, taskNodeMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition all by project code
*
* @param loginUser loginUser
* @param projectCode project code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @return process definitions in the project
*/
@Override
public Map<String, Object> queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode);
List<DagData> dagDataList = processDefinitions.stream().map(processService::genDagData).collect(Collectors.toList());
result.put(Constants.DATA_LIST, dagDataList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* Encapsulates the TreeView structure
*
* @param code process definition code
* @param limit limit
* @return tree view json data
*/
@Override
public Map<String, Object> viewTree(long code, Integer limit) {
Map<String, Object> result = new HashMap<>();
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (null == processDefinition) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return result;
}
DAG<String, TaskNode, TaskNodeRelation> dag = processService.genDagGraph(processDefinition);
Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>();
Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>();
List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineCode(code, limit);
processInstanceList.forEach(processInstance -> processInstance.setDuration(DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())));
List<TaskDefinitionLog> taskDefinitionList = processService.genTaskDefineList(processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode()));
Map<Long, TaskDefinitionLog> taskDefinitionMap = taskDefinitionList.stream()
.collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog));
if (limit > processInstanceList.size()) {
limit = processInstanceList.size();
}
TreeViewDto parentTreeViewDto = new TreeViewDto();
parentTreeViewDto.setName("DAG");
parentTreeViewDto.setType("");
parentTreeViewDto.setCode(0L);
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.getProcessDefinitionCode(),
"", processInstance.getState().toString(), processInstance.getStartTime(), endTime, processInstance.getHost(),
DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime())));
}
List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>();
parentTreeViewDtoList.add(parentTreeViewDto); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | for (String startNode : dag.getBeginNode()) {
runningNodeMap.put(startNode, parentTreeViewDtoList);
}
while (Stopper.isRunning()) {
Set<String> postNodeList;
Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, List<TreeViewDto>> en = iter.next();
String nodeCode = en.getKey();
parentTreeViewDtoList = en.getValue();
TreeViewDto treeViewDto = new TreeViewDto();
TaskNode taskNode = dag.getNode(nodeCode);
treeViewDto.setType(taskNode.getType());
treeViewDto.setCode(taskNode.getCode());
treeViewDto.setName(taskNode.getName());
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndCode(processInstance.getId(), Long.parseLong(nodeCode));
if (taskInstance == null) {
treeViewDto.getInstances().add(new Instance(-1, "not running", 0, "null"));
} else {
Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime();
Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime();
int subProcessId = 0;
if (taskInstance.isSubProcess()) {
TaskDefinition taskDefinition = taskDefinitionMap.get(taskInstance.getTaskCode());
subProcessId = Integer.parseInt(JSONUtils.parseObject( |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | taskDefinition.getTaskParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_ID).asText());
}
treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(), taskInstance.getTaskCode(),
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(nodeCode);
if (CollectionUtils.isNotEmpty(postNodeList)) {
for (String nextNodeCode : postNodeList) {
List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeCode);
if (CollectionUtils.isEmpty(treeViewDtoList)) {
treeViewDtoList = new ArrayList<>();
}
treeViewDtoList.add(treeViewDto);
waitingRunningNodeMap.put(nextNodeCode, treeViewDtoList);
}
}
runningNodeMap.remove(nodeCode);
}
if (waitingRunningNodeMap.size() == 0) {
break;
} else {
runningNodeMap.putAll(waitingRunningNodeMap);
waitingRunningNodeMap.clear();
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | result.put(Constants.DATA_LIST, parentTreeViewDto);
result.put(Constants.STATUS, Status.SUCCESS);
result.put(Constants.MSG, Status.SUCCESS.getMsg());
return result;
}
/**
* 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<>();
for (TaskNode taskNodeResponse : taskNodeResponseList) {
graph.addNode(Long.toString(taskNodeResponse.getCode()), taskNodeResponse);
}
for (TaskNode taskNodeResponse : taskNodeResponseList) {
List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(), String.class);
if (CollectionUtils.isNotEmpty(preTasks)) {
for (String preTask : preTasks) {
if (!graph.addEdge(preTask, Long.toString(taskNodeResponse.getCode()))) {
return true;
}
}
}
}
return graph.hasCycle();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | /**
* batch copy process definition
*
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
@Override
public Map<String, Object> batchCopyProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode) {
Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, true);
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, true);
return result;
}
/**
* batch move process definition
*
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | @Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> batchMoveProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode) {
Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (projectCode == targetProjectCode) {
return result;
}
List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, false);
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, false);
return result;
}
private Map<String, Object> checkParams(User loginUser,
long projectCode,
String processDefinitionCodes,
long targetProjectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (StringUtils.isEmpty(processDefinitionCodes)) {
putMsg(result, Status.PROCESS_DEFINITION_CODES_IS_EMPTY, processDefinitionCodes); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return result;
}
if (projectCode != targetProjectCode) {
Project targetProject = projectMapper.queryByCode(targetProjectCode);
Map<String, Object> targetResult = projectService.checkProjectAndAuth(loginUser, targetProject, targetProjectCode);
if (targetResult.get(Constants.STATUS) != Status.SUCCESS) {
return targetResult;
}
}
return result;
}
private void doBatchOperateProcessDefinition(User loginUser,
long targetProjectCode,
List<String> failedProcessList,
String processDefinitionCodes,
Map<String, Object> result,
boolean isCopy) {
Set<Long> definitionCodes = Arrays.stream(processDefinitionCodes.split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(definitionCodes);
Set<Long> queryCodes = processDefinitionList.stream().map(ProcessDefinition::getCode).collect(Collectors.toSet());
Set<Long> diffCode = definitionCodes.stream().filter(code -> !queryCodes.contains(code)).collect(Collectors.toSet());
diffCode.forEach(code -> failedProcessList.add(code + "[null]"));
for (ProcessDefinition processDefinition : processDefinitionList) {
List<ProcessTaskRelation> processTaskRelations =
processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode());
List<ProcessTaskRelationLog> taskRelationList = processTaskRelations.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList());
processDefinition.setProjectCode(targetProjectCode);
if (isCopy) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | try {
processDefinition.setCode(SnowFlakeUtils.getInstance().nextId());
} catch (SnowFlakeException e) {
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS);
}
processDefinition.setId(0);
processDefinition.setUserId(loginUser.getId());
processDefinition.setName(processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp());
try {
result.putAll(createDagDefine(loginUser, taskRelationList, processDefinition, Lists.newArrayList()));
} catch (Exception e) {
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.COPY_PROCESS_DEFINITION_ERROR);
}
} else {
try {
result.putAll(updateDagDefine(loginUser, taskRelationList, processDefinition, null, Lists.newArrayList()));
} catch (Exception e) {
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.MOVE_PROCESS_DEFINITION_ERROR);
}
}
if (result.get(Constants.STATUS) != Status.SUCCESS) {
failedProcessList.add(processDefinition.getCode() + "[" + processDefinition.getName() + "]");
}
}
}
/**
* switch the defined process definition version |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | *
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param version the version user want to switch
* @return switch process definition version result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> switchProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (Objects.isNull(processDefinition)) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR, code);
return result;
}
ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(code, version);
if (Objects.isNull(processDefinitionLog)) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR, processDefinition.getCode(), version);
return result;
}
int switchVersion = processService.switchVersion(processDefinition, processDefinitionLog);
if (switchVersion <= 0) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
throw new ServiceException(Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
putMsg(result, Status.SUCCESS);
return result;
}
/**
* check batch operate result
*
* @param srcProjectCode srcProjectCode
* @param targetProjectCode targetProjectCode
* @param result result
* @param failedProcessList failedProcessList
* @param isCopy isCopy
*/
private void checkBatchOperateResult(long srcProjectCode, long targetProjectCode,
Map<String, Object> result, List<String> failedProcessList, boolean isCopy) {
if (!failedProcessList.isEmpty()) {
if (isCopy) {
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode, String.join(",", failedProcessList));
} else {
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode, String.join(",", failedProcessList));
}
} else {
putMsg(result, Status.SUCCESS);
}
}
/**
* query the pagination versions info by one certain process definition code
*
* @param loginUser login user info to check auth
* @param projectCode project code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param pageNo page number
* @param pageSize page size
* @param code process definition code
* @return the pagination process definition versions info of the certain process definition
*/
@Override
public Result queryProcessDefinitionVersions(User loginUser, long projectCode, int pageNo, int pageSize, long code) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
putMsg(result, resultStatus);
return result;
}
PageInfo<ProcessDefinitionLog> pageInfo = new PageInfo<>(pageNo, pageSize);
Page<ProcessDefinitionLog> page = new Page<>(pageNo, pageSize);
IPage<ProcessDefinitionLog> processDefinitionVersionsPaging = processDefinitionLogMapper.queryProcessDefinitionVersionsPaging(page, code);
List<ProcessDefinitionLog> processDefinitionLogs = processDefinitionVersionsPaging.getRecords();
pageInfo.setTotalList(processDefinitionLogs);
pageInfo.setTotal((int) processDefinitionVersionsPaging.getTotal());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete one certain process definition by version number and process definition code
*
* @param loginUser login user info to check auth |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,591 | [Bug] [API] import process definition error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
```
2021-10-22 14:28:39.421 ERROR 27304 --- [qtp407976995-47] o.a.d.a.exceptions.ApiExceptionHandler : import process definition error
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.checkAndImport(ProcessDefinitionServiceImpl.java:895) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
at org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl.importProcessDefinition(ProcessDefinitionServiceImpl.java:827) ~[dolphinscheduler-api-2.0.0-alpha.jar:2.0.0-alpha]
```
### What you expected to happen
import process definition success.
### How to reproduce
import process definition whit the json file you output from ds.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6591 | https://github.com/apache/dolphinscheduler/pull/6592 | adf49e6a5f102094007fff245824f6885990cff8 | 0d26724455316da665c0c8501b19531ada663779 | "2021-10-22T10:27:25Z" | java | "2021-10-26T09:35:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param projectCode project code
* @param code process definition code
* @param version version number
* @return delete result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> deleteProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
} else {
int deleteLog = processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(code, version);
int deleteRelationLog = processTaskRelationLogMapper.deleteByCode(processDefinition.getCode(), processDefinition.getVersion());
if (deleteLog == 0 || deleteRelationLog == 0) {
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
}
putMsg(result, Status.SUCCESS);
}
return result;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,181 | Empty try block in UT | I found out we have empty try block in our UT, maybe we should just remove this block?
https://github.com/apache/dolphinscheduler/blob/e1aed5eefd26c9b447d356de6238e4b61a4d3daf/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/AlertPluginManagerTest.java#L60-L65 | https://github.com/apache/dolphinscheduler/issues/6181 | https://github.com/apache/dolphinscheduler/pull/6182 | d91801e6f60670915a97d031b21fe16ce98e3e4e | cbeedba3e2cfdf80553da0d798fc71aaa448c6e0 | "2021-09-13T02:20:30Z" | java | "2021-10-27T11:01:33Z" | 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.common.utils.PropertyUtils;
import org.apache.dolphinscheduler.spi.plugin.DolphinPluginLoader;
import org.apache.dolphinscheduler.spi.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; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,181 | Empty try block in UT | I found out we have empty try block in our UT, maybe we should just remove this block?
https://github.com/apache/dolphinscheduler/blob/e1aed5eefd26c9b447d356de6238e4b61a4d3daf/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/AlertPluginManagerTest.java#L60-L65 | https://github.com/apache/dolphinscheduler/issues/6181 | https://github.com/apache/dolphinscheduler/pull/6182 | d91801e6f60670915a97d031b21fe16ce98e3e4e | cbeedba3e2cfdf80553da0d798fc71aaa448c6e0 | "2021-09-13T02:20:30Z" | java | "2021-10-27T11:01:33Z" | dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/AlertPluginManagerTest.java | 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(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 {
} catch (Exception e) {
throw new RuntimeException("load Alert Plugin Failed !", e);
}
Assert.assertNull(alertPluginManager.getAlertChannelFactoryMap().get("Email"));
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,616 | [Bug] [Worker] Worker fakes death when it stop itself fail. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I try a stress test, I found that worker fakes death and print nothing to log file. At the same time, worker is not exist in zk node path and Master can't dispatch task because no worker.
That's the log before worker stop:
```
[ERROR] 2021-10-15 15:10:57.590 org.apache.dolphinscheduler.server.worker.WorkerServer:[223] - worker server stop exception
org.apache.dolphinscheduler.spi.register.RegistryException: zookeeper delete key error
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.delete(ZookeeperRegistry.java:272)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.remove(ZookeeperRegistry.java:199)
at org.apache.dolphinscheduler.service.registry.RegistryCenter.remove(RegistryCenter.java:157)
at org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient.unRegistry(WorkerRegistryClient.java:128)
at org.apache.dolphinscheduler.server.worker.WorkerServer.close(WorkerServer.java:219)
at org.apache.dolphinscheduler.server.worker.WorkerServer.stop(WorkerServer.java:229)
at org.apache.dolphinscheduler.server.registry.HeartBeatTask.run(HeartBeatTask.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /dolphinscheduler/nodes/worker/default/172.28.132.15:1234
at org.apache.zookeeper.KeeperException.create(KeeperException.java:102)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:54)
at org.apache.zookeeper.ZooKeeper.delete(ZooKeeper.java:882)
at org.apache.curator.framework.imps.DeleteBuilderImpl$5.call(DeleteBuilderImpl.java:274)
at org.apache.curator.framework.imps.DeleteBuilderImpl$5.call(DeleteBuilderImpl.java:268)
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.DeleteBuilderImpl.pathInForeground(DeleteBuilderImpl.java:265)
at org.apache.curator.framework.imps.DeleteBuilderImpl.forPath(DeleteBuilderImpl.java:249)
at org.apache.curator.framework.imps.DeleteBuilderImpl.forPath(DeleteBuilderImpl.java:34)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.delete(ZookeeperRegistry.java:267)
... 13 common frames omitted
```
Maybe set stop single to true after close zk and netty successfully is better.
### What you expected to happen
worker can stop itself successfully when it is judged dead server.
### How to reproduce
do some stress test with many task running.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6616 | https://github.com/apache/dolphinscheduler/pull/6621 | 03aaef0fe6548e828144e6e5ac8ceb8bd6b650ad | 06e8e24708e2c2a2b9367b9e76a4dc0cec4cdfc6 | "2021-10-27T10:10:53Z" | java | "2021-10-29T09:44:06Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/registry/WorkerRegistryClient.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.registry;
import static org.apache.dolphinscheduler.common.Constants.DEFAULT_WORKER_GROUP;
import static org.apache.dolphinscheduler.common.Constants.REGISTRY_DOLPHINSCHEDULER_WORKERS;
import static org.apache.dolphinscheduler.common.Constants.SINGLE_SLASH;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.IStoppable;
import org.apache.dolphinscheduler.common.enums.NodeType;
import org.apache.dolphinscheduler.common.utils.NetUtils;
import org.apache.dolphinscheduler.remote.utils.NamedThreadFactory; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,616 | [Bug] [Worker] Worker fakes death when it stop itself fail. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I try a stress test, I found that worker fakes death and print nothing to log file. At the same time, worker is not exist in zk node path and Master can't dispatch task because no worker.
That's the log before worker stop:
```
[ERROR] 2021-10-15 15:10:57.590 org.apache.dolphinscheduler.server.worker.WorkerServer:[223] - worker server stop exception
org.apache.dolphinscheduler.spi.register.RegistryException: zookeeper delete key error
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.delete(ZookeeperRegistry.java:272)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.remove(ZookeeperRegistry.java:199)
at org.apache.dolphinscheduler.service.registry.RegistryCenter.remove(RegistryCenter.java:157)
at org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient.unRegistry(WorkerRegistryClient.java:128)
at org.apache.dolphinscheduler.server.worker.WorkerServer.close(WorkerServer.java:219)
at org.apache.dolphinscheduler.server.worker.WorkerServer.stop(WorkerServer.java:229)
at org.apache.dolphinscheduler.server.registry.HeartBeatTask.run(HeartBeatTask.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /dolphinscheduler/nodes/worker/default/172.28.132.15:1234
at org.apache.zookeeper.KeeperException.create(KeeperException.java:102)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:54)
at org.apache.zookeeper.ZooKeeper.delete(ZooKeeper.java:882)
at org.apache.curator.framework.imps.DeleteBuilderImpl$5.call(DeleteBuilderImpl.java:274)
at org.apache.curator.framework.imps.DeleteBuilderImpl$5.call(DeleteBuilderImpl.java:268)
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.DeleteBuilderImpl.pathInForeground(DeleteBuilderImpl.java:265)
at org.apache.curator.framework.imps.DeleteBuilderImpl.forPath(DeleteBuilderImpl.java:249)
at org.apache.curator.framework.imps.DeleteBuilderImpl.forPath(DeleteBuilderImpl.java:34)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.delete(ZookeeperRegistry.java:267)
... 13 common frames omitted
```
Maybe set stop single to true after close zk and netty successfully is better.
### What you expected to happen
worker can stop itself successfully when it is judged dead server.
### How to reproduce
do some stress test with many task running.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6616 | https://github.com/apache/dolphinscheduler/pull/6621 | 03aaef0fe6548e828144e6e5ac8ceb8bd6b650ad | 06e8e24708e2c2a2b9367b9e76a4dc0cec4cdfc6 | "2021-10-27T10:10:53Z" | java | "2021-10-29T09:44:06Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/registry/WorkerRegistryClient.java | import org.apache.dolphinscheduler.server.registry.HeartBeatTask;
import org.apache.dolphinscheduler.server.worker.config.WorkerConfig;
import org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread;
import org.apache.dolphinscheduler.service.registry.RegistryClient;
import org.apache.commons.lang.StringUtils;
import java.util.Set;
import java.util.StringJoiner;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.common.collect.Sets;
/**
* worker registry
*/
@Service
public class WorkerRegistryClient {
private final Logger logger = LoggerFactory.getLogger(WorkerRegistryClient.class);
/**
* worker config
*/
@Autowired
private WorkerConfig workerConfig;
/**
* worker manager
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,616 | [Bug] [Worker] Worker fakes death when it stop itself fail. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I try a stress test, I found that worker fakes death and print nothing to log file. At the same time, worker is not exist in zk node path and Master can't dispatch task because no worker.
That's the log before worker stop:
```
[ERROR] 2021-10-15 15:10:57.590 org.apache.dolphinscheduler.server.worker.WorkerServer:[223] - worker server stop exception
org.apache.dolphinscheduler.spi.register.RegistryException: zookeeper delete key error
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.delete(ZookeeperRegistry.java:272)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.remove(ZookeeperRegistry.java:199)
at org.apache.dolphinscheduler.service.registry.RegistryCenter.remove(RegistryCenter.java:157)
at org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient.unRegistry(WorkerRegistryClient.java:128)
at org.apache.dolphinscheduler.server.worker.WorkerServer.close(WorkerServer.java:219)
at org.apache.dolphinscheduler.server.worker.WorkerServer.stop(WorkerServer.java:229)
at org.apache.dolphinscheduler.server.registry.HeartBeatTask.run(HeartBeatTask.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /dolphinscheduler/nodes/worker/default/172.28.132.15:1234
at org.apache.zookeeper.KeeperException.create(KeeperException.java:102)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:54)
at org.apache.zookeeper.ZooKeeper.delete(ZooKeeper.java:882)
at org.apache.curator.framework.imps.DeleteBuilderImpl$5.call(DeleteBuilderImpl.java:274)
at org.apache.curator.framework.imps.DeleteBuilderImpl$5.call(DeleteBuilderImpl.java:268)
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.DeleteBuilderImpl.pathInForeground(DeleteBuilderImpl.java:265)
at org.apache.curator.framework.imps.DeleteBuilderImpl.forPath(DeleteBuilderImpl.java:249)
at org.apache.curator.framework.imps.DeleteBuilderImpl.forPath(DeleteBuilderImpl.java:34)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.delete(ZookeeperRegistry.java:267)
... 13 common frames omitted
```
Maybe set stop single to true after close zk and netty successfully is better.
### What you expected to happen
worker can stop itself successfully when it is judged dead server.
### How to reproduce
do some stress test with many task running.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6616 | https://github.com/apache/dolphinscheduler/pull/6621 | 03aaef0fe6548e828144e6e5ac8ceb8bd6b650ad | 06e8e24708e2c2a2b9367b9e76a4dc0cec4cdfc6 | "2021-10-27T10:10:53Z" | java | "2021-10-29T09:44:06Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/registry/WorkerRegistryClient.java | @Autowired
private WorkerManagerThread workerManagerThread;
/**
* heartbeat executor
*/
private ScheduledExecutorService heartBeatExecutor;
private RegistryClient registryClient;
/**
* worker startup time, ms
*/
private long startupTime;
private Set<String> workerGroups;
@PostConstruct
public void initWorkRegistry() {
this.workerGroups = workerConfig.getWorkerGroups();
this.startupTime = System.currentTimeMillis();
this.registryClient = RegistryClient.getInstance();
this.heartBeatExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("HeartBeatExecutor"));
}
/**
* registry
*/
public void registry() {
String address = NetUtils.getAddr(workerConfig.getListenPort());
Set<String> workerZkPaths = getWorkerZkPaths();
int workerHeartbeatInterval = workerConfig.getWorkerHeartbeatInterval();
for (String workerZKPath : workerZkPaths) {
registryClient.persistEphemeral(workerZKPath, "");
logger.info("worker node : {} registry to ZK {} successfully", address, workerZKPath);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,616 | [Bug] [Worker] Worker fakes death when it stop itself fail. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I try a stress test, I found that worker fakes death and print nothing to log file. At the same time, worker is not exist in zk node path and Master can't dispatch task because no worker.
That's the log before worker stop:
```
[ERROR] 2021-10-15 15:10:57.590 org.apache.dolphinscheduler.server.worker.WorkerServer:[223] - worker server stop exception
org.apache.dolphinscheduler.spi.register.RegistryException: zookeeper delete key error
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.delete(ZookeeperRegistry.java:272)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.remove(ZookeeperRegistry.java:199)
at org.apache.dolphinscheduler.service.registry.RegistryCenter.remove(RegistryCenter.java:157)
at org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient.unRegistry(WorkerRegistryClient.java:128)
at org.apache.dolphinscheduler.server.worker.WorkerServer.close(WorkerServer.java:219)
at org.apache.dolphinscheduler.server.worker.WorkerServer.stop(WorkerServer.java:229)
at org.apache.dolphinscheduler.server.registry.HeartBeatTask.run(HeartBeatTask.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /dolphinscheduler/nodes/worker/default/172.28.132.15:1234
at org.apache.zookeeper.KeeperException.create(KeeperException.java:102)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:54)
at org.apache.zookeeper.ZooKeeper.delete(ZooKeeper.java:882)
at org.apache.curator.framework.imps.DeleteBuilderImpl$5.call(DeleteBuilderImpl.java:274)
at org.apache.curator.framework.imps.DeleteBuilderImpl$5.call(DeleteBuilderImpl.java:268)
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.DeleteBuilderImpl.pathInForeground(DeleteBuilderImpl.java:265)
at org.apache.curator.framework.imps.DeleteBuilderImpl.forPath(DeleteBuilderImpl.java:249)
at org.apache.curator.framework.imps.DeleteBuilderImpl.forPath(DeleteBuilderImpl.java:34)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.delete(ZookeeperRegistry.java:267)
... 13 common frames omitted
```
Maybe set stop single to true after close zk and netty successfully is better.
### What you expected to happen
worker can stop itself successfully when it is judged dead server.
### How to reproduce
do some stress test with many task running.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6616 | https://github.com/apache/dolphinscheduler/pull/6621 | 03aaef0fe6548e828144e6e5ac8ceb8bd6b650ad | 06e8e24708e2c2a2b9367b9e76a4dc0cec4cdfc6 | "2021-10-27T10:10:53Z" | java | "2021-10-29T09:44:06Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/registry/WorkerRegistryClient.java | HeartBeatTask heartBeatTask = new HeartBeatTask(startupTime,
workerConfig.getWorkerMaxCpuloadAvg(),
workerConfig.getWorkerReservedMemory(),
workerConfig.getHostWeight(),
workerZkPaths,
Constants.WORKER_TYPE,
registryClient,
workerConfig.getWorkerExecThreads(),
workerManagerThread
);
this.heartBeatExecutor.scheduleAtFixedRate(heartBeatTask, workerHeartbeatInterval, workerHeartbeatInterval, TimeUnit.SECONDS);
logger.info("worker node : {} heartbeat interval {} s", address, workerHeartbeatInterval);
}
/**
* remove registry info
*/
public void unRegistry() {
String address = getLocalAddress();
Set<String> workerZkPaths = getWorkerZkPaths();
for (String workerZkPath : workerZkPaths) {
registryClient.remove(workerZkPath);
logger.info("worker node : {} unRegistry from ZK {}.", address, workerZkPath);
}
this.heartBeatExecutor.shutdownNow();
logger.info("heartbeat executor shutdown");
registryClient.close();
}
/**
* get worker path
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,616 | [Bug] [Worker] Worker fakes death when it stop itself fail. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I try a stress test, I found that worker fakes death and print nothing to log file. At the same time, worker is not exist in zk node path and Master can't dispatch task because no worker.
That's the log before worker stop:
```
[ERROR] 2021-10-15 15:10:57.590 org.apache.dolphinscheduler.server.worker.WorkerServer:[223] - worker server stop exception
org.apache.dolphinscheduler.spi.register.RegistryException: zookeeper delete key error
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.delete(ZookeeperRegistry.java:272)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.remove(ZookeeperRegistry.java:199)
at org.apache.dolphinscheduler.service.registry.RegistryCenter.remove(RegistryCenter.java:157)
at org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient.unRegistry(WorkerRegistryClient.java:128)
at org.apache.dolphinscheduler.server.worker.WorkerServer.close(WorkerServer.java:219)
at org.apache.dolphinscheduler.server.worker.WorkerServer.stop(WorkerServer.java:229)
at org.apache.dolphinscheduler.server.registry.HeartBeatTask.run(HeartBeatTask.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /dolphinscheduler/nodes/worker/default/172.28.132.15:1234
at org.apache.zookeeper.KeeperException.create(KeeperException.java:102)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:54)
at org.apache.zookeeper.ZooKeeper.delete(ZooKeeper.java:882)
at org.apache.curator.framework.imps.DeleteBuilderImpl$5.call(DeleteBuilderImpl.java:274)
at org.apache.curator.framework.imps.DeleteBuilderImpl$5.call(DeleteBuilderImpl.java:268)
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.DeleteBuilderImpl.pathInForeground(DeleteBuilderImpl.java:265)
at org.apache.curator.framework.imps.DeleteBuilderImpl.forPath(DeleteBuilderImpl.java:249)
at org.apache.curator.framework.imps.DeleteBuilderImpl.forPath(DeleteBuilderImpl.java:34)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperRegistry.delete(ZookeeperRegistry.java:267)
... 13 common frames omitted
```
Maybe set stop single to true after close zk and netty successfully is better.
### What you expected to happen
worker can stop itself successfully when it is judged dead server.
### How to reproduce
do some stress test with many task running.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6616 | https://github.com/apache/dolphinscheduler/pull/6621 | 03aaef0fe6548e828144e6e5ac8ceb8bd6b650ad | 06e8e24708e2c2a2b9367b9e76a4dc0cec4cdfc6 | "2021-10-27T10:10:53Z" | java | "2021-10-29T09:44:06Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/registry/WorkerRegistryClient.java | public Set<String> getWorkerZkPaths() {
Set<String> workerPaths = Sets.newHashSet();
String address = getLocalAddress();
for (String workGroup : this.workerGroups) {
StringJoiner workerPathJoiner = new StringJoiner(SINGLE_SLASH);
workerPathJoiner.add(REGISTRY_DOLPHINSCHEDULER_WORKERS);
if (StringUtils.isEmpty(workGroup)) {
workGroup = DEFAULT_WORKER_GROUP;
}
workerPathJoiner.add(workGroup.trim().toLowerCase());
workerPathJoiner.add(address);
workerPaths.add(workerPathJoiner.toString());
}
return workerPaths;
}
public void handleDeadServer(Set<String> nodeSet, NodeType nodeType, String opType) throws Exception {
registryClient.handleDeadServer(nodeSet, nodeType, opType);
}
/**
* get local address
*/
private String getLocalAddress() {
return NetUtils.getAddr(workerConfig.getListenPort());
}
public void setRegistryStoppable(IStoppable stoppable) {
registryClient.setStoppable(stoppable);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/CommandType.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.remote.command;
public enum CommandType {
/**
* remove task log request,
*/
REMOVE_TAK_LOG_REQUEST,
/**
* remove task log response |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/CommandType.java | */
REMOVE_TAK_LOG_RESPONSE,
/**
* roll view log request
*/
ROLL_VIEW_LOG_REQUEST,
/**
* roll view log response
*/
ROLL_VIEW_LOG_RESPONSE,
/**
* view whole log request
*/
VIEW_WHOLE_LOG_REQUEST,
/**
* view whole log response
*/
VIEW_WHOLE_LOG_RESPONSE,
/**
* get log bytes request
*/
GET_LOG_BYTES_REQUEST,
/**
* get log bytes response
*/
GET_LOG_BYTES_RESPONSE,
WORKER_REQUEST,
MASTER_RESPONSE,
/**
* execute task request |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/CommandType.java | */
TASK_EXECUTE_REQUEST,
/**
* execute task ack
*/
TASK_EXECUTE_ACK,
/**
* execute task response
*/
TASK_EXECUTE_RESPONSE,
/**
* db task ack
*/
DB_TASK_ACK,
/**
* db task response
*/
DB_TASK_RESPONSE,
/**
* kill task
*/
TASK_KILL_REQUEST,
/**
* kill task response
*/
TASK_KILL_RESPONSE,
/**
* HEART_BEAT
*/
HEART_BEAT, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/CommandType.java | /**
* ping
*/
PING,
/**
* pong
*/
PONG,
/**
* alert send request
*/
ALERT_SEND_REQUEST,
/**
* alert send response
*/
ALERT_SEND_RESPONSE,
/**
* process host update
*/
PROCESS_HOST_UPDATE_REQUST,
/**
* process host update response
*/
PROCESS_HOST_UPDATE_RESPONSE,
/**
* state event request
*/
STATE_EVENT_REQUEST;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/HostUpdateCommand.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.remote.command;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import java.io.Serializable;
/**
* process host update
*/
public class HostUpdateCommand implements Serializable { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/HostUpdateCommand.java | /**
* task id
*/
private int taskInstanceId;
private String processHost;
public int getTaskInstanceId() {
return taskInstanceId;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/HostUpdateCommand.java | public void setTaskInstanceId(int taskInstanceId) {
this.taskInstanceId = taskInstanceId;
}
public String getProcessHost() {
return processHost;
}
public void setProcessHost(String processHost) {
this.processHost = processHost;
}
/**
* package request command
*
* @return command
*/
public Command convert2Command() {
Command command = new Command();
command.setType(CommandType.PROCESS_HOST_UPDATE_REQUST);
byte[] body = JSONUtils.toJsonByteArray(this);
command.setBody(body);
return command;
}
@Override
public String toString() {
return "HostUpdateCommand{"
+ "taskInstanceId=" + taskInstanceId
+ "host=" + processHost
+ '}';
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/HostUpdateResponseCommand.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.remote.command;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import java.io.Serializable;
public class HostUpdateResponseCommand implements Serializable { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/HostUpdateResponseCommand.java | private int taskInstanceId;
private String processHost;
private int status;
public HostUpdateResponseCommand(int taskInstanceId, String processHost, int code) {
this.taskInstanceId = taskInstanceId;
this.processHost = processHost;
this.status = code;
}
public int getTaskInstanceId() {
return this.taskInstanceId;
}
public void setTaskInstanceId(int taskInstanceId) {
this.taskInstanceId = taskInstanceId;
}
public String getProcessHost() {
return this.processHost;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/HostUpdateResponseCommand.java | public void setProcessHost(String processHost) {
this.processHost = processHost;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
/**
* package request command
*
* @return command
*/
public Command convert2Command() {
Command command = new Command();
command.setType(CommandType.PROCESS_HOST_UPDATE_REQUST);
byte[] body = JSONUtils.toJsonByteArray(this);
command.setBody(body);
return command;
}
@Override
public String toString() {
return "HostUpdateResponseCommand{"
+ "taskInstanceId=" + taskInstanceId
+ "host=" + processHost
+ '}';
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | 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.NodeType;
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; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java | import org.apache.dolphinscheduler.server.worker.plugin.TaskPluginManager;
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.WorkerRegistryClient;
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 org.apache.dolphinscheduler.spi.exception.PluginNotFoundException;
import org.apache.dolphinscheduler.spi.plugin.DolphinPluginLoader;
import org.apache.dolphinscheduler.spi.plugin.DolphinPluginManagerConfig;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import org.apache.commons.collections4.MapUtils;
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;
import org.springframework.context.annotation.FilterType;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import com.facebook.presto.jdbc.internal.guava.collect.ImmutableList;
/**
* worker server
*/
@ComponentScan(value = "org.apache.dolphinscheduler", excludeFilters = { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java | @ComponentScan.Filter(type = FilterType.REGEX, pattern = {
"org.apache.dolphinscheduler.server.master.*",
"org.apache.dolphinscheduler.server.monitor.*",
"org.apache.dolphinscheduler.server.log.*"
})
})
@EnableTransactionManagement
public class WorkerServer implements IStoppable {
/**
* logger
*/
private static final Logger logger = LoggerFactory.getLogger(WorkerServer.class);
/**
* netty remote server
*/
private NettyRemotingServer nettyRemotingServer;
/**
* worker config
*/
@Autowired
private WorkerConfig workerConfig;
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java | * 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 registry
*/
@Autowired
private WorkerRegistryClient workerRegistryClient;
private TaskPluginManager taskPluginManager;
/**
* worker server startup, 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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java | */
@PostConstruct
public void run() {
alertClientService = new AlertClientService(workerConfig.getAlertListenHost(), Constants.ALERT_RPC_PORT);
initTaskPlugin();
NettyServerConfig serverConfig = new NettyServerConfig();
serverConfig.setListenPort(workerConfig.getListenPort());
this.nettyRemotingServer = new NettyRemotingServer(serverConfig);
this.nettyRemotingServer.registerProcessor(CommandType.TASK_EXECUTE_REQUEST, new TaskExecuteProcessor(alertClientService, taskPluginManager));
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();
try {
this.workerRegistryClient.registry();
this.workerRegistryClient.setRegistryStoppable(this);
Set<String> workerZkPaths = this.workerRegistryClient.getWorkerZkPaths();
this.workerRegistryClient.handleDeadServer(workerZkPaths, NodeType.WORKER, Constants.DELETE_OP);
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RuntimeException(e);
}
this.workerManagerThread.start();
this.retryReportTaskStatusThread.start(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java | /**
* registry hooks, which are called before the process exits
*/
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
if (Stopper.isRunning()) {
close("shutdownHook");
}
}));
}
private void initTaskPlugin() {
taskPluginManager = new TaskPluginManager();
DolphinPluginManagerConfig taskPluginManagerConfig = new DolphinPluginManagerConfig();
taskPluginManagerConfig.setPlugins(workerConfig.getTaskPluginBinding());
if (StringUtils.isNotBlank(workerConfig.getTaskPluginDir())) {
taskPluginManagerConfig.setInstalledPluginsDir(workerConfig.getTaskPluginDir().trim());
}
if (StringUtils.isNotBlank(workerConfig.getMavenLocalRepository())) {
taskPluginManagerConfig.setMavenLocalRepository(workerConfig.getMavenLocalRepository().trim());
}
DolphinPluginLoader taskPluginLoader = new DolphinPluginLoader(taskPluginManagerConfig, ImmutableList.of(taskPluginManager));
try {
taskPluginLoader.loadPlugins();
} catch (Exception e) {
throw new RuntimeException("Load Task Plugin Failed !", e);
}
if (MapUtils.isEmpty(taskPluginManager.getTaskChannelMap())) {
throw new PluginNotFoundException("Task Plugin Not Found,Please Check Config File");
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java | public void close(String cause) {
try {
if (Stopper.isStopped()) {
return;
}
logger.info("worker server is stopping ..., cause : {}", cause);
Stopper.stop();
try {
Thread.sleep(3000L);
} catch (Exception e) {
logger.warn("thread sleep exception", e);
}
this.nettyRemotingServer.close();
this.workerRegistryClient.unRegistry();
this.alertClientService.close();
this.springApplicationContext.close();
} catch (Exception e) {
logger.error("worker server stop exception ", e);
}
}
@Override
public void stop(String cause) {
close(cause);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/HostUpdateProcessor.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.processor;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.remote.command.Command;
import org.apache.dolphinscheduler.remote.command.CommandType; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,640 | [Bug] [WorkerServer] PROCESS_HOST_UPDATE_REQUST command not support | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Version: 2.0.0-alpha
When Master server restart, the worker receive PROCESS_HOST_UPDATE_REQUST command but not support.
### What you expected to happen
Worker can handle this command type normally.
### How to reproduce
run the task and restart the master server.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6640 | https://github.com/apache/dolphinscheduler/pull/6642 | dd6ed36f65d2add3bf8e31cad24ab25f4606c9d9 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | "2021-10-29T12:27:51Z" | java | "2021-10-31T13:10:51Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/HostUpdateProcessor.java | import org.apache.dolphinscheduler.remote.command.HostUpdateCommand;
import org.apache.dolphinscheduler.remote.processor.NettyRemoteChannel;
import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import io.netty.channel.Channel;
/**
* update process host
* this used when master failover
*/
public class HostUpdateProcessor implements NettyRequestProcessor {
private final Logger logger = LoggerFactory.getLogger(HostUpdateProcessor.class);
/**
* task callback service
*/
private final TaskCallbackService taskCallbackService;
public HostUpdateProcessor() {
this.taskCallbackService = SpringApplicationContext.getBean(TaskCallbackService.class);
}
@Override
public void process(Channel channel, Command command) {
Preconditions.checkArgument(CommandType.PROCESS_HOST_UPDATE_REQUST == command.getType(), String.format("invalid command type : %s", command.getType()));
HostUpdateCommand updateCommand = JSONUtils.parseObject(command.getBody(), HostUpdateCommand.class);
logger.info("received host update command : {}", updateCommand);
taskCallbackService.changeRemoteChannel(updateCommand.getTaskInstanceId(), new NettyRemoteChannel(channel, command.getOpaque()));
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,638 | [Bug] [MasterServer] task state no change when failover worker | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
version: 2.0-alpha
The task state is always running when I stop the worker.
I try to debug in failoverWorker and found the judge conditions error.
### What you expected to happen
After stop the worker, the task will change state and no always running.
### How to reproduce
run a long time task and stop the worker.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6638 | https://github.com/apache/dolphinscheduler/pull/6639 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | ae0b18f3a3284357f7533c015086cd65f27caca5 | "2021-10-29T10:43:07Z" | java | "2021-10-31T13:12:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.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.registry;
import static org.apache.dolphinscheduler.common.Constants.REGISTRY_DOLPHINSCHEDULER_MASTERS;
import static org.apache.dolphinscheduler.common.Constants.REGISTRY_DOLPHINSCHEDULER_NODE;
import static org.apache.dolphinscheduler.common.Constants.SLEEP_TIME_MILLIS;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.IStoppable;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.enums.NodeType;
import org.apache.dolphinscheduler.common.enums.StateEvent;
import org.apache.dolphinscheduler.common.enums.StateEventType;
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.dao.entity.ProcessInstance; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,638 | [Bug] [MasterServer] task state no change when failover worker | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
version: 2.0-alpha
The task state is always running when I stop the worker.
I try to debug in failoverWorker and found the judge conditions error.
### What you expected to happen
After stop the worker, the task will change state and no always running.
### How to reproduce
run a long time task and stop the worker.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6638 | https://github.com/apache/dolphinscheduler/pull/6639 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | ae0b18f3a3284357f7533c015086cd65f27caca5 | "2021-10-29T10:43:07Z" | java | "2021-10-31T13:12:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.remote.utils.NamedThreadFactory;
import org.apache.dolphinscheduler.server.builder.TaskExecutionContextBuilder;
import org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThread;
import org.apache.dolphinscheduler.server.registry.HeartBeatTask;
import org.apache.dolphinscheduler.server.utils.ProcessUtils;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.queue.entity.TaskExecutionContext;
import org.apache.dolphinscheduler.service.registry.RegistryClient;
import org.apache.dolphinscheduler.spi.register.RegistryConnectListener;
import org.apache.dolphinscheduler.spi.register.RegistryConnectState;
import org.apache.commons.lang.StringUtils;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.google.common.collect.Sets;
/**
* zookeeper master client
* <p>
* single instance
*/
@Component |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,638 | [Bug] [MasterServer] task state no change when failover worker | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
version: 2.0-alpha
The task state is always running when I stop the worker.
I try to debug in failoverWorker and found the judge conditions error.
### What you expected to happen
After stop the worker, the task will change state and no always running.
### How to reproduce
run a long time task and stop the worker.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6638 | https://github.com/apache/dolphinscheduler/pull/6639 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | ae0b18f3a3284357f7533c015086cd65f27caca5 | "2021-10-29T10:43:07Z" | java | "2021-10-31T13:12:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | public class MasterRegistryClient {
/**
* logger
*/
private static final Logger logger = LoggerFactory.getLogger(MasterRegistryClient.class);
/**
* process service
*/
@Autowired
private ProcessService processService;
private RegistryClient registryClient;
/**
* master config |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,638 | [Bug] [MasterServer] task state no change when failover worker | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
version: 2.0-alpha
The task state is always running when I stop the worker.
I try to debug in failoverWorker and found the judge conditions error.
### What you expected to happen
After stop the worker, the task will change state and no always running.
### How to reproduce
run a long time task and stop the worker.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6638 | https://github.com/apache/dolphinscheduler/pull/6639 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | ae0b18f3a3284357f7533c015086cd65f27caca5 | "2021-10-29T10:43:07Z" | java | "2021-10-31T13:12:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | */
@Autowired
private MasterConfig masterConfig;
/**
* heartbeat executor
*/
private ScheduledExecutorService heartBeatExecutor;
@Autowired
private ProcessInstanceExecCacheManager processInstanceExecCacheManager;
/**
* master startup time, ms
*/
private long startupTime;
private String localNodePath;
public void init() {
this.startupTime = System.currentTimeMillis();
this.registryClient = RegistryClient.getInstance();
this.heartBeatExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("HeartBeatExecutor"));
}
public void start() {
String nodeLock = registryClient.getMasterStartUpLockPath();
try {
registryClient.getLock(nodeLock);
registry();
String registryPath = getMasterPath();
registryClient.handleDeadServer(registryPath, NodeType.MASTER, Constants.DELETE_OP);
while (!registryClient.checkNodeExists(NetUtils.getHost(), NodeType.MASTER)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,638 | [Bug] [MasterServer] task state no change when failover worker | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
version: 2.0-alpha
The task state is always running when I stop the worker.
I try to debug in failoverWorker and found the judge conditions error.
### What you expected to happen
After stop the worker, the task will change state and no always running.
### How to reproduce
run a long time task and stop the worker.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6638 | https://github.com/apache/dolphinscheduler/pull/6639 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | ae0b18f3a3284357f7533c015086cd65f27caca5 | "2021-10-29T10:43:07Z" | java | "2021-10-31T13:12:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | ThreadUtils.sleep(SLEEP_TIME_MILLIS);
}
if (registryClient.getActiveMasterNum() == 1) {
removeNodePath(null, NodeType.MASTER, true);
removeNodePath(null, NodeType.WORKER, true);
}
registryClient.subscribe(REGISTRY_DOLPHINSCHEDULER_NODE, new MasterRegistryDataListener());
} catch (Exception e) {
logger.error("master start up exception", e);
} finally {
registryClient.releaseLock(nodeLock);
}
}
public void setRegistryStoppable(IStoppable stoppable) {
registryClient.setStoppable(stoppable);
}
public void closeRegistry() {
unRegistry();
}
/**
* remove zookeeper node path
*
* @param path zookeeper node path
* @param nodeType zookeeper node type
* @param failover is failover
*/
public void removeNodePath(String path, NodeType nodeType, boolean failover) {
logger.info("{} node deleted : {}", nodeType, path);
String failoverPath = getFailoverLockPath(nodeType); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,638 | [Bug] [MasterServer] task state no change when failover worker | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
version: 2.0-alpha
The task state is always running when I stop the worker.
I try to debug in failoverWorker and found the judge conditions error.
### What you expected to happen
After stop the worker, the task will change state and no always running.
### How to reproduce
run a long time task and stop the worker.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6638 | https://github.com/apache/dolphinscheduler/pull/6639 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | ae0b18f3a3284357f7533c015086cd65f27caca5 | "2021-10-29T10:43:07Z" | java | "2021-10-31T13:12:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | try {
registryClient.getLock(failoverPath);
String serverHost = null;
if (!StringUtils.isEmpty(path)) {
serverHost = registryClient.getHostByEventDataPath(path);
if (StringUtils.isEmpty(serverHost)) {
logger.error("server down error: unknown path: {}", path);
return;
}
registryClient.handleDeadServer(path, nodeType, Constants.ADD_OP);
}
if (failover) {
failoverServerWhenDown(serverHost, nodeType);
}
} catch (Exception e) {
logger.error("{} server failover failed.", nodeType);
logger.error("failover exception ", e);
} finally {
registryClient.releaseLock(failoverPath);
}
}
/**
* failover server when server down
*
* @param serverHost server host
* @param nodeType zookeeper node type
*/
private void failoverServerWhenDown(String serverHost, NodeType nodeType) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,638 | [Bug] [MasterServer] task state no change when failover worker | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
version: 2.0-alpha
The task state is always running when I stop the worker.
I try to debug in failoverWorker and found the judge conditions error.
### What you expected to happen
After stop the worker, the task will change state and no always running.
### How to reproduce
run a long time task and stop the worker.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6638 | https://github.com/apache/dolphinscheduler/pull/6639 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | ae0b18f3a3284357f7533c015086cd65f27caca5 | "2021-10-29T10:43:07Z" | java | "2021-10-31T13:12:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | switch (nodeType) {
case MASTER:
failoverMaster(serverHost);
break;
case WORKER:
failoverWorker(serverHost, true, true);
break;
default:
break;
}
}
/**
* get failover lock path
*
* @param nodeType zookeeper node type
* @return fail over lock path
*/
private String getFailoverLockPath(NodeType nodeType) {
switch (nodeType) {
case MASTER:
return registryClient.getMasterFailoverLockPath();
case WORKER:
return registryClient.getWorkerFailoverLockPath();
default:
return "";
}
}
/**
* task needs failover if task start before worker starts
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,638 | [Bug] [MasterServer] task state no change when failover worker | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
version: 2.0-alpha
The task state is always running when I stop the worker.
I try to debug in failoverWorker and found the judge conditions error.
### What you expected to happen
After stop the worker, the task will change state and no always running.
### How to reproduce
run a long time task and stop the worker.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6638 | https://github.com/apache/dolphinscheduler/pull/6639 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | ae0b18f3a3284357f7533c015086cd65f27caca5 | "2021-10-29T10:43:07Z" | java | "2021-10-31T13:12:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | * @param taskInstance task instance
* @return true if task instance need fail over
*/
private boolean checkTaskInstanceNeedFailover(TaskInstance taskInstance) {
boolean taskNeedFailover = true;
if (taskInstance.getHost() == null) {
return false;
}
if (registryClient.checkNodeExists(taskInstance.getHost(), NodeType.WORKER)) {
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 = registryClient.getServerList(NodeType.WORKER); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,638 | [Bug] [MasterServer] task state no change when failover worker | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
version: 2.0-alpha
The task state is always running when I stop the worker.
I try to debug in failoverWorker and found the judge conditions error.
### What you expected to happen
After stop the worker, the task will change state and no always running.
### How to reproduce
run a long time task and stop the worker.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6638 | https://github.com/apache/dolphinscheduler/pull/6639 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | ae0b18f3a3284357f7533c015086cd65f27caca5 | "2021-10-29T10:43:07Z" | java | "2021-10-31T13:12:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | 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
*/
private void failoverWorker(String workerHost, boolean needCheckWorkerAlive, boolean checkOwner) {
logger.info("start worker[{}] failover ...", workerHost);
List<TaskInstance> needFailoverTaskInstanceList = processService.queryNeedFailoverTaskInstances(workerHost);
for (TaskInstance taskInstance : needFailoverTaskInstanceList) {
if (needCheckWorkerAlive) {
if (!checkTaskInstanceNeedFailover(taskInstance)) {
continue;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,638 | [Bug] [MasterServer] task state no change when failover worker | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
version: 2.0-alpha
The task state is always running when I stop the worker.
I try to debug in failoverWorker and found the judge conditions error.
### What you expected to happen
After stop the worker, the task will change state and no always running.
### How to reproduce
run a long time task and stop the worker.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6638 | https://github.com/apache/dolphinscheduler/pull/6639 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | ae0b18f3a3284357f7533c015086cd65f27caca5 | "2021-10-29T10:43:07Z" | java | "2021-10-31T13:12:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | ProcessInstance processInstance = processService.findProcessInstanceDetailById(taskInstance.getProcessInstanceId());
if (workerHost == null
|| !checkOwner
|| processInstance.getHost().equalsIgnoreCase(workerHost)) {
if (processInstance == null) {
logger.error("failover error, the process {} of task {} do not exists.",
taskInstance.getProcessInstanceId(), taskInstance.getId());
continue;
}
taskInstance.setProcessInstance(processInstance);
TaskExecutionContext taskExecutionContext = TaskExecutionContextBuilder.get()
.buildTaskInstanceRelatedInfo(taskInstance)
.buildProcessInstanceRelatedInfo(processInstance)
.create();
ProcessUtils.killYarnJob(taskExecutionContext);
taskInstance.setState(ExecutionStatus.NEED_FAULT_TOLERANCE);
processService.saveTaskInstance(taskInstance);
if (!processInstanceExecCacheManager.contains(processInstance.getId())) {
return;
}
WorkflowExecuteThread workflowExecuteThreadNotify = processInstanceExecCacheManager.getByProcessInstanceId(processInstance.getId());
StateEvent stateEvent = new StateEvent();
stateEvent.setTaskInstanceId(taskInstance.getId());
stateEvent.setType(StateEventType.TASK_STATE_CHANGE);
stateEvent.setProcessInstanceId(processInstance.getId());
stateEvent.setExecutionStatus(taskInstance.getState());
workflowExecuteThreadNotify.addStateEvent(stateEvent); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,638 | [Bug] [MasterServer] task state no change when failover worker | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
version: 2.0-alpha
The task state is always running when I stop the worker.
I try to debug in failoverWorker and found the judge conditions error.
### What you expected to happen
After stop the worker, the task will change state and no always running.
### How to reproduce
run a long time task and stop the worker.
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/6638 | https://github.com/apache/dolphinscheduler/pull/6639 | 8850baff07cc5174a57a0560cbeeb1a3368a4dca | ae0b18f3a3284357f7533c015086cd65f27caca5 | "2021-10-29T10:43:07Z" | java | "2021-10-31T13:12:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | }
}
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());
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);
}
failoverWorker(masterHost, true, false);
logger.info("master failover end");
}
public void blockAcquireMutex() {
registryClient.getLock(registryClient.getMasterLockPath());
}
public void releaseLock() {
registryClient.releaseLock(registryClient.getMasterLockPath());
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.