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 | 4,314 | [Question] dolphinscheduler cannot get the YARN address | The task is submitted and run successfully, but dolphinscheduler reports that the task status failed
After querying the log, it is found that the obtained yarn address is null, but the hosts and common are configured normally, and the yarn node is normally accessed
任务提交并运行成功,但dolphinscheduler报告任务状态失败
查询日志后发现获取到的yarn地址为null,但hosts与common均配置正常,且yarn节点正常访问
hosts
```properties
192.169.199.105 hdnn01
192.168.199.106 hdnn02
192.168.199.107 hdnn03
```
common.properties
```properties
# if resourcemanager HA enable, please type the HA ips ; if resourcemanager is single, make this value empty
yarn.resourcemanager.ha.rm.ids=hdnn01,hdnn02,hdnn03
# if resourcemanager HA enable or not use resourcemanager, please keep the default value; If resourcemanager is single, you only need to replace ds1 to actual resourcemanager hostname.
yarn.application.status.address=http://yarnIp1:8088/ws/v1/cluster/apps/%s
```
dolphinscheduler-worker.log
```
[INFO] 2020-12-25 18:17:30.759 - [taskAppId=TASK-3-4-17]:[193] - process start, process id is: 107032
[INFO] 2020-12-25 18:18:52.502 - [taskAppId=TASK-3-4-17]:[202] - process has exited, execute path:/tmp/dolphinscheduler/exec/process/1/3/4/17, processId:107032 ,exitStatusCode:0
[INFO] 2020-12-25 18:18:52.504 - [taskAppId=TASK-3-4-17]:[419] - find app id: application_1608880603127_0014
[INFO] 2020-12-25 18:18:52.576 org.apache.dolphinscheduler.common.utils.HadoopUtils:[144] - get property:fs.defaultFS -> hdfs://hdcluster, from core-site.xml hdfs-site.xml
[INFO] 2020-12-25 18:19:09.220 org.apache.dolphinscheduler.common.utils.HadoopUtils:[206] - application url : http://null:8088/ws/v1/cluster/apps/%s
[ERROR] 2020-12-25 18:19:24.259 org.apache.dolphinscheduler.common.utils.HttpUtils:[73] - null: Name or service not known
java.net.UnknownHostException: null: Name or service not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
at org.apache.dolphinscheduler.common.utils.HttpUtils.get(HttpUtils.java:60)
at org.apache.dolphinscheduler.common.utils.HadoopUtils.getApplicationStatus(HadoopUtils.java:412)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.isSuccessOfYarnState(AbstractCommandExecutor.java:378)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.run(AbstractCommandExecutor.java:218)
at org.apache.dolphinscheduler.server.worker.task.AbstractYarnTask.handle(AbstractYarnTask.java:57)
at org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
[ERROR] 2020-12-25 18:19:24.260 - [taskAppId=TASK-3-4-17]:[392] - yarn applications: [application_1608880603127_0014] status failed
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.common.utils.HadoopUtils.getApplicationStatus(HadoopUtils.java:415)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.isSuccessOfYarnState(AbstractCommandExecutor.java:378)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.run(AbstractCommandExecutor.java:218)
at org.apache.dolphinscheduler.server.worker.task.AbstractYarnTask.handle(AbstractYarnTask.java:57)
at org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
[INFO] 2020-12-25 18:19:24.261 org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread:[137] - task instance id : 17,task final status : FAILURE
``` | https://github.com/apache/dolphinscheduler/issues/4314 | https://github.com/apache/dolphinscheduler/pull/4344 | b9e8dbed2f9dd29f51b30411f80bc92a0ca04c06 | ccd06fec16bae7da97bc4f61c45d4b471dccebc4 | "2020-12-26T06:57:41Z" | java | "2020-12-30T03:03:36Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | * @param tenantCode tenant code
* @return get udf dir on hdfs
*/
public static String getHdfsUdfDir(String tenantCode) {
return String.format("%s/udfs", getHdfsTenantDir(tenantCode));
}
/**
* get hdfs file name
*
* @param resourceType resource type
* @param tenantCode tenant code
* @param fileName file name
* @return hdfs file name
*/
public static String getHdfsFileName(ResourceType resourceType, String tenantCode, String fileName) {
if (fileName.startsWith("/")) {
fileName = fileName.replaceFirst("/", "");
}
return String.format("%s/%s", getHdfsDir(resourceType, tenantCode), fileName);
}
/**
* get absolute path and name for resource file on hdfs
*
* @param tenantCode tenant code
* @param fileName file name
* @return get absolute path and name for file on hdfs
*/
public static String getHdfsResourceFileName(String tenantCode, String fileName) {
if (fileName.startsWith("/")) {
fileName = fileName.replaceFirst("/", ""); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,314 | [Question] dolphinscheduler cannot get the YARN address | The task is submitted and run successfully, but dolphinscheduler reports that the task status failed
After querying the log, it is found that the obtained yarn address is null, but the hosts and common are configured normally, and the yarn node is normally accessed
任务提交并运行成功,但dolphinscheduler报告任务状态失败
查询日志后发现获取到的yarn地址为null,但hosts与common均配置正常,且yarn节点正常访问
hosts
```properties
192.169.199.105 hdnn01
192.168.199.106 hdnn02
192.168.199.107 hdnn03
```
common.properties
```properties
# if resourcemanager HA enable, please type the HA ips ; if resourcemanager is single, make this value empty
yarn.resourcemanager.ha.rm.ids=hdnn01,hdnn02,hdnn03
# if resourcemanager HA enable or not use resourcemanager, please keep the default value; If resourcemanager is single, you only need to replace ds1 to actual resourcemanager hostname.
yarn.application.status.address=http://yarnIp1:8088/ws/v1/cluster/apps/%s
```
dolphinscheduler-worker.log
```
[INFO] 2020-12-25 18:17:30.759 - [taskAppId=TASK-3-4-17]:[193] - process start, process id is: 107032
[INFO] 2020-12-25 18:18:52.502 - [taskAppId=TASK-3-4-17]:[202] - process has exited, execute path:/tmp/dolphinscheduler/exec/process/1/3/4/17, processId:107032 ,exitStatusCode:0
[INFO] 2020-12-25 18:18:52.504 - [taskAppId=TASK-3-4-17]:[419] - find app id: application_1608880603127_0014
[INFO] 2020-12-25 18:18:52.576 org.apache.dolphinscheduler.common.utils.HadoopUtils:[144] - get property:fs.defaultFS -> hdfs://hdcluster, from core-site.xml hdfs-site.xml
[INFO] 2020-12-25 18:19:09.220 org.apache.dolphinscheduler.common.utils.HadoopUtils:[206] - application url : http://null:8088/ws/v1/cluster/apps/%s
[ERROR] 2020-12-25 18:19:24.259 org.apache.dolphinscheduler.common.utils.HttpUtils:[73] - null: Name or service not known
java.net.UnknownHostException: null: Name or service not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
at org.apache.dolphinscheduler.common.utils.HttpUtils.get(HttpUtils.java:60)
at org.apache.dolphinscheduler.common.utils.HadoopUtils.getApplicationStatus(HadoopUtils.java:412)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.isSuccessOfYarnState(AbstractCommandExecutor.java:378)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.run(AbstractCommandExecutor.java:218)
at org.apache.dolphinscheduler.server.worker.task.AbstractYarnTask.handle(AbstractYarnTask.java:57)
at org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
[ERROR] 2020-12-25 18:19:24.260 - [taskAppId=TASK-3-4-17]:[392] - yarn applications: [application_1608880603127_0014] status failed
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.common.utils.HadoopUtils.getApplicationStatus(HadoopUtils.java:415)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.isSuccessOfYarnState(AbstractCommandExecutor.java:378)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.run(AbstractCommandExecutor.java:218)
at org.apache.dolphinscheduler.server.worker.task.AbstractYarnTask.handle(AbstractYarnTask.java:57)
at org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
[INFO] 2020-12-25 18:19:24.261 org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread:[137] - task instance id : 17,task final status : FAILURE
``` | https://github.com/apache/dolphinscheduler/issues/4314 | https://github.com/apache/dolphinscheduler/pull/4344 | b9e8dbed2f9dd29f51b30411f80bc92a0ca04c06 | ccd06fec16bae7da97bc4f61c45d4b471dccebc4 | "2020-12-26T06:57:41Z" | java | "2020-12-30T03:03:36Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | }
return String.format("%s/%s", getHdfsResDir(tenantCode), fileName);
}
/**
* get absolute path and name for udf file on hdfs
*
* @param tenantCode tenant code
* @param fileName file name
* @return get absolute path and name for udf file on hdfs
*/
public static String getHdfsUdfFileName(String tenantCode, String fileName) {
if (fileName.startsWith("/")) {
fileName = fileName.replaceFirst("/", "");
}
return String.format("%s/%s", getHdfsUdfDir(tenantCode), fileName);
}
/**
* @param tenantCode tenant code
* @return file directory of tenants on hdfs
*/
public static String getHdfsTenantDir(String tenantCode) {
return String.format("%s/%s", getHdfsDataBasePath(), tenantCode);
}
/**
* getAppAddress
*
* @param appAddress app address
* @param rmHa resource manager ha
* @return app address
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,314 | [Question] dolphinscheduler cannot get the YARN address | The task is submitted and run successfully, but dolphinscheduler reports that the task status failed
After querying the log, it is found that the obtained yarn address is null, but the hosts and common are configured normally, and the yarn node is normally accessed
任务提交并运行成功,但dolphinscheduler报告任务状态失败
查询日志后发现获取到的yarn地址为null,但hosts与common均配置正常,且yarn节点正常访问
hosts
```properties
192.169.199.105 hdnn01
192.168.199.106 hdnn02
192.168.199.107 hdnn03
```
common.properties
```properties
# if resourcemanager HA enable, please type the HA ips ; if resourcemanager is single, make this value empty
yarn.resourcemanager.ha.rm.ids=hdnn01,hdnn02,hdnn03
# if resourcemanager HA enable or not use resourcemanager, please keep the default value; If resourcemanager is single, you only need to replace ds1 to actual resourcemanager hostname.
yarn.application.status.address=http://yarnIp1:8088/ws/v1/cluster/apps/%s
```
dolphinscheduler-worker.log
```
[INFO] 2020-12-25 18:17:30.759 - [taskAppId=TASK-3-4-17]:[193] - process start, process id is: 107032
[INFO] 2020-12-25 18:18:52.502 - [taskAppId=TASK-3-4-17]:[202] - process has exited, execute path:/tmp/dolphinscheduler/exec/process/1/3/4/17, processId:107032 ,exitStatusCode:0
[INFO] 2020-12-25 18:18:52.504 - [taskAppId=TASK-3-4-17]:[419] - find app id: application_1608880603127_0014
[INFO] 2020-12-25 18:18:52.576 org.apache.dolphinscheduler.common.utils.HadoopUtils:[144] - get property:fs.defaultFS -> hdfs://hdcluster, from core-site.xml hdfs-site.xml
[INFO] 2020-12-25 18:19:09.220 org.apache.dolphinscheduler.common.utils.HadoopUtils:[206] - application url : http://null:8088/ws/v1/cluster/apps/%s
[ERROR] 2020-12-25 18:19:24.259 org.apache.dolphinscheduler.common.utils.HttpUtils:[73] - null: Name or service not known
java.net.UnknownHostException: null: Name or service not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
at org.apache.dolphinscheduler.common.utils.HttpUtils.get(HttpUtils.java:60)
at org.apache.dolphinscheduler.common.utils.HadoopUtils.getApplicationStatus(HadoopUtils.java:412)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.isSuccessOfYarnState(AbstractCommandExecutor.java:378)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.run(AbstractCommandExecutor.java:218)
at org.apache.dolphinscheduler.server.worker.task.AbstractYarnTask.handle(AbstractYarnTask.java:57)
at org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
[ERROR] 2020-12-25 18:19:24.260 - [taskAppId=TASK-3-4-17]:[392] - yarn applications: [application_1608880603127_0014] status failed
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.common.utils.HadoopUtils.getApplicationStatus(HadoopUtils.java:415)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.isSuccessOfYarnState(AbstractCommandExecutor.java:378)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.run(AbstractCommandExecutor.java:218)
at org.apache.dolphinscheduler.server.worker.task.AbstractYarnTask.handle(AbstractYarnTask.java:57)
at org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
[INFO] 2020-12-25 18:19:24.261 org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread:[137] - task instance id : 17,task final status : FAILURE
``` | https://github.com/apache/dolphinscheduler/issues/4314 | https://github.com/apache/dolphinscheduler/pull/4344 | b9e8dbed2f9dd29f51b30411f80bc92a0ca04c06 | ccd06fec16bae7da97bc4f61c45d4b471dccebc4 | "2020-12-26T06:57:41Z" | java | "2020-12-30T03:03:36Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | public static String getAppAddress(String appAddress, String rmHa) {
String activeRM = YarnHAAdminUtils.getAcitveRMName(rmHa);
String[] split1 = appAddress.split(Constants.DOUBLE_SLASH);
if (split1.length != 2) {
return null;
}
String start = split1[0] + Constants.DOUBLE_SLASH;
String[] split2 = split1[1].split(Constants.COLON);
if (split2.length != 2) {
return null;
}
String end = Constants.COLON + split2[1];
return start + activeRM + end;
}
@Override
public void close() throws IOException {
if (fs != null) {
try {
fs.close();
} catch (IOException e) {
logger.error("Close HadoopUtils instance failed", e);
throw new IOException("Close HadoopUtils instance failed", e);
}
}
}
/**
* yarn ha admin utils
*/
private static final class YarnHAAdminUtils extends RMAdminCLI { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,314 | [Question] dolphinscheduler cannot get the YARN address | The task is submitted and run successfully, but dolphinscheduler reports that the task status failed
After querying the log, it is found that the obtained yarn address is null, but the hosts and common are configured normally, and the yarn node is normally accessed
任务提交并运行成功,但dolphinscheduler报告任务状态失败
查询日志后发现获取到的yarn地址为null,但hosts与common均配置正常,且yarn节点正常访问
hosts
```properties
192.169.199.105 hdnn01
192.168.199.106 hdnn02
192.168.199.107 hdnn03
```
common.properties
```properties
# if resourcemanager HA enable, please type the HA ips ; if resourcemanager is single, make this value empty
yarn.resourcemanager.ha.rm.ids=hdnn01,hdnn02,hdnn03
# if resourcemanager HA enable or not use resourcemanager, please keep the default value; If resourcemanager is single, you only need to replace ds1 to actual resourcemanager hostname.
yarn.application.status.address=http://yarnIp1:8088/ws/v1/cluster/apps/%s
```
dolphinscheduler-worker.log
```
[INFO] 2020-12-25 18:17:30.759 - [taskAppId=TASK-3-4-17]:[193] - process start, process id is: 107032
[INFO] 2020-12-25 18:18:52.502 - [taskAppId=TASK-3-4-17]:[202] - process has exited, execute path:/tmp/dolphinscheduler/exec/process/1/3/4/17, processId:107032 ,exitStatusCode:0
[INFO] 2020-12-25 18:18:52.504 - [taskAppId=TASK-3-4-17]:[419] - find app id: application_1608880603127_0014
[INFO] 2020-12-25 18:18:52.576 org.apache.dolphinscheduler.common.utils.HadoopUtils:[144] - get property:fs.defaultFS -> hdfs://hdcluster, from core-site.xml hdfs-site.xml
[INFO] 2020-12-25 18:19:09.220 org.apache.dolphinscheduler.common.utils.HadoopUtils:[206] - application url : http://null:8088/ws/v1/cluster/apps/%s
[ERROR] 2020-12-25 18:19:24.259 org.apache.dolphinscheduler.common.utils.HttpUtils:[73] - null: Name or service not known
java.net.UnknownHostException: null: Name or service not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
at org.apache.dolphinscheduler.common.utils.HttpUtils.get(HttpUtils.java:60)
at org.apache.dolphinscheduler.common.utils.HadoopUtils.getApplicationStatus(HadoopUtils.java:412)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.isSuccessOfYarnState(AbstractCommandExecutor.java:378)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.run(AbstractCommandExecutor.java:218)
at org.apache.dolphinscheduler.server.worker.task.AbstractYarnTask.handle(AbstractYarnTask.java:57)
at org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
[ERROR] 2020-12-25 18:19:24.260 - [taskAppId=TASK-3-4-17]:[392] - yarn applications: [application_1608880603127_0014] status failed
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.common.utils.HadoopUtils.getApplicationStatus(HadoopUtils.java:415)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.isSuccessOfYarnState(AbstractCommandExecutor.java:378)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.run(AbstractCommandExecutor.java:218)
at org.apache.dolphinscheduler.server.worker.task.AbstractYarnTask.handle(AbstractYarnTask.java:57)
at org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
[INFO] 2020-12-25 18:19:24.261 org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread:[137] - task instance id : 17,task final status : FAILURE
``` | https://github.com/apache/dolphinscheduler/issues/4314 | https://github.com/apache/dolphinscheduler/pull/4344 | b9e8dbed2f9dd29f51b30411f80bc92a0ca04c06 | ccd06fec16bae7da97bc4f61c45d4b471dccebc4 | "2020-12-26T06:57:41Z" | java | "2020-12-30T03:03:36Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | /**
* get active resourcemanager
*
* @param rmIds
* @return
*/
public static String getAcitveRMName(String rmIds) {
String[] rmIdArr = rmIds.split(Constants.COMMA);
int activeResourceManagerPort = PropertyUtils.getInt(Constants.HADOOP_RESOURCE_MANAGER_HTTPADDRESS_PORT, 8088);
String yarnUrl = "http://%s:" + activeResourceManagerPort + "/ws/v1/cluster/info";
String state = null;
try {
/**
* send http get request to rm1
*/
state = getRMState(String.format(yarnUrl, rmIdArr[0]));
if (Constants.HADOOP_RM_STATE_ACTIVE.equals(state)) {
return rmIdArr[0];
} else if (Constants.HADOOP_RM_STATE_STANDBY.equals(state)) {
state = getRMState(String.format(yarnUrl, rmIdArr[1]));
if (Constants.HADOOP_RM_STATE_ACTIVE.equals(state)) {
return rmIdArr[1];
}
} else {
return null;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,314 | [Question] dolphinscheduler cannot get the YARN address | The task is submitted and run successfully, but dolphinscheduler reports that the task status failed
After querying the log, it is found that the obtained yarn address is null, but the hosts and common are configured normally, and the yarn node is normally accessed
任务提交并运行成功,但dolphinscheduler报告任务状态失败
查询日志后发现获取到的yarn地址为null,但hosts与common均配置正常,且yarn节点正常访问
hosts
```properties
192.169.199.105 hdnn01
192.168.199.106 hdnn02
192.168.199.107 hdnn03
```
common.properties
```properties
# if resourcemanager HA enable, please type the HA ips ; if resourcemanager is single, make this value empty
yarn.resourcemanager.ha.rm.ids=hdnn01,hdnn02,hdnn03
# if resourcemanager HA enable or not use resourcemanager, please keep the default value; If resourcemanager is single, you only need to replace ds1 to actual resourcemanager hostname.
yarn.application.status.address=http://yarnIp1:8088/ws/v1/cluster/apps/%s
```
dolphinscheduler-worker.log
```
[INFO] 2020-12-25 18:17:30.759 - [taskAppId=TASK-3-4-17]:[193] - process start, process id is: 107032
[INFO] 2020-12-25 18:18:52.502 - [taskAppId=TASK-3-4-17]:[202] - process has exited, execute path:/tmp/dolphinscheduler/exec/process/1/3/4/17, processId:107032 ,exitStatusCode:0
[INFO] 2020-12-25 18:18:52.504 - [taskAppId=TASK-3-4-17]:[419] - find app id: application_1608880603127_0014
[INFO] 2020-12-25 18:18:52.576 org.apache.dolphinscheduler.common.utils.HadoopUtils:[144] - get property:fs.defaultFS -> hdfs://hdcluster, from core-site.xml hdfs-site.xml
[INFO] 2020-12-25 18:19:09.220 org.apache.dolphinscheduler.common.utils.HadoopUtils:[206] - application url : http://null:8088/ws/v1/cluster/apps/%s
[ERROR] 2020-12-25 18:19:24.259 org.apache.dolphinscheduler.common.utils.HttpUtils:[73] - null: Name or service not known
java.net.UnknownHostException: null: Name or service not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
at org.apache.dolphinscheduler.common.utils.HttpUtils.get(HttpUtils.java:60)
at org.apache.dolphinscheduler.common.utils.HadoopUtils.getApplicationStatus(HadoopUtils.java:412)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.isSuccessOfYarnState(AbstractCommandExecutor.java:378)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.run(AbstractCommandExecutor.java:218)
at org.apache.dolphinscheduler.server.worker.task.AbstractYarnTask.handle(AbstractYarnTask.java:57)
at org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
[ERROR] 2020-12-25 18:19:24.260 - [taskAppId=TASK-3-4-17]:[392] - yarn applications: [application_1608880603127_0014] status failed
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.common.utils.HadoopUtils.getApplicationStatus(HadoopUtils.java:415)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.isSuccessOfYarnState(AbstractCommandExecutor.java:378)
at org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor.run(AbstractCommandExecutor.java:218)
at org.apache.dolphinscheduler.server.worker.task.AbstractYarnTask.handle(AbstractYarnTask.java:57)
at org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
[INFO] 2020-12-25 18:19:24.261 org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread:[137] - task instance id : 17,task final status : FAILURE
``` | https://github.com/apache/dolphinscheduler/issues/4314 | https://github.com/apache/dolphinscheduler/pull/4344 | b9e8dbed2f9dd29f51b30411f80bc92a0ca04c06 | ccd06fec16bae7da97bc4f61c45d4b471dccebc4 | "2020-12-26T06:57:41Z" | java | "2020-12-30T03:03:36Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | } catch (Exception e) {
state = getRMState(String.format(yarnUrl, rmIdArr[1]));
if (Constants.HADOOP_RM_STATE_ACTIVE.equals(state)) {
return rmIdArr[0];
}
}
return null;
}
/**
* get ResourceManager state
*
* @param url
* @return
*/
public static String getRMState(String url) {
String retStr = HttpUtils.get(url);
if (StringUtils.isEmpty(retStr)) {
return null;
}
ObjectNode jsonObject = JSONUtils.parseObject(retStr);
if (!jsonObject.has("clusterInfo")) {
return null;
}
return jsonObject.get("clusterInfo").path("haState").asText();
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker.task.sql;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.commons.lang.StringUtils;
import org.apache.dolphinscheduler.alert.utils.MailUtils;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.*;
import org.apache.dolphinscheduler.common.enums.DbType;
import org.apache.dolphinscheduler.common.enums.ShowType;
import org.apache.dolphinscheduler.common.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.common.process.Property; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | import org.apache.dolphinscheduler.common.task.AbstractParameters;
import org.apache.dolphinscheduler.common.task.sql.SqlBinds;
import org.apache.dolphinscheduler.common.task.sql.SqlParameters;
import org.apache.dolphinscheduler.common.task.sql.SqlType;
import org.apache.dolphinscheduler.common.utils.*;
import org.apache.dolphinscheduler.dao.AlertDao;
import org.apache.dolphinscheduler.dao.datasource.BaseDataSource;
import org.apache.dolphinscheduler.dao.datasource.DataSourceFactory;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.server.entity.SQLTaskExecutionContext;
import org.apache.dolphinscheduler.server.entity.TaskExecutionContext;
import org.apache.dolphinscheduler.server.utils.ParamUtils;
import org.apache.dolphinscheduler.server.utils.UDFUtils;
import org.apache.dolphinscheduler.server.worker.task.AbstractTask;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.slf4j.Logger;
import java.sql.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static org.apache.dolphinscheduler.common.Constants.*;
import static org.apache.dolphinscheduler.common.enums.DbType.HIVE;
/**
* sql task
*/
public class SqlTask extends AbstractTask {
/**
* sql parameters
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | private SqlParameters sqlParameters;
/**
* alert dao
*/
private AlertDao alertDao;
/**
* base datasource
*/
private BaseDataSource baseDataSource;
/**
* taskExecutionContext
*/
private TaskExecutionContext taskExecutionContext;
/**
* default query sql limit
*/
private static final int LIMIT = 10000;
public SqlTask(TaskExecutionContext taskExecutionContext, Logger logger) {
super(taskExecutionContext, logger);
this.taskExecutionContext = taskExecutionContext;
logger.info("sql task params {}", taskExecutionContext.getTaskParams());
this.sqlParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), SqlParameters.class);
if (!sqlParameters.checkParameters()) {
throw new RuntimeException("sql task params is not valid");
}
this.alertDao = SpringApplicationContext.getBean(AlertDao.class);
}
@Override
public void handle() throws Exception { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | String threadLoggerInfoName = String.format(Constants.TASK_LOG_INFO_FORMAT, taskExecutionContext.getTaskAppId());
Thread.currentThread().setName(threadLoggerInfoName);
logger.info("Full sql parameters: {}", sqlParameters);
logger.info("sql type : {}, datasource : {}, sql : {} , localParams : {},udfs : {},showType : {},connParams : {}",
sqlParameters.getType(),
sqlParameters.getDatasource(),
sqlParameters.getSql(),
sqlParameters.getLocalParams(),
sqlParameters.getUdfs(),
sqlParameters.getShowType(),
sqlParameters.getConnParams());
try {
SQLTaskExecutionContext sqlTaskExecutionContext = taskExecutionContext.getSqlTaskExecutionContext();
DataSourceFactory.loadClass(DbType.valueOf(sqlParameters.getType()));
baseDataSource = DataSourceFactory.getDatasource(DbType.valueOf(sqlParameters.getType()),
sqlTaskExecutionContext.getConnectionParams());
SqlBinds mainSqlBinds = getSqlAndSqlParamsMap(sqlParameters.getSql());
List<SqlBinds> preStatementSqlBinds = Optional.ofNullable(sqlParameters.getPreStatements())
.orElse(new ArrayList<>())
.stream()
.map(this::getSqlAndSqlParamsMap)
.collect(Collectors.toList());
List<SqlBinds> postStatementSqlBinds = Optional.ofNullable(sqlParameters.getPostStatements())
.orElse(new ArrayList<>())
.stream()
.map(this::getSqlAndSqlParamsMap)
.collect(Collectors.toList()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | List<String> createFuncs = UDFUtils.createFuncs(sqlTaskExecutionContext.getUdfFuncTenantCodeMap(),
logger);
executeFuncAndSql(mainSqlBinds, preStatementSqlBinds, postStatementSqlBinds, createFuncs);
setExitStatusCode(Constants.EXIT_CODE_SUCCESS);
} catch (Exception e) {
setExitStatusCode(Constants.EXIT_CODE_FAILURE);
logger.error("sql task error", e);
throw e;
}
}
/**
* ready to execute SQL and parameter entity Map
* @return SqlBinds
*/
private SqlBinds getSqlAndSqlParamsMap(String sql) {
Map<Integer,Property> sqlParamsMap = new HashMap<>();
StringBuilder sqlBuilder = new StringBuilder();
Map<String, Property> paramsMap = ParamUtils.convert(ParamUtils.getUserDefParamsMap(taskExecutionContext.getDefinedParams()),
taskExecutionContext.getDefinedParams(),
sqlParameters.getLocalParametersMap(),
CommandType.of(taskExecutionContext.getCmdTypeIfComplement()),
taskExecutionContext.getScheduleTime());
if(paramsMap == null){
sqlBuilder.append(sql);
return new SqlBinds(sqlBuilder.toString(), sqlParamsMap);
}
if (StringUtils.isNotEmpty(sqlParameters.getTitle())){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | String title = ParameterUtils.convertParameterPlaceholders(sqlParameters.getTitle(),
ParamUtils.convert(paramsMap));
logger.info("SQL title : {}",title);
sqlParameters.setTitle(title);
}
sql = ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime());
String rgex = "['\"]*\\$\\{(.*?)\\}['\"]*";
setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap);
String formatSql = sql.replaceAll(rgex, "?");
sqlBuilder.append(formatSql);
printReplacedSql(sql, formatSql, rgex, sqlParamsMap);
return new SqlBinds(sqlBuilder.toString(), sqlParamsMap);
}
@Override
public AbstractParameters getParameters() {
return this.sqlParameters;
}
/**
* execute function and sql
* @param mainSqlBinds main sql binds
* @param preStatementsBinds pre statements binds
* @param postStatementsBinds post statements binds
* @param createFuncs create functions
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | public void executeFuncAndSql(SqlBinds mainSqlBinds,
List<SqlBinds> preStatementsBinds,
List<SqlBinds> postStatementsBinds,
List<String> createFuncs){
Connection connection = null;
PreparedStatement stmt = null;
ResultSet resultSet = null;
try {
CommonUtils.loadKerberosConf();
connection = createConnection();
if (CollectionUtils.isNotEmpty(createFuncs)) {
createTempFunction(connection,createFuncs);
}
preSql(connection,preStatementsBinds);
stmt = prepareStatementAndBind(connection, mainSqlBinds);
if (sqlParameters.getSqlType() == SqlType.QUERY.ordinal()) {
resultSet = stmt.executeQuery();
resultProcess(resultSet);
} else if (sqlParameters.getSqlType() == SqlType.NON_QUERY.ordinal()) {
stmt.executeUpdate();
}
postSql(connection,postStatementsBinds);
} catch (Exception e) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | logger.error("execute sql error",e);
throw new RuntimeException("execute sql error");
} finally {
close(resultSet,stmt,connection);
}
}
/**
* result process
*
* @param resultSet resultSet
* @throws Exception Exception
*/
private void resultProcess(ResultSet resultSet) throws Exception{
ArrayNode resultJSONArray = JSONUtils.createArrayNode();
ResultSetMetaData md = resultSet.getMetaData();
int num = md.getColumnCount();
int rowCount = 0;
while (rowCount < LIMIT && resultSet.next()) {
ObjectNode mapOfColValues = JSONUtils.createObjectNode();
for (int i = 1; i <= num; i++) {
mapOfColValues.set(md.getColumnLabel(i), JSONUtils.toJsonNode(resultSet.getObject(i)));
}
resultJSONArray.add(mapOfColValues);
rowCount++;
}
String result = JSONUtils.toJsonString(resultJSONArray);
logger.debug("execute sql : {}", result);
sendAttachment(StringUtils.isNotEmpty(sqlParameters.getTitle()) ?
sqlParameters.getTitle(): taskExecutionContext.getTaskName() + " query result sets",
JSONUtils.toJsonString(resultJSONArray)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | }
/**
* pre sql
*
* @param connection connection
* @param preStatementsBinds preStatementsBinds
*/
private void preSql(Connection connection,
List<SqlBinds> preStatementsBinds) throws Exception{
for (SqlBinds sqlBind: preStatementsBinds) {
try (PreparedStatement pstmt = prepareStatementAndBind(connection, sqlBind)){
int result = pstmt.executeUpdate();
logger.info("pre statement execute result: {}, for sql: {}",result,sqlBind.getSql());
}
}
}
/**
* post sql
*
* @param connection connection
* @param postStatementsBinds postStatementsBinds
* @throws Exception
*/
private void postSql(Connection connection,
List<SqlBinds> postStatementsBinds) throws Exception{
for (SqlBinds sqlBind: postStatementsBinds) {
try (PreparedStatement pstmt = prepareStatementAndBind(connection, sqlBind)){
int result = pstmt.executeUpdate();
logger.info("post statement execute result: {},for sql: {}",result,sqlBind.getSql());
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | }
}
/**
* create temp function
*
* @param connection connection
* @param createFuncs createFuncs
* @throws Exception
*/
private void createTempFunction(Connection connection,
List<String> createFuncs) throws Exception{
try (Statement funcStmt = connection.createStatement()) {
for (String createFunc : createFuncs) {
logger.info("hive create function sql: {}", createFunc);
funcStmt.execute(createFunc);
}
}
}
/**
* create connection
*
* @return connection
* @throws Exception Exception
*/
private Connection createConnection() throws Exception{
Connection connection = null;
if (HIVE == DbType.valueOf(sqlParameters.getType())) {
Properties paramProp = new Properties(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | paramProp.setProperty(USER, baseDataSource.getUser());
paramProp.setProperty(PASSWORD, baseDataSource.getPassword());
Map<String, String> connParamMap = CollectionUtils.stringToMap(sqlParameters.getConnParams(),
SEMICOLON,
HIVE_CONF);
paramProp.putAll(connParamMap);
connection = DriverManager.getConnection(baseDataSource.getJdbcUrl(),
paramProp);
}else{
connection = DriverManager.getConnection(baseDataSource.getJdbcUrl(),
baseDataSource.getUser(),
baseDataSource.getPassword());
}
return connection;
}
/**
* close jdbc resource
*
* @param resultSet resultSet
* @param pstmt pstmt
* @param connection connection
*/
private void close(ResultSet resultSet,
PreparedStatement pstmt,
Connection connection){
if (resultSet != null){
try {
resultSet.close();
} catch (SQLException e) {
logger.error("close result set error : {}",e.getMessage(),e); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | }
}
if (pstmt != null){
try {
pstmt.close();
} catch (SQLException e) {
logger.error("close prepared statement error : {}",e.getMessage(),e);
}
}
if (connection != null){
try {
connection.close();
} catch (SQLException e) {
logger.error("close connection error : {}",e.getMessage(),e);
}
}
}
/**
* preparedStatement bind
* @param connection connection
* @param sqlBinds sqlBinds
* @return PreparedStatement
* @throws Exception Exception
*/
private PreparedStatement prepareStatementAndBind(Connection connection, SqlBinds sqlBinds) throws Exception {
boolean timeoutFlag = TaskTimeoutStrategy.of(taskExecutionContext.getTaskTimeoutStrategy()) == TaskTimeoutStrategy.FAILED ||
TaskTimeoutStrategy.of(taskExecutionContext.getTaskTimeoutStrategy()) == TaskTimeoutStrategy.WARNFAILED;
PreparedStatement stmt = connection.prepareStatement(sqlBinds.getSql());
if(timeoutFlag){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | stmt.setQueryTimeout(taskExecutionContext.getTaskTimeout());
}
Map<Integer, Property> params = sqlBinds.getParamsMap();
if(params != null) {
for (Map.Entry<Integer, Property> entry : params.entrySet()) {
Property prop = entry.getValue();
ParameterUtils.setInParameter(entry.getKey(), stmt, prop.getType(), prop.getValue());
}
}
logger.info("prepare statement replace sql : {} ", stmt);
return stmt;
}
/**
* send mail as an attachment
* @param title title
* @param content content
*/
public void sendAttachment(String title,String content){
List<User> users = alertDao.queryUserByAlertGroupId(taskExecutionContext.getSqlTaskExecutionContext().getWarningGroupId());
List<String> receiversList = new ArrayList<>();
for(User user:users){
receiversList.add(user.getEmail().trim());
}
String receivers = sqlParameters.getReceivers();
if (StringUtils.isNotEmpty(receivers)){
String[] splits = receivers.split(COMMA);
for (String receiver : splits){
receiversList.add(receiver.trim()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | }
}
List<String> receiversCcList = new ArrayList<>();
String receiversCc = sqlParameters.getReceiversCc();
if (StringUtils.isNotEmpty(receiversCc)){
String[] splits = receiversCc.split(COMMA);
for (String receiverCc : splits){
receiversCcList.add(receiverCc.trim());
}
}
String showTypeName = sqlParameters.getShowType().replace(COMMA,"").trim();
if(EnumUtils.isValidEnum(ShowType.class,showTypeName)){
Map<String, Object> mailResult = MailUtils.sendMails(receiversList,
receiversCcList, title, content, ShowType.valueOf(showTypeName).getDescp());
if(!(boolean) mailResult.get(STATUS)){
throw new RuntimeException("send mail failed!");
}
}else{
logger.error("showType: {} is not valid " ,showTypeName);
throw new RuntimeException(String.format("showType: %s is not valid ",showTypeName));
}
}
/**
* regular expressions match the contents between two specified strings
* @param content content
* @param rgex rgex
* @param sqlParamsMap sql params map
* @param paramsPropsMap params props map |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,496 | [BUG][server] Add to! {} is used to mark the custom parameters to be output as-is in sql | The hdfs path mapped when hive adds partitions is passed in by custom parameters:
Sample statement: alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
Custom parameters:time in varchar $[yyyy-MM-dd]
Problem Description:
Quotation marks are added to the custom parameters in the Hive load partition SQL, which causes the partition path mapping error:
before modification: location "/.../${time}/" Is parsed into location "/.../'2020-01-19'/"
After modification : location "/.../${time}/" Is parsed into location "/.../2020-01-19/"
After the modification, there are no quotation marks in the hdfs path, which meets the requirements of the partition of the hive table
--------------------------------------------------------------------------------------------------------------
hive添加分区时所映射的hdfs路径由自定义参数传入
样例语句:alter table test add if not exists partition(dt='${time}') location "/.../${time}/";
自定义参数:time in varchar $[yyyy-MM-dd]
问题描述:
Hive加载分区SQL里的自定义参数上加了引号,导致分区路径映射错误:
修改前 location "/.../${time}/ 被解析成 location "/.../'2020-01-19'/
修改后 location "/.../${time}/ 被解析成 location "/.../2020-01-19/
修改后hdfs路径中不再有引号,符合hive表的分区的需求 | https://github.com/apache/dolphinscheduler/issues/4496 | https://github.com/apache/dolphinscheduler/pull/4497 | 0ab246da5fc30cc21734d7fa511be4f9080c7a9c | 43586da376cf60f3d719bee5b35c312568408cc7 | "2021-01-19T13:35:25Z" | java | "2021-01-21T12:43:59Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java | */
public void setSqlParamsMap(String content, String rgex, Map<Integer,Property> sqlParamsMap, Map<String,Property> paramsPropsMap){
Pattern pattern = Pattern.compile(rgex);
Matcher m = pattern.matcher(content);
int index = 1;
while (m.find()) {
String paramName = m.group(1);
Property prop = paramsPropsMap.get(paramName);
sqlParamsMap.put(index,prop);
index ++;
}
}
/**
* print replace sql
* @param content content
* @param formatSql format sql
* @param rgex rgex
* @param sqlParamsMap sql params map
*/
public void printReplacedSql(String content, String formatSql,String rgex, Map<Integer,Property> sqlParamsMap){
logger.info("after replace sql , preparing : {}" , formatSql);
StringBuilder logPrint = new StringBuilder("replaced sql , parameters:");
for(int i=1;i<=sqlParamsMap.size();i++){
logPrint.append(sqlParamsMap.get(i).getValue()+"("+sqlParamsMap.get(i).getType()+")");
}
logger.info("Sql Params are {}", logPrint);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.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 | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.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.controller;
import static org.apache.dolphinscheduler.api.enums.Status.BATCH_COPY_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.BATCH_DELETE_PROCESS_DEFINE_BY_IDS_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.BATCH_MOVE_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.CREATE_PROCESS_DEFINITION;
import static org.apache.dolphinscheduler.api.enums.Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.DELETE_PROCESS_DEFINITION_VERSION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.ENCAPSULATION_TREEVIEW_STRUCTURE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_DATAIL_OF_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_PROCESS_DEFINITION_LIST;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_PROCESS_DEFINITION_LIST_PAGING_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_PROCESS_DEFINITION_VERSIONS_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.RELEASE_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionVersionService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.utils.ParameterUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | import org.apache.dolphinscheduler.dao.entity.User;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import springfox.documentation.annotations.ApiIgnore;
/**
* process definition controller
*/
@Api(tags = "PROCESS_DEFINITION_TAG", position = 2) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @RestController
@RequestMapping("projects/{projectName}/process")
public class ProcessDefinitionController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionController.class);
@Autowired
private ProcessDefinitionService processDefinitionService;
@Autowired
private ProcessDefinitionVersionService processDefinitionVersionService;
/**
* create process definition
*
* @param loginUser login user
* @param projectName project name
* @param name process definition name
* @param json process definition json
* @param description description
* @param locations locations for nodes
* @param connects connects for nodes
* @return create result code
*/
@ApiOperation(value = "save", notes = "CREATE_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"),
@ApiImplicitParam(name = "processDefinitionJson", value = "PROCESS_DEFINITION_JSON", required = true, type = "String"),
@ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"),
@ApiImplicitParam(name = "connects", value = "PROCESS_DEFINITION_CONNECTS", required = true, type = "String"),
@ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String"),
})
@PostMapping(value = "/save") |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_PROCESS_DEFINITION)
public Result createProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam(value = "name", required = true) String name,
@RequestParam(value = "processDefinitionJson", required = true) String json,
@RequestParam(value = "locations", required = true) String locations,
@RequestParam(value = "connects", required = true) String connects,
@RequestParam(value = "description", required = false) String description) throws JsonProcessingException {
logger.info("login user {}, create process definition, project name: {}, process definition name: {}, "
+ "process_definition_json: {}, desc: {} locations:{}, connects:{}",
loginUser.getUserName(), projectName, name, json, description, locations, connects);
Map<String, Object> result = processDefinitionService.createProcessDefinition(loginUser, projectName, name, json,
description, locations, connects);
return returnDataList(result);
}
/**
* copy process definition
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionIds process definition ids
* @param targetProjectId target project id
* @return copy result code
*/
@ApiOperation(value = "copyProcessDefinition", notes = "COPY_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionIds", value = "PROCESS_DEFINITION_IDS", required = true, dataType = "String", example = "3,4"),
@ApiImplicitParam(name = "targetProjectId", value = "TARGET_PROJECT_ID", required = true, dataType = "Int", example = "10")
}) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @PostMapping(value = "/copy")
@ResponseStatus(HttpStatus.OK)
@ApiException(BATCH_COPY_PROCESS_DEFINITION_ERROR)
public Result copyProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam(value = "processDefinitionIds", required = true) String processDefinitionIds,
@RequestParam(value = "targetProjectId", required = true) int targetProjectId) {
logger.info("batch copy process definition, login user:{}, project name:{}, process definition ids:{},target project id:{}",
StringUtils.replaceNRTtoUnderline(loginUser.getUserName()),
StringUtils.replaceNRTtoUnderline(projectName),
StringUtils.replaceNRTtoUnderline(processDefinitionIds),
StringUtils.replaceNRTtoUnderline(String.valueOf(targetProjectId)));
return returnDataList(
processDefinitionService.batchCopyProcessDefinition(loginUser, projectName, processDefinitionIds, targetProjectId));
}
/**
* move process definition
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionIds process definition ids
* @param targetProjectId target project id
* @return move result code
*/
@ApiOperation(value = "moveProcessDefinition", notes = "MOVE_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionIds", value = "PROCESS_DEFINITION_IDS", required = true, dataType = "String", example = "3,4"),
@ApiImplicitParam(name = "targetProjectId", value = "TARGET_PROJECT_ID", required = true, dataType = "Int", example = "10")
})
@PostMapping(value = "/move") |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @ResponseStatus(HttpStatus.OK)
@ApiException(BATCH_MOVE_PROCESS_DEFINITION_ERROR)
public Result moveProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam(value = "processDefinitionIds", required = true) String processDefinitionIds,
@RequestParam(value = "targetProjectId", required = true) int targetProjectId) {
logger.info("batch move process definition, login user:{}, project name:{}, process definition ids:{},target project id:{}",
StringUtils.replaceNRTtoUnderline(loginUser.getUserName()),
StringUtils.replaceNRTtoUnderline(projectName),
StringUtils.replaceNRTtoUnderline(processDefinitionIds),
StringUtils.replaceNRTtoUnderline(String.valueOf(targetProjectId)));
return returnDataList(
processDefinitionService.batchMoveProcessDefinition(loginUser, projectName, processDefinitionIds, targetProjectId));
}
/**
* verify process definition name unique
*
* @param loginUser login user
* @param projectName project name
* @param name name
* @return true if process definition name not exists, otherwise false
*/
@ApiOperation(value = "verify-name", notes = "VERIFY_PROCESS_DEFINITION_NAME_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String")
})
@GetMapping(value = "/verify-name")
@ResponseStatus(HttpStatus.OK)
@ApiException(VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR)
public Result verifyProcessDefinitionName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam(value = "name", required = true) String name) {
logger.info("verify process definition name unique, user:{}, project name:{}, process definition name:{}",
loginUser.getUserName(), projectName, name);
Map<String, Object> result = processDefinitionService.verifyProcessDefinitionName(loginUser, projectName, name);
return returnDataList(result);
}
/**
* update process definition
*
* @param loginUser login user
* @param projectName project name
* @param name process definition name
* @param id process definition id
* @param processDefinitionJson process definition json
* @param description description
* @param locations locations for nodes
* @param connects connects for nodes
* @return update result code
*/
@ApiOperation(value = "updateProcessDefinition", notes = "UPDATE_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"),
@ApiImplicitParam(name = "id", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "processDefinitionJson", value = "PROCESS_DEFINITION_JSON", required = true, type = "String"),
@ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"),
@ApiImplicitParam(name = "connects", value = "PROCESS_DEFINITION_CONNECTS", required = true, type = "String"),
@ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String"),
@ApiImplicitParam(name = "releaseState", value = "RELEASE_PROCESS_DEFINITION_NOTES", required = false, dataType = "Int", example = "0")
}) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @PostMapping(value = "/update")
@ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_PROCESS_DEFINITION_ERROR)
public Result updateProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam(value = "name", required = true) String name,
@RequestParam(value = "id", required = true) int id,
@RequestParam(value = "processDefinitionJson", required = true) String processDefinitionJson,
@RequestParam(value = "locations", required = false) String locations,
@RequestParam(value = "connects", required = false) String connects,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "releaseState", required = false, defaultValue = "0") int releaseState) {
logger.info("login user {}, update process define, project name: {}, process define name: {}, "
+ "process_definition_json: {}, desc: {}, locations:{}, connects:{}",
loginUser.getUserName(), projectName, name, processDefinitionJson, description, locations, connects);
Map<String, Object> result = processDefinitionService.updateProcessDefinition(loginUser, projectName, id, name,
processDefinitionJson, description, locations, connects);
//
Status status = (Status) result.get("status");
if (status.getCode() != 0) {
return returnDataList(result);
}
//
if (releaseState == 1) {
result = processDefinitionService.releaseProcessDefinition(loginUser, projectName, id, releaseState);
}
return returnDataList(result);
}
/**
* query process definition version paging list info |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | *
* @param loginUser login user info
* @param projectName the process definition project name
* @param pageNo the process definition version list current page number
* @param pageSize the process definition version list page size
* @param processDefinitionId the process definition id
* @return the process definition version list
*/
@ApiOperation(value = "queryProcessDefinitionVersions", notes = "QUERY_PROCESS_DEFINITION_VERSIONS_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/versions")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_VERSIONS_ERROR)
public Result queryProcessDefinitionVersions(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam(value = "pageNo") int pageNo,
@RequestParam(value = "pageSize") int pageSize,
@RequestParam(value = "processDefinitionId") int processDefinitionId) {
Map<String, Object> result = processDefinitionVersionService.queryProcessDefinitionVersions(loginUser
, projectName, pageNo, pageSize, processDefinitionId);
return returnDataList(result);
}
/**
* switch certain process definition version
*
* @param loginUser login user info |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | * @param projectName the process definition project name
* @param processDefinitionId the process definition id
* @param version the version user want to switch
* @return switch version result code
*/
@ApiOperation(value = "switchProcessDefinitionVersion", notes = "SWITCH_PROCESS_DEFINITION_VERSION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Long", example = "100")
})
@GetMapping(value = "/version/switch")
@ResponseStatus(HttpStatus.OK)
@ApiException(SWITCH_PROCESS_DEFINITION_VERSION_ERROR)
public Result switchProcessDefinitionVersion(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam(value = "processDefinitionId") int processDefinitionId,
@RequestParam(value = "version") long version) {
Map<String, Object> result = processDefinitionService.switchProcessDefinitionVersion(loginUser, projectName
, processDefinitionId, version);
return returnDataList(result);
}
/**
* delete the certain process definition version by version and process definition id
*
* @param loginUser login user info
* @param projectName the process definition project name
* @param processDefinitionId process definition id
* @param version the process definition version user want to delete
* @return delete version result code
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @ApiOperation(value = "deleteProcessDefinitionVersion", notes = "DELETE_PROCESS_DEFINITION_VERSION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Long", example = "100")
})
@GetMapping(value = "/version/delete")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_PROCESS_DEFINITION_VERSION_ERROR)
public Result deleteProcessDefinitionVersion(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam(value = "processDefinitionId") int processDefinitionId,
@RequestParam(value = "version") long version) {
Map<String, Object> result = processDefinitionVersionService.deleteByProcessDefinitionIdAndVersion(loginUser, projectName, processDefinitionId, version);
return returnDataList(result);
}
/**
* release process definition
*
* @param loginUser login user
* @param projectName project name
* @param processId process definition id
* @param releaseState release state
* @return release result code
*/
@ApiOperation(value = "releaseProcessDefinition", notes = "RELEASE_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"),
@ApiImplicitParam(name = "processId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "releaseState", value = "PROCESS_DEFINITION_CONNECTS", required = true, dataType = "Int", example = "100"),
}) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @PostMapping(value = "/release")
@ResponseStatus(HttpStatus.OK)
@ApiException(RELEASE_PROCESS_DEFINITION_ERROR)
public Result releaseProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam(value = "processId", required = true) int processId,
@RequestParam(value = "releaseState", required = true) int releaseState) {
logger.info("login user {}, release process definition, project name: {}, release state: {}",
loginUser.getUserName(), projectName, releaseState);
Map<String, Object> result = processDefinitionService.releaseProcessDefinition(loginUser, projectName, processId, releaseState);
return returnDataList(result);
}
/**
* query datail of process definition by id
*
* @param loginUser login user
* @param projectName project name
* @param processId process definition id
* @return process definition detail
*/
@ApiOperation(value = "queryProcessDefinitionById", notes = "QUERY_PROCESS_DEFINITION_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/select-by-id")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DATAIL_OF_PROCESS_DEFINITION_ERROR)
public Result queryProcessDefinitionById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam("processId") Integer processId |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | ) {
logger.info("query detail of process definition, login user:{}, project name:{}, process definition id:{}",
loginUser.getUserName(), projectName, processId);
Map<String, Object> result = processDefinitionService.queryProcessDefinitionById(loginUser, projectName, processId);
return returnDataList(result);
}
/**
* query datail of process definition by name
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionName process definition name
* @return process definition detail
*/
@ApiOperation(value = "queryProcessDefinitionByName", notes = "QUERY_PROCESS_DEFINITION_BY_NAME_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionName", value = "PROCESS_DEFINITION_ID", required = true, dataType = "String")
})
@GetMapping(value = "/select-by-name")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DATAIL_OF_PROCESS_DEFINITION_ERROR)
public Result<ProcessDefinition> queryProcessDefinitionByName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam("processDefinitionName") String processDefinitionName
) {
Map<String, Object> result = processDefinitionService.queryProcessDefinitionByName(loginUser, projectName, processDefinitionName);
return returnDataList(result);
}
/**
* query Process definition list |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | *
* @param loginUser login user
* @param projectName project name
* @return process definition list
*/
@ApiOperation(value = "queryProcessDefinitionList", notes = "QUERY_PROCESS_DEFINITION_LIST_NOTES")
@GetMapping(value = "/list")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_LIST)
public Result queryProcessDefinitionList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName
) {
logger.info("query process definition list, login user:{}, project name:{}",
loginUser.getUserName(), projectName);
Map<String, Object> result = processDefinitionService.queryProcessDefinitionList(loginUser, projectName);
return returnDataList(result);
}
/**
* query process definition list paging
*
* @param loginUser login user
* @param projectName project name
* @param searchVal search value
* @param pageNo page number
* @param pageSize page size
* @param userId user id
* @return process definition page
*/
@ApiOperation(value = "queryProcessDefinitionListPaging", notes = "QUERY_PROCESS_DEFINITION_LIST_PAGING_NOTES")
@ApiImplicitParams({ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", required = false, type = "String"),
@ApiImplicitParam(name = "userId", value = "USER_ID", required = false, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/list-paging")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_LIST_PAGING_ERROR)
public Result queryProcessDefinitionListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam("pageNo") Integer pageNo,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam(value = "userId", required = false, defaultValue = "0") Integer userId,
@RequestParam("pageSize") Integer pageSize) {
logger.info("query process definition list paging, login user:{}, project name:{}", loginUser.getUserName(), projectName);
Map<String, Object> result = checkPageParams(pageNo, pageSize);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return returnDataListPaging(result);
}
searchVal = ParameterUtils.handleEscapes(searchVal);
result = processDefinitionService.queryProcessDefinitionListPaging(loginUser, projectName, searchVal, pageNo, pageSize, userId);
return returnDataListPaging(result);
}
/**
* encapsulation treeview structure
*
* @param loginUser login user
* @param projectName project name
* @param id process definition id
* @param limit limit |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | * @return tree view json data
*/
@ApiOperation(value = "viewTree", notes = "VIEW_TREE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/view-tree")
@ResponseStatus(HttpStatus.OK)
@ApiException(ENCAPSULATION_TREEVIEW_STRUCTURE_ERROR)
public Result viewTree(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam("processId") Integer id,
@RequestParam("limit") Integer limit) throws Exception {
Map<String, Object> result = processDefinitionService.viewTree(id, limit);
return returnDataList(result);
}
/**
* get tasks list by process definition id
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionId process definition id
* @return task list
*/
@ApiOperation(value = "getNodeListByDefinitionId", notes = "GET_NODE_LIST_BY_DEFINITION_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "gen-task-list") |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @ResponseStatus(HttpStatus.OK)
@ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR)
public Result getNodeListByDefinitionId(
@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam("processDefinitionId") Integer processDefinitionId) throws Exception {
logger.info("query task node name list by definitionId, login user:{}, project name:{}, id : {}",
loginUser.getUserName(), projectName, processDefinitionId);
Map<String, Object> result = processDefinitionService.getTaskNodeListByDefinitionId(processDefinitionId);
return returnDataList(result);
}
/**
* get tasks list by process definition id
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionIdList process definition id list
* @return node list data
*/
@ApiOperation(value = "getNodeListByDefinitionIdList", notes = "GET_NODE_LIST_BY_DEFINITION_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionIdList", value = "PROCESS_DEFINITION_ID_LIST", required = true, type = "String")
})
@GetMapping(value = "get-task-list")
@ResponseStatus(HttpStatus.OK)
@ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR)
public Result getNodeListByDefinitionIdList(
@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam("processDefinitionIdList") String processDefinitionIdList) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | logger.info("query task node name list by definitionId list, login user:{}, project name:{}, id list: {}",
loginUser.getUserName(), projectName, processDefinitionIdList);
Map<String, Object> result = processDefinitionService.getTaskNodeListByDefinitionIdList(processDefinitionIdList);
return returnDataList(result);
}
/**
* delete process definition by id
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionId process definition id
* @return delete result code
*/
@ApiOperation(value = "deleteProcessDefinitionById", notes = "DELETE_PROCESS_DEFINITION_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", dataType = "Int", example = "100")
})
@GetMapping(value = "/delete")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_PROCESS_DEFINE_BY_ID_ERROR)
public Result deleteProcessDefinitionById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam("processDefinitionId") Integer processDefinitionId
) {
logger.info("delete process definition by id, login user:{}, project name:{}, process definition id:{}",
loginUser.getUserName(), projectName, processDefinitionId);
Map<String, Object> result = processDefinitionService.deleteProcessDefinitionById(loginUser, projectName, processDefinitionId);
return returnDataList(result);
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | * batch delete process definition by ids
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionIds process definition id list
* @return delete result code
*/
@ApiOperation(value = "batchDeleteProcessDefinitionByIds", notes = "BATCH_DELETE_PROCESS_DEFINITION_BY_IDS_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionIds", value = "PROCESS_DEFINITION_IDS", type = "String")
})
@GetMapping(value = "/batch-delete")
@ResponseStatus(HttpStatus.OK)
@ApiException(BATCH_DELETE_PROCESS_DEFINE_BY_IDS_ERROR)
public Result batchDeleteProcessDefinitionByIds(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam("processDefinitionIds") String processDefinitionIds
) {
logger.info("delete process definition by ids, login user:{}, project name:{}, process definition ids:{}",
loginUser.getUserName(), projectName, processDefinitionIds);
Map<String, Object> result = new HashMap<>();
List<String> deleteFailedIdList = new ArrayList<>();
if (StringUtils.isNotEmpty(processDefinitionIds)) {
String[] processDefinitionIdArray = processDefinitionIds.split(",");
for (String strProcessDefinitionId : processDefinitionIdArray) {
int processDefinitionId = Integer.parseInt(strProcessDefinitionId);
try {
Map<String, Object> deleteResult = processDefinitionService.deleteProcessDefinitionById(loginUser, projectName, processDefinitionId);
if (!Status.SUCCESS.equals(deleteResult.get(Constants.STATUS))) {
deleteFailedIdList.add(strProcessDefinitionId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | logger.error((String) deleteResult.get(Constants.MSG));
}
} catch (Exception e) {
deleteFailedIdList.add(strProcessDefinitionId);
}
}
}
if (!deleteFailedIdList.isEmpty()) {
putMsg(result, Status.BATCH_DELETE_PROCESS_DEFINE_BY_IDS_ERROR, String.join(",", deleteFailedIdList));
} else {
putMsg(result, Status.SUCCESS);
}
return returnDataList(result);
}
/**
* batch export process definition by ids
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionIds process definition ids
* @param response response
*/
@ApiOperation(value = "batchExportProcessDefinitionByIds", notes = "BATCH_EXPORT_PROCESS_DEFINITION_BY_IDS_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionIds", value = "PROCESS_DEFINITION_ID", required = true, dataType = "String")
})
@GetMapping(value = "/export")
@ResponseBody
public void batchExportProcessDefinitionByIds(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java | @RequestParam("processDefinitionIds") String processDefinitionIds,
HttpServletResponse response) {
try {
logger.info("batch export process definition by ids, login user:{}, project name:{}, process definition ids:{}",
loginUser.getUserName(), projectName, processDefinitionIds);
processDefinitionService.batchExportProcessDefinitionByIds(loginUser, projectName, processDefinitionIds, response);
} catch (Exception e) {
logger.error(Status.BATCH_EXPORT_PROCESS_DEFINE_BY_IDS_ERROR.getMsg(), e);
}
}
/**
* query process definition all by project id
*
* @param loginUser login user
* @param projectId project id
* @return process definition list
*/
@ApiOperation(value = "queryProcessDefinitionAllByProjectId", notes = "QUERY_PROCESS_DEFINITION_All_BY_PROJECT_ID_NOTES")
@GetMapping(value = "/queryProcessDefinitionAllByProjectId")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_LIST)
public Result queryProcessDefinitionAllByProjectId(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("projectId") Integer projectId) {
logger.info("query process definition list, login user:{}, project id:{}",
loginUser.getUserName(), projectId);
Map<String, Object> result = processDefinitionService.queryProcessDefinitionAllByProjectId(projectId);
return returnDataList(result);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service;
import org.apache.dolphinscheduler.dao.entity.ProcessData;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.core.JsonProcessingException;
/**
* process definition service
*/
public interface ProcessDefinitionService { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | /**
* create process definition
*
* @param loginUser login user
* @param projectName project name
* @param name process definition name
* @param processDefinitionJson process definition json
* @param desc description
* @param locations locations for nodes
* @param connects connects for nodes
* @return create result code
* @throws JsonProcessingException JsonProcessingException |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | */
Map<String, Object> createProcessDefinition(User loginUser,
String projectName,
String name,
String processDefinitionJson,
String desc,
String locations,
String connects) throws JsonProcessingException;
/**
* query process definition list
*
* @param loginUser login user
* @param projectName project name
* @return definition list
*/
Map<String, Object> queryProcessDefinitionList(User loginUser,
String projectName);
/**
* query process definition list paging
*
* @param loginUser login user
* @param projectName project name
* @param searchVal search value
* @param pageNo page number
* @param pageSize page size
* @param userId user id
* @return process definition page
*/
Map<String, Object> queryProcessDefinitionListPaging(User loginUser,
String projectName, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | String searchVal,
Integer pageNo,
Integer pageSize,
Integer userId);
/**
* query datail of process definition
*
* @param loginUser login user
* @param projectName project name
* @param processId process definition id
* @return process definition detail
*/
Map<String, Object> queryProcessDefinitionById(User loginUser,
String projectName,
Integer processId);
/**
* query datail of process definition
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionName process definition name
* @return process definition detail
*/
Map<String, Object> queryProcessDefinitionByName(User loginUser,
String projectName,
String processDefinitionName);
/**
* batch copy process definition
*
* @param loginUser loginUser |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | * @param projectName projectName
* @param processDefinitionIds processDefinitionIds
* @param targetProjectId targetProjectId
*/
Map<String, Object> batchCopyProcessDefinition(User loginUser,
String projectName,
String processDefinitionIds,
int targetProjectId);
/**
* batch move process definition
*
* @param loginUser loginUser
* @param projectName projectName
* @param processDefinitionIds processDefinitionIds
* @param targetProjectId targetProjectId
*/
Map<String, Object> batchMoveProcessDefinition(User loginUser,
String projectName,
String processDefinitionIds,
int targetProjectId);
/**
* update process definition
*
* @param loginUser login user
* @param projectName project name
* @param name process definition name
* @param id process definition id
* @param processDefinitionJson process definition json
* @param desc description
* @param locations locations for nodes |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | * @param connects connects for nodes
* @return update result code
*/
Map<String, Object> updateProcessDefinition(User loginUser,
String projectName,
int id,
String name,
String processDefinitionJson, String desc,
String locations, String connects);
/**
* verify process definition name unique
*
* @param loginUser login user
* @param projectName project name
* @param name name
* @return true if process definition name not exists, otherwise false
*/
Map<String, Object> verifyProcessDefinitionName(User loginUser,
String projectName,
String name);
/**
* delete process definition by id
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionId process definition id
* @return delete result code
*/
Map<String, Object> deleteProcessDefinitionById(User loginUser,
String projectName, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | Integer processDefinitionId);
/**
* release process definition: online / offline
*
* @param loginUser login user
* @param projectName project name
* @param id process definition id
* @param releaseState release state
* @return release result code
*/
Map<String, Object> releaseProcessDefinition(User loginUser,
String projectName,
int id,
int releaseState);
/**
* batch export process definition by ids
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionIds process definition ids
* @param response http servlet response
*/
void batchExportProcessDefinitionByIds(User loginUser,
String projectName,
String processDefinitionIds,
HttpServletResponse response);
/**
* import process definition
*
* @param loginUser login user |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | * @param file process metadata json file
* @param currentProjectName current project name
* @return import process
*/
Map<String, Object> importProcessDefinition(User loginUser,
MultipartFile file,
String currentProjectName);
/**
* check the process definition node meets the specifications
*
* @param processData process data
* @param processDefinitionJson process definition json
* @return check result code
*/
Map<String, Object> checkProcessNodeList(ProcessData processData,
String processDefinitionJson);
/**
* get task node details based on process definition
*
* @param defineId define id
* @return task node list
*/
Map<String, Object> getTaskNodeListByDefinitionId(Integer defineId);
/**
* get task node details based on process definition
*
* @param defineIdList define id list
* @return task node list
*/
Map<String, Object> getTaskNodeListByDefinitionIdList(String defineIdList); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java | /**
* query process definition all by project id
*
* @param projectId project id
* @return process definitions in the project
*/
Map<String, Object> queryProcessDefinitionAllByProjectId(Integer projectId);
/**
* Encapsulates the TreeView structure
*
* @param processId process definition id
* @param limit limit
* @return tree view json data
* @throws Exception exception
*/
Map<String, Object> viewTree(Integer processId,
Integer limit) throws Exception;
/**
* switch the defined process definition verison
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionId process definition id
* @param version the version user want to switch
* @return switch process definition version result code
*/
Map<String, Object> switchProcessDefinitionVersion(User loginUser, String projectName
, int processDefinitionId, long version);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | */
package org.apache.dolphinscheduler.api.service.impl;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_ID;
import org.apache.dolphinscheduler.api.dto.ProcessMeta;
import org.apache.dolphinscheduler.api.dto.treeview.Instance;
import org.apache.dolphinscheduler.api.dto.treeview.TreeViewDto;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.BaseService;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionVersionService;
import org.apache.dolphinscheduler.api.service.ProcessInstanceService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.service.SchedulerService;
import org.apache.dolphinscheduler.api.utils.CheckUtils;
import org.apache.dolphinscheduler.api.utils.FileUtils;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.exportprocess.ProcessAddTaskParam;
import org.apache.dolphinscheduler.api.utils.exportprocess.TaskNodeParamFactory;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.TaskType;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.graph.DAG;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.model.TaskNodeRelation; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | import org.apache.dolphinscheduler.common.process.ProcessDag;
import org.apache.dolphinscheduler.common.process.Property;
import org.apache.dolphinscheduler.common.process.ResourceInfo;
import org.apache.dolphinscheduler.common.task.AbstractParameters;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.utils.CollectionUtils;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.StreamUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.common.utils.TaskParametersUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessData;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionVersion;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.Schedule;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper;
import org.apache.dolphinscheduler.dao.utils.DagHelper;
import org.apache.dolphinscheduler.service.permission.PermissionCheck;
import org.apache.dolphinscheduler.service.process.ProcessService;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* process definition service impl
*/
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | public class ProcessDefinitionServiceImpl extends BaseService implements
ProcessDefinitionService {
private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class);
private static final String PROCESSDEFINITIONID = "processDefinitionId";
private static final String RELEASESTATE = "releaseState";
private static final String TASKS = "tasks";
@Autowired
private ProjectMapper projectMapper;
@Autowired
private ProjectService projectService;
@Autowired
private ProcessDefinitionVersionService processDefinitionVersionService;
@Autowired
private ProcessDefinitionMapper processDefineMapper;
@Autowired
private ProcessInstanceService processInstanceService;
@Autowired
private TaskInstanceMapper taskInstanceMapper;
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
private ProcessService processService;
/**
* create process definition
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param loginUser login user
* @param projectName project name
* @param name process definition name
* @param processDefinitionJson process definition json
* @param desc description
* @param locations locations for nodes
* @param connects connects for nodes
* @return create result code
*/
@Override
public Map<String, Object> createProcessDefinition(User loginUser,
String projectName,
String name,
String processDefinitionJson,
String desc,
String locations,
String connects) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
return checkResult;
}
ProcessDefinition processDefine = new ProcessDefinition();
Date now = new Date();
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
Map<String, Object> checkProcessJson = checkProcessNodeList(processData, processDefinitionJson);
if (checkProcessJson.get(Constants.STATUS) != Status.SUCCESS) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return checkProcessJson;
}
processDefine.setName(name);
processDefine.setReleaseState(ReleaseState.OFFLINE);
processDefine.setProjectId(project.getId());
processDefine.setUserId(loginUser.getId());
processDefine.setProcessDefinitionJson(processDefinitionJson);
processDefine.setDescription(desc);
processDefine.setLocations(locations);
processDefine.setConnects(connects);
processDefine.setTimeout(processData.getTimeout());
processDefine.setTenantId(processData.getTenantId());
processDefine.setModifyBy(loginUser.getUserName());
processDefine.setResourceIds(getResourceIds(processData));
List<Property> globalParamsList = processData.getGlobalParams();
if (CollectionUtils.isNotEmpty(globalParamsList)) {
Set<Property> globalParamsSet = new HashSet<>(globalParamsList);
globalParamsList = new ArrayList<>(globalParamsSet);
processDefine.setGlobalParamList(globalParamsList);
}
processDefine.setCreateTime(now);
processDefine.setUpdateTime(now);
processDefine.setFlag(Flag.YES);
processDefineMapper.insert(processDefine);
long version = processDefinitionVersionService.addProcessDefinitionVersion(processDefine);
processDefine.setVersion(version);
processDefineMapper.updateVersionByProcessDefinitionId(processDefine.getId(), version); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | result.put(Constants.DATA_LIST, processDefine.getId());
putMsg(result, Status.SUCCESS);
return result;
}
/**
* get resource ids
*
* @param processData process data
* @return resource ids
*/
private String getResourceIds(ProcessData processData) {
List<TaskNode> tasks = processData.getTasks();
Set<Integer> resourceIds = new HashSet<>();
StringBuilder sb = new StringBuilder();
if (CollectionUtils.isEmpty(tasks)) {
return sb.toString();
}
for (TaskNode taskNode : tasks) {
String taskParameter = taskNode.getParams();
AbstractParameters params = TaskParametersUtils.getParameters(taskNode.getType(), taskParameter);
if (params == null) {
continue;
}
if (CollectionUtils.isNotEmpty(params.getResourceFilesList())) {
Set<Integer> tempSet = params.getResourceFilesList().
stream()
.filter(t -> t.getId() != 0)
.map(ResourceInfo::getId)
.collect(Collectors.toSet()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | resourceIds.addAll(tempSet);
}
}
for (int i : resourceIds) {
if (sb.length() > 0) {
sb.append(",");
}
sb.append(i);
}
return sb.toString();
}
/**
* query process definition list
*
* @param loginUser login user
* @param projectName project name
* @return definition list
*/
@Override
public Map<String, Object> queryProcessDefinitionList(User loginUser, String projectName) {
HashMap<String, Object> result = new HashMap<>(5);
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
return checkResult;
}
List<ProcessDefinition> resourceList = processDefineMapper.queryAllDefinitionList(project.getId());
result.put(Constants.DATA_LIST, resourceList);
putMsg(result, Status.SUCCESS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return result;
}
/**
* query process definition list paging
*
* @param loginUser login user
* @param projectName project name
* @param searchVal search value
* @param pageNo page number
* @param pageSize page size
* @param userId user id
* @return process definition page
*/
@Override
public Map<String, Object> queryProcessDefinitionListPaging(User loginUser, String projectName, String searchVal, Integer pageNo, Integer pageSize, Integer userId) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
return checkResult;
}
Page<ProcessDefinition> page = new Page<>(pageNo, pageSize);
IPage<ProcessDefinition> processDefinitionIPage = processDefineMapper.queryDefineListPaging(
page, searchVal, userId, project.getId(), isAdmin(loginUser));
PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotalCount((int) processDefinitionIPage.getTotal());
pageInfo.setLists(processDefinitionIPage.getRecords());
result.put(Constants.DATA_LIST, pageInfo);
putMsg(result, Status.SUCCESS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return result;
}
/**
* query datail of process definition
*
* @param loginUser login user
* @param projectName project name
* @param processId process definition id
* @return process definition detail
*/
@Override
public Map<String, Object> queryProcessDefinitionById(User loginUser, String projectName, Integer processId) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
return checkResult;
}
ProcessDefinition processDefinition = processDefineMapper.selectById(processId);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId);
} else {
result.put(Constants.DATA_LIST, processDefinition);
putMsg(result, Status.SUCCESS);
}
return result;
}
@Override
public Map<String, Object> queryProcessDefinitionByName(User loginUser, String projectName, String processDefinitionName) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
return checkResult;
}
ProcessDefinition processDefinition = processDefineMapper.queryByDefineName(project.getId(),processDefinitionName);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionName);
} else {
result.put(Constants.DATA_LIST, processDefinition);
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* update process definition
*
* @param loginUser login user
* @param projectName project name
* @param name process definition name
* @param id process definition id
* @param processDefinitionJson process definition json
* @param desc description
* @param locations locations for nodes
* @param connects connects for nodes
* @return update result code
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | public Map<String, Object> updateProcessDefinition(User loginUser,
String projectName,
int id,
String name,
String processDefinitionJson,
String desc,
String locations,
String connects) {
Map<String, Object> result = new HashMap<>(5);
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
return checkResult;
}
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
Map<String, Object> checkProcessJson = checkProcessNodeList(processData, processDefinitionJson);
if ((checkProcessJson.get(Constants.STATUS) != Status.SUCCESS)) {
return checkProcessJson;
}
ProcessDefinition processDefine = processService.findProcessDefineById(id);
if (processDefine == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, id);
return result;
}
if (processDefine.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefine.getName());
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
if (!name.equals(processDefine.getName())) {
ProcessDefinition definition = processDefineMapper.verifyByDefineName(project.getId(), name);
if (definition != null) {
putMsg(result, Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR, name);
return result;
}
}
Date now = new Date();
processDefine.setId(id);
processDefine.setName(name);
processDefine.setReleaseState(ReleaseState.OFFLINE);
processDefine.setProjectId(project.getId());
processDefine.setProcessDefinitionJson(processDefinitionJson);
processDefine.setDescription(desc);
processDefine.setLocations(locations);
processDefine.setConnects(connects);
processDefine.setTimeout(processData.getTimeout());
processDefine.setTenantId(processData.getTenantId());
processDefine.setModifyBy(loginUser.getUserName());
processDefine.setResourceIds(getResourceIds(processData));
List<Property> globalParamsList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(processData.getGlobalParams())) {
Set<Property> userDefParamsSet = new HashSet<>(processData.getGlobalParams());
globalParamsList = new ArrayList<>(userDefParamsSet);
}
processDefine.setGlobalParamList(globalParamsList);
processDefine.setUpdateTime(now); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | processDefine.setFlag(Flag.YES);
long version = processDefinitionVersionService.addProcessDefinitionVersion(processDefine);
processDefine.setVersion(version);
if (processDefineMapper.updateById(processDefine) > 0) {
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefineMapper.queryByDefineId(id));
} else {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
return result;
}
/**
* verify process definition name unique
*
* @param loginUser login user
* @param projectName project name
* @param name name
* @return true if process definition name not exists, otherwise false
*/
@Override
public Map<String, Object> verifyProcessDefinitionName(User loginUser, String projectName, String name) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultEnum = (Status) checkResult.get(Constants.STATUS);
if (resultEnum != Status.SUCCESS) {
return checkResult;
}
ProcessDefinition processDefinition = processDefineMapper.verifyByDefineName(project.getId(), name); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (processDefinition == null) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR, name);
}
return result;
}
/**
* delete process definition by id
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionId process definition id
* @return delete result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> deleteProcessDefinitionById(User loginUser, String projectName, Integer processDefinitionId) {
Map<String, Object> result = new HashMap<>(5);
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultEnum = (Status) checkResult.get(Constants.STATUS);
if (resultEnum != Status.SUCCESS) {
return checkResult;
}
ProcessDefinition processDefinition = processDefineMapper.selectById(processDefinitionId);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionId);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | 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, processDefinitionId);
return result;
}
List<ProcessInstance> processInstances = processInstanceService.queryByProcessDefineIdAndStatus(processDefinitionId, Constants.NOT_TERMINATED_STATES);
if (CollectionUtils.isNotEmpty(processInstances)) {
putMsg(result, Status.DELETE_PROCESS_DEFINITION_BY_ID_FAIL, processInstances.size());
return result;
}
List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionId(processDefinitionId);
if (!schedules.isEmpty() && schedules.size() > 1) {
logger.warn("scheduler num is {},Greater than 1", schedules.size());
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR);
return result;
} else if (schedules.size() == 1) {
Schedule schedule = schedules.get(0);
if (schedule.getReleaseState() == ReleaseState.OFFLINE) {
scheduleMapper.deleteById(schedule.getId());
} else if (schedule.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, schedule.getId());
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
int delete = processDefineMapper.deleteById(processDefinitionId);
if (delete > 0) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR);
}
return result;
}
/**
* release process definition: online / offline
*
* @param loginUser login user
* @param projectName project name
* @param id process definition id
* @param releaseState release state
* @return release result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> releaseProcessDefinition(User loginUser, String projectName, int id, int releaseState) {
HashMap<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultEnum = (Status) checkResult.get(Constants.STATUS);
if (resultEnum != Status.SUCCESS) {
return checkResult;
}
ReleaseState state = ReleaseState.getEnum(releaseState); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (null == state) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
ProcessDefinition processDefinition = processDefineMapper.selectById(id);
switch (state) {
case ONLINE:
String resourceIds = processDefinition.getResourceIds();
if (StringUtils.isNotBlank(resourceIds)) {
Integer[] resourceIdArray = Arrays.stream(resourceIds.split(",")).map(Integer::parseInt).toArray(Integer[]::new);
PermissionCheck<Integer> permissionCheck = new PermissionCheck<>(AuthorizationType.RESOURCE_FILE_ID, processService, resourceIdArray, loginUser.getId(), logger);
try {
permissionCheck.checkPermission();
} catch (Exception e) {
logger.error(e.getMessage(), e);
putMsg(result, Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION, RELEASESTATE);
return result;
}
}
processDefinition.setReleaseState(state);
processDefineMapper.updateById(processDefinition);
break;
case OFFLINE:
processDefinition.setReleaseState(state);
processDefineMapper.updateById(processDefinition);
List<Schedule> scheduleList = scheduleMapper.selectAllByProcessDefineArray(
new int[]{processDefinition.getId()}
);
for (Schedule schedule : scheduleList) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | logger.info("set schedule offline, project id: {}, schedule id: {}, process definition id: {}", project.getId(), schedule.getId(), id);
schedule.setReleaseState(ReleaseState.OFFLINE);
scheduleMapper.updateById(schedule);
SchedulerService.deleteSchedule(project.getId(), schedule.getId());
}
break;
default:
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* batch export process definition by ids
*/
@Override
public void batchExportProcessDefinitionByIds(User loginUser, String projectName, String processDefinitionIds, HttpServletResponse response) {
if (StringUtils.isEmpty(processDefinitionIds)) {
return;
}
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
return;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | List<ProcessMeta> processDefinitionList =
getProcessDefinitionList(processDefinitionIds);
if (CollectionUtils.isNotEmpty(processDefinitionList)) {
downloadProcessDefinitionFile(response, processDefinitionList);
}
}
/**
* get process definition list by ids
*/
private List<ProcessMeta> getProcessDefinitionList(String processDefinitionIds) {
List<ProcessMeta> processDefinitionList = new ArrayList<>();
String[] processDefinitionIdArray = processDefinitionIds.split(",");
for (String strProcessDefinitionId : processDefinitionIdArray) {
int processDefinitionId = Integer.parseInt(strProcessDefinitionId);
ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(processDefinitionId);
if (null != processDefinition) {
processDefinitionList.add(exportProcessMetaData(processDefinitionId, processDefinition));
}
}
return processDefinitionList;
}
/**
* download the process definition file
*/
private void downloadProcessDefinitionFile(HttpServletResponse response, List<ProcessMeta> processDefinitionList) {
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
BufferedOutputStream buff = null;
ServletOutputStream out = null;
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | out = response.getOutputStream();
buff = new BufferedOutputStream(out);
buff.write(JSONUtils.toJsonString(processDefinitionList).getBytes(StandardCharsets.UTF_8));
buff.flush();
buff.close();
} catch (IOException e) {
logger.warn("export process fail", e);
} finally {
if (null != buff) {
try {
buff.close();
} catch (Exception e) {
logger.warn("export process buffer not close", e);
}
}
if (null != out) {
try {
out.close();
} catch (Exception e) {
logger.warn("export process output stream not close", e);
}
}
}
}
/**
* get export process metadata string
*
* @param processDefinitionId process definition id
* @param processDefinition process definition
* @return export process metadata string |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | */
public String exportProcessMetaDataStr(Integer processDefinitionId, ProcessDefinition processDefinition) {
return JSONUtils.toJsonString(exportProcessMetaData(processDefinitionId, processDefinition));
}
/**
* get export process metadata string
*
* @param processDefinitionId process definition id
* @param processDefinition process definition
* @return export process metadata string
*/
public ProcessMeta exportProcessMetaData(Integer processDefinitionId, ProcessDefinition processDefinition) {
String correctProcessDefinitionJson = addExportTaskNodeSpecialParam(processDefinition.getProcessDefinitionJson());
processDefinition.setProcessDefinitionJson(correctProcessDefinitionJson);
ProcessMeta exportProcessMeta = new ProcessMeta();
exportProcessMeta.setProjectName(processDefinition.getProjectName());
exportProcessMeta.setProcessDefinitionName(processDefinition.getName());
exportProcessMeta.setProcessDefinitionJson(processDefinition.getProcessDefinitionJson());
exportProcessMeta.setProcessDefinitionDescription(processDefinition.getDescription());
exportProcessMeta.setProcessDefinitionLocations(processDefinition.getLocations());
exportProcessMeta.setProcessDefinitionConnects(processDefinition.getConnects());
List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionId(processDefinitionId);
if (!schedules.isEmpty()) {
Schedule schedule = schedules.get(0);
exportProcessMeta.setScheduleWarningType(schedule.getWarningType().toString());
exportProcessMeta.setScheduleWarningGroupId(schedule.getWarningGroupId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | exportProcessMeta.setScheduleStartTime(DateUtils.dateToString(schedule.getStartTime()));
exportProcessMeta.setScheduleEndTime(DateUtils.dateToString(schedule.getEndTime()));
exportProcessMeta.setScheduleCrontab(schedule.getCrontab());
exportProcessMeta.setScheduleFailureStrategy(String.valueOf(schedule.getFailureStrategy()));
exportProcessMeta.setScheduleReleaseState(String.valueOf(ReleaseState.OFFLINE));
exportProcessMeta.setScheduleProcessInstancePriority(String.valueOf(schedule.getProcessInstancePriority()));
exportProcessMeta.setScheduleWorkerGroupName(schedule.getWorkerGroup());
}
return exportProcessMeta;
}
/**
* correct task param which has datasource or dependent
*
* @param processDefinitionJson processDefinitionJson
* @return correct processDefinitionJson
*/
private String addExportTaskNodeSpecialParam(String processDefinitionJson) {
ObjectNode jsonObject = JSONUtils.parseObject(processDefinitionJson);
ArrayNode jsonArray = (ArrayNode) jsonObject.path(TASKS);
for (int i = 0; i < jsonArray.size(); i++) {
JsonNode taskNode = jsonArray.path(i);
if (StringUtils.isNotEmpty(taskNode.path("type").asText())) {
String taskType = taskNode.path("type").asText();
ProcessAddTaskParam addTaskParam = TaskNodeParamFactory.getByTaskType(taskType);
if (null != addTaskParam) {
addTaskParam.addExportSpecialParam(taskNode);
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | jsonObject.set(TASKS, jsonArray);
return jsonObject.toString();
}
/**
* check task if has sub process
*
* @param taskType task type
* @return if task has sub process return true else false
*/
private boolean checkTaskHasSubProcess(String taskType) {
return taskType.equals(TaskType.SUB_PROCESS.name());
}
/**
* import process definition
*
* @param loginUser login user
* @param file process metadata json file
* @param currentProjectName current project name
* @return import process
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> importProcessDefinition(User loginUser, MultipartFile file, String currentProjectName) {
Map<String, Object> result = new HashMap<>(5);
String processMetaJson = FileUtils.file2String(file);
List<ProcessMeta> processMetaList = JSONUtils.toList(processMetaJson, ProcessMeta.class);
if (CollectionUtils.isEmpty(processMetaList)) {
putMsg(result, Status.DATA_IS_NULL, "fileContent");
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
for (ProcessMeta processMeta : processMetaList) {
if (!checkAndImportProcessDefinition(loginUser, currentProjectName, result, processMeta)) {
return result;
}
}
return result;
}
/**
* check and import process definition
*/
private boolean checkAndImportProcessDefinition(User loginUser, String currentProjectName, Map<String, Object> result, ProcessMeta processMeta) {
if (!checkImportanceParams(processMeta, result)) {
return false;
}
String processDefinitionName = processMeta.getProcessDefinitionName();
Project targetProject = projectMapper.queryByName(currentProjectName);
if (null != targetProject) {
processDefinitionName = recursionProcessDefinitionName(targetProject.getId(),
processDefinitionName, 1);
}
Map<String, Object> checkResult = verifyProcessDefinitionName(loginUser, currentProjectName, processDefinitionName);
Status status = (Status) checkResult.get(Constants.STATUS);
if (Status.SUCCESS.equals(status)) {
putMsg(result, Status.SUCCESS);
} else {
result.putAll(checkResult); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return false;
}
Map<String, Object> createProcessResult =
getCreateProcessResult(loginUser,
currentProjectName,
result,
processMeta,
processDefinitionName,
addImportTaskNodeParam(loginUser, processMeta.getProcessDefinitionJson(), targetProject));
if (createProcessResult == null) {
return false;
}
Integer processDefinitionId =
Objects.isNull(createProcessResult.get(Constants.DATA_LIST))
? null : Integer.parseInt(createProcessResult.get(Constants.DATA_LIST).toString());
return getImportProcessScheduleResult(loginUser,
currentProjectName,
result,
processMeta,
processDefinitionName,
processDefinitionId);
}
/**
* get create process result
*/
private Map<String, Object> getCreateProcessResult(User loginUser,
String currentProjectName, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Map<String, Object> result,
ProcessMeta processMeta,
String processDefinitionName,
String importProcessParam) {
Map<String, Object> createProcessResult = null;
try {
createProcessResult = createProcessDefinition(loginUser
, currentProjectName,
processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp(),
importProcessParam,
processMeta.getProcessDefinitionDescription(),
processMeta.getProcessDefinitionLocations(),
processMeta.getProcessDefinitionConnects());
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
logger.error("import process meta json data: {}", e.getMessage(), e);
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
}
return createProcessResult;
}
/**
* get import process schedule result
*/
private boolean getImportProcessScheduleResult(User loginUser,
String currentProjectName,
Map<String, Object> result,
ProcessMeta processMeta,
String processDefinitionName,
Integer processDefinitionId) {
if (null != processMeta.getScheduleCrontab() && null != processDefinitionId) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | int scheduleInsert = importProcessSchedule(loginUser,
currentProjectName,
processMeta,
processDefinitionName,
processDefinitionId);
if (0 == scheduleInsert) {
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
return false;
}
}
return true;
}
/**
* check importance params
*/
private boolean checkImportanceParams(ProcessMeta processMeta, Map<String, Object> result) {
if (StringUtils.isEmpty(processMeta.getProjectName())) {
putMsg(result, Status.DATA_IS_NULL, "projectName");
return false;
}
if (StringUtils.isEmpty(processMeta.getProcessDefinitionName())) {
putMsg(result, Status.DATA_IS_NULL, "processDefinitionName");
return false;
}
if (StringUtils.isEmpty(processMeta.getProcessDefinitionJson())) {
putMsg(result, Status.DATA_IS_NULL, "processDefinitionJson");
return false;
}
return true;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | /**
* import process add special task param
*
* @param loginUser login user
* @param processDefinitionJson process definition json
* @param targetProject target project
* @return import process param
*/
private String addImportTaskNodeParam(User loginUser, String processDefinitionJson, Project targetProject) {
ObjectNode jsonObject = JSONUtils.parseObject(processDefinitionJson);
ArrayNode jsonArray = (ArrayNode) jsonObject.get(TASKS);
for (int i = 0; i < jsonArray.size(); i++) {
JsonNode taskNode = jsonArray.path(i);
String taskType = taskNode.path("type").asText();
ProcessAddTaskParam addTaskParam = TaskNodeParamFactory.getByTaskType(taskType);
if (null != addTaskParam) {
addTaskParam.addImportSpecialParam(taskNode);
}
}
Map<Integer, Integer> subProcessIdMap = new HashMap<>(20);
List<Object> subProcessList = StreamUtils.asStream(jsonArray.elements())
.filter(elem -> checkTaskHasSubProcess(JSONUtils.parseObject(elem.toString()).path("type").asText()))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(subProcessList)) {
importSubProcess(loginUser, targetProject, jsonArray, subProcessIdMap);
}
jsonObject.set(TASKS, jsonArray);
return jsonObject.toString(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
/**
* import process schedule
*
* @param loginUser login user
* @param currentProjectName current project name
* @param processMeta process meta data
* @param processDefinitionName process definition name
* @param processDefinitionId process definition id
* @return insert schedule flag
*/
public int importProcessSchedule(User loginUser, String currentProjectName, ProcessMeta processMeta,
String processDefinitionName, Integer processDefinitionId) {
Date now = new Date();
Schedule scheduleObj = new Schedule();
scheduleObj.setProjectName(currentProjectName);
scheduleObj.setProcessDefinitionId(processDefinitionId);
scheduleObj.setProcessDefinitionName(processDefinitionName);
scheduleObj.setCreateTime(now);
scheduleObj.setUpdateTime(now);
scheduleObj.setUserId(loginUser.getId());
scheduleObj.setUserName(loginUser.getUserName());
scheduleObj.setCrontab(processMeta.getScheduleCrontab());
if (null != processMeta.getScheduleStartTime()) {
scheduleObj.setStartTime(DateUtils.stringToDate(processMeta.getScheduleStartTime()));
}
if (null != processMeta.getScheduleEndTime()) {
scheduleObj.setEndTime(DateUtils.stringToDate(processMeta.getScheduleEndTime()));
}
if (null != processMeta.getScheduleWarningType()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | scheduleObj.setWarningType(WarningType.valueOf(processMeta.getScheduleWarningType()));
}
if (null != processMeta.getScheduleWarningGroupId()) {
scheduleObj.setWarningGroupId(processMeta.getScheduleWarningGroupId());
}
if (null != processMeta.getScheduleFailureStrategy()) {
scheduleObj.setFailureStrategy(FailureStrategy.valueOf(processMeta.getScheduleFailureStrategy()));
}
if (null != processMeta.getScheduleReleaseState()) {
scheduleObj.setReleaseState(ReleaseState.valueOf(processMeta.getScheduleReleaseState()));
}
if (null != processMeta.getScheduleProcessInstancePriority()) {
scheduleObj.setProcessInstancePriority(Priority.valueOf(processMeta.getScheduleProcessInstancePriority()));
}
if (null != processMeta.getScheduleWorkerGroupName()) {
scheduleObj.setWorkerGroup(processMeta.getScheduleWorkerGroupName());
}
return scheduleMapper.insert(scheduleObj);
}
/**
* check import process has sub process
* recursion create sub process
*
* @param loginUser login user
* @param targetProject target project
* @param jsonArray process task array
* @param subProcessIdMap correct sub process id map
*/
private void importSubProcess(User loginUser, Project targetProject, ArrayNode jsonArray, Map<Integer, Integer> subProcessIdMap) {
for (int i = 0; i < jsonArray.size(); i++) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | ObjectNode taskNode = (ObjectNode) jsonArray.path(i);
String taskType = taskNode.path("type").asText();
if (!checkTaskHasSubProcess(taskType)) {
continue;
}
ObjectNode subParams = (ObjectNode) taskNode.path("params");
Integer subProcessId = subParams.path(PROCESSDEFINITIONID).asInt();
ProcessDefinition subProcess = processDefineMapper.queryByDefineId(subProcessId);
if (null == subProcess) {
continue;
}
String subProcessJson = subProcess.getProcessDefinitionJson();
ProcessDefinition currentProjectSubProcess = processDefineMapper.queryByDefineName(targetProject.getId(), subProcess.getName());
if (null == currentProjectSubProcess) {
ArrayNode subJsonArray = (ArrayNode) JSONUtils.parseObject(subProcess.getProcessDefinitionJson()).get(TASKS);
List<Object> subProcessList = StreamUtils.asStream(subJsonArray.elements())
.filter(item -> checkTaskHasSubProcess(JSONUtils.parseObject(item.toString()).path("type").asText()))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(subProcessList)) {
importSubProcess(loginUser, targetProject, subJsonArray, subProcessIdMap);
if (!subProcessIdMap.isEmpty()) {
for (Map.Entry<Integer, Integer> entry : subProcessIdMap.entrySet()) {
String oldSubProcessId = "\"processDefinitionId\":" + entry.getKey();
String newSubProcessId = "\"processDefinitionId\":" + entry.getValue();
subProcessJson = subProcessJson.replaceAll(oldSubProcessId, newSubProcessId);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | subProcessIdMap.clear();
}
}
Date now = new Date();
ProcessDefinition processDefine = new ProcessDefinition();
processDefine.setName(subProcess.getName());
processDefine.setVersion(subProcess.getVersion());
processDefine.setReleaseState(subProcess.getReleaseState());
processDefine.setProjectId(targetProject.getId());
processDefine.setUserId(loginUser.getId());
processDefine.setProcessDefinitionJson(subProcessJson);
processDefine.setDescription(subProcess.getDescription());
processDefine.setLocations(subProcess.getLocations());
processDefine.setConnects(subProcess.getConnects());
processDefine.setTimeout(subProcess.getTimeout());
processDefine.setTenantId(subProcess.getTenantId());
processDefine.setGlobalParams(subProcess.getGlobalParams());
processDefine.setCreateTime(now);
processDefine.setUpdateTime(now);
processDefine.setFlag(subProcess.getFlag());
processDefine.setWarningGroupId(subProcess.getWarningGroupId());
processDefineMapper.insert(processDefine);
logger.info("create sub process, project: {}, process name: {}", targetProject.getName(), processDefine.getName());
ProcessDefinition newSubProcessDefine = processDefineMapper.queryByDefineName(processDefine.getProjectId(), processDefine.getName());
if (null != newSubProcessDefine) {
subProcessIdMap.put(subProcessId, newSubProcessDefine.getId());
subParams.put(PROCESSDEFINITIONID, newSubProcessDefine.getId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | taskNode.set("params", subParams);
}
}
}
}
/**
* check the process definition node meets the specifications
*
* @param processData process data
* @param processDefinitionJson process definition json
* @return check result code
*/
@Override
public Map<String, Object> checkProcessNodeList(ProcessData processData, String processDefinitionJson) {
Map<String, Object> result = new HashMap<>();
try {
if (processData == null) {
logger.error("process data is null");
putMsg(result, Status.DATA_IS_NOT_VALID, processDefinitionJson);
return result;
}
List<TaskNode> taskNodes = processData.getTasks();
if (taskNodes == null) {
logger.error("process node info is empty");
putMsg(result, Status.DATA_IS_NULL, processDefinitionJson);
return result;
}
if (graphHasCycle(taskNodes)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | logger.error("process DAG has cycle");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result;
}
for (TaskNode taskNode : taskNodes) {
if (!CheckUtils.checkTaskNodeParameters(taskNode.getParams(), taskNode.getType())) {
logger.error("task node {} parameter invalid", taskNode.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName());
return result;
}
CheckUtils.checkOtherParams(taskNode.getExtras());
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
result.put(Constants.MSG, e.getMessage());
}
return result;
}
/**
* get task node details based on process definition
*
* @param defineId define id
* @return task node list
*/
@Override
public Map<String, Object> getTaskNodeListByDefinitionId(Integer defineId) {
Map<String, Object> result = new HashMap<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | ProcessDefinition processDefinition = processDefineMapper.selectById(defineId);
if (processDefinition == null) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineId);
return result;
}
String processDefinitionJson = processDefinition.getProcessDefinitionJson();
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
if (null == processData) {
logger.error("process data is null");
putMsg(result, Status.DATA_IS_NOT_VALID, processDefinitionJson);
return result;
}
List<TaskNode> taskNodeList = (processData.getTasks() == null) ? new ArrayList<>() : processData.getTasks();
result.put(Constants.DATA_LIST, taskNodeList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* get task node details based on process definition
*
* @param defineIdList define id list
* @return task node list
*/
@Override
public Map<String, Object> getTaskNodeListByDefinitionIdList(String defineIdList) {
Map<String, Object> result = new HashMap<>();
Map<Integer, List<TaskNode>> taskNodeMap = new HashMap<>();
String[] idList = defineIdList.split(","); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | List<Integer> idIntList = new ArrayList<>();
for (String definitionId : idList) {
idIntList.add(Integer.parseInt(definitionId));
}
Integer[] idArray = idIntList.toArray(new Integer[0]);
List<ProcessDefinition> processDefinitionList = processDefineMapper.queryDefinitionListByIdList(idArray);
if (CollectionUtils.isEmpty(processDefinitionList)) {
logger.info("process definition not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineIdList);
return result;
}
for (ProcessDefinition processDefinition : processDefinitionList) {
String processDefinitionJson = processDefinition.getProcessDefinitionJson();
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
List<TaskNode> taskNodeList = (processData.getTasks() == null) ? new ArrayList<>() : processData.getTasks();
taskNodeMap.put(processDefinition.getId(), taskNodeList);
}
result.put(Constants.DATA_LIST, taskNodeMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition all by project id
*
* @param projectId project id
* @return process definitions in the project
*/
@Override
public Map<String, Object> queryProcessDefinitionAllByProjectId(Integer projectId) {
HashMap<String, Object> result = new HashMap<>(5); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | List<ProcessDefinition> resourceList = processDefineMapper.queryAllDefinitionList(projectId);
result.put(Constants.DATA_LIST, resourceList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* Encapsulates the TreeView structure
*
* @param processId process definition id
* @param limit limit
* @return tree view json data
* @throws Exception exception
*/
@Override
public Map<String, Object> viewTree(Integer processId, Integer limit) throws Exception {
Map<String, Object> result = new HashMap<>();
ProcessDefinition processDefinition = processDefineMapper.selectById(processId);
if (null == processDefinition) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinition);
return result;
}
DAG<String, TaskNode, TaskNodeRelation> dag = genDagGraph(processDefinition);
/**
* nodes that is running
*/
Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>();
/**
* nodes that is waiting torun
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>();
/**
* List of process instances
*/
List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineId(processId, limit);
for (ProcessInstance processInstance : processInstanceList) {
processInstance.setDuration(DateUtils.differSec(processInstance.getStartTime(), processInstance.getEndTime()));
}
if (limit > processInstanceList.size()) {
limit = processInstanceList.size();
}
TreeViewDto parentTreeViewDto = new TreeViewDto();
parentTreeViewDto.setName("DAG");
parentTreeViewDto.setType("");
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime();
parentTreeViewDto.getInstances().add(new Instance(processInstance.getId(), processInstance.getName(), "", processInstance.getState().toString()
, processInstance.getStartTime(), endTime, processInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime())));
}
List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>();
parentTreeViewDtoList.add(parentTreeViewDto);
for (String startNode : dag.getBeginNode()) {
runningNodeMap.put(startNode, parentTreeViewDtoList);
}
while (Stopper.isRunning()) {
Set<String> postNodeList = null;
Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | while (iter.hasNext()) {
Map.Entry<String, List<TreeViewDto>> en = iter.next();
String nodeName = en.getKey();
parentTreeViewDtoList = en.getValue();
TreeViewDto treeViewDto = new TreeViewDto();
treeViewDto.setName(nodeName);
TaskNode taskNode = dag.getNode(nodeName);
treeViewDto.setType(taskNode.getType());
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndName(processInstance.getId(), nodeName);
if (taskInstance == null) {
treeViewDto.getInstances().add(new Instance(-1, "not running", "null"));
} else {
Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime();
Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime();
int subProcessId = 0;
/**
* if process is sub process, the return sub id, or sub id=0
*/
if (taskInstance.getTaskType().equals(TaskType.SUB_PROCESS.name())) {
String taskJson = taskInstance.getTaskJson();
taskNode = JSONUtils.parseObject(taskJson, TaskNode.class);
subProcessId = Integer.parseInt(JSONUtils.parseObject(
taskNode.getParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_ID).asText());
}
treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(), taskInstance.getTaskType(), taskInstance.getState().toString()
, taskInstance.getStartTime(), taskInstance.getEndTime(), taskInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessId));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) {
pTreeViewDto.getChildren().add(treeViewDto);
}
postNodeList = dag.getSubsequentNodes(nodeName);
if (CollectionUtils.isNotEmpty(postNodeList)) {
for (String nextNodeName : postNodeList) {
List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeName);
if (CollectionUtils.isEmpty(treeViewDtoList)) {
treeViewDtoList = new ArrayList<>();
}
treeViewDtoList.add(treeViewDto);
waitingRunningNodeMap.put(nextNodeName, treeViewDtoList);
}
}
runningNodeMap.remove(nodeName);
}
if (waitingRunningNodeMap == null || waitingRunningNodeMap.size() == 0) {
break;
} else {
runningNodeMap.putAll(waitingRunningNodeMap);
waitingRunningNodeMap.clear();
}
}
result.put(Constants.DATA_LIST, parentTreeViewDto);
result.put(Constants.STATUS, Status.SUCCESS);
result.put(Constants.MSG, Status.SUCCESS.getMsg());
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * Generate the DAG Graph based on the process definition id
*
* @param processDefinition process definition
* @return dag graph
*/
private DAG<String, TaskNode, TaskNodeRelation> genDagGraph(ProcessDefinition processDefinition) {
String processDefinitionJson = processDefinition.getProcessDefinitionJson();
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
if (null != processData) {
List<TaskNode> taskNodeList = processData.getTasks();
processDefinition.setGlobalParamList(processData.getGlobalParams());
ProcessDag processDag = DagHelper.getProcessDag(taskNodeList);
return DagHelper.buildDagGraph(processDag);
}
return new DAG<>();
}
/**
* whether the graph has a ring
*
* @param taskNodeResponseList task node response list
* @return if graph has cycle flag
*/
private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) {
DAG<String, TaskNode, String> graph = new DAG<>();
for (TaskNode taskNodeResponse : taskNodeResponseList) {
graph.addNode(taskNodeResponse.getName(), taskNodeResponse);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | for (TaskNode taskNodeResponse : taskNodeResponseList) {
taskNodeResponse.getPreTasks();
List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(), String.class);
if (CollectionUtils.isNotEmpty(preTasks)) {
for (String preTask : preTasks) {
if (!graph.addEdge(preTask, taskNodeResponse.getName())) {
return true;
}
}
}
}
return graph.hasCycle();
}
private String recursionProcessDefinitionName(Integer projectId, String processDefinitionName, int num) {
ProcessDefinition processDefinition = processDefineMapper.queryByDefineName(projectId, processDefinitionName);
if (processDefinition != null) {
if (num > 1) {
String str = processDefinitionName.substring(0, processDefinitionName.length() - 3);
processDefinitionName = str + "(" + num + ")";
} else {
processDefinitionName = processDefinition.getName() + "(" + num + ")";
}
} else {
return processDefinitionName;
}
return recursionProcessDefinitionName(projectId, processDefinitionName, num + 1);
}
private Map<String, Object> copyProcessDefinition(User loginUser,
Integer processId, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Project targetProject) throws JsonProcessingException {
Map<String, Object> result = new HashMap<>(5);
ProcessDefinition processDefinition = processDefineMapper.selectById(processId);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId);
return result;
} else {
return createProcessDefinition(
loginUser,
targetProject.getName(),
processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp(),
processDefinition.getProcessDefinitionJson(),
processDefinition.getDescription(),
processDefinition.getLocations(),
processDefinition.getConnects());
}
}
/**
* batch copy process definition
*
* @param loginUser loginUser
* @param projectName projectName
* @param processDefinitionIds processDefinitionIds
* @param targetProjectId targetProjectId
*/
@Override
public Map<String, Object> batchCopyProcessDefinition(User loginUser,
String projectName,
String processDefinitionIds,
int targetProjectId) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Map<String, Object> result = new HashMap<>();
List<String> failedProcessList = new ArrayList<>();
if (StringUtils.isEmpty(processDefinitionIds)) {
putMsg(result, Status.PROCESS_DEFINITION_IDS_IS_EMPTY, processDefinitionIds);
return result;
}
Map<String, Object> checkResult = checkProjectAndAuth(loginUser, projectName);
if (checkResult != null) {
return checkResult;
}
Project targetProject = projectMapper.queryDetailById(targetProjectId);
if (targetProject == null) {
putMsg(result, Status.PROJECT_NOT_FOUNT, targetProjectId);
return result;
}
if (!(targetProject.getName()).equals(projectName)) {
Map<String, Object> checkTargetProjectResult = checkProjectAndAuth(loginUser, targetProject.getName());
if (checkTargetProjectResult != null) {
return checkTargetProjectResult;
}
}
String[] processDefinitionIdList = processDefinitionIds.split(Constants.COMMA);
doBatchCopyProcessDefinition(loginUser, targetProject, failedProcessList, processDefinitionIdList);
checkBatchOperateResult(projectName, targetProject.getName(), result, failedProcessList, true);
return result;
}
/**
* batch move process definition
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param loginUser loginUser
* @param projectName projectName
* @param processDefinitionIds processDefinitionIds
* @param targetProjectId targetProjectId
*/
@Override
public Map<String, Object> batchMoveProcessDefinition(User loginUser,
String projectName,
String processDefinitionIds,
int targetProjectId) {
Map<String, Object> result = new HashMap<>();
List<String> failedProcessList = new ArrayList<>();
Map<String, Object> checkResult = checkProjectAndAuth(loginUser, projectName);
if (checkResult != null) {
return checkResult;
}
if (StringUtils.isEmpty(processDefinitionIds)) {
putMsg(result, Status.PROCESS_DEFINITION_IDS_IS_EMPTY, processDefinitionIds);
return result;
}
Project targetProject = projectMapper.queryDetailById(targetProjectId);
if (targetProject == null) {
putMsg(result, Status.PROJECT_NOT_FOUNT, targetProjectId);
return result;
}
if (!(targetProject.getName()).equals(projectName)) {
Map<String, Object> checkTargetProjectResult = checkProjectAndAuth(loginUser, targetProject.getName());
if (checkTargetProjectResult != null) {
return checkTargetProjectResult; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
}
String[] processDefinitionIdList = processDefinitionIds.split(Constants.COMMA);
doBatchMoveProcessDefinition(targetProject, failedProcessList, processDefinitionIdList);
checkBatchOperateResult(projectName, targetProject.getName(), result, failedProcessList, false);
return result;
}
/**
* switch the defined process definition verison
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionId process definition id
* @param version the version user want to switch
* @return switch process definition version result code
*/
@Override
public Map<String, Object> switchProcessDefinitionVersion(User loginUser, String projectName
, int processDefinitionId, long version) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
return checkResult;
}
ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(processDefinitionId);
if (Objects.isNull(processDefinition)) {
putMsg(result |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,493 | [Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type | **Describe the question**
The Process Definition interface parameter releaseState is changed to an enumeration type
**What are the current deficiencies and the benefits of improvement**
- The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code
**Which version of DolphinScheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4493 | https://github.com/apache/dolphinscheduler/pull/4494 | 046940b1a008c63d6cad44b3f7aff954f6f9af83 | cfa88a4a804b3bc565f6571d5a6e842df18644a2 | "2021-01-19T10:21:18Z" | java | "2021-01-22T14:39:58Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | , Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR
, processDefinitionId);
return result;
}
ProcessDefinitionVersion processDefinitionVersion = processDefinitionVersionService
.queryByProcessDefinitionIdAndVersion(processDefinitionId, version);
if (Objects.isNull(processDefinitionVersion)) {
putMsg(result
, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR
, processDefinitionId
, version);
return result;
}
processDefinition.setVersion(processDefinitionVersion.getVersion());
processDefinition.setProcessDefinitionJson(processDefinitionVersion.getProcessDefinitionJson());
processDefinition.setDescription(processDefinitionVersion.getDescription());
processDefinition.setLocations(processDefinitionVersion.getLocations());
processDefinition.setConnects(processDefinitionVersion.getConnects());
processDefinition.setTimeout(processDefinitionVersion.getTimeout());
processDefinition.setGlobalParams(processDefinitionVersion.getGlobalParams());
processDefinition.setUpdateTime(new Date());
processDefinition.setWarningGroupId(processDefinitionVersion.getWarningGroupId());
processDefinition.setResourceIds(processDefinitionVersion.getResourceIds());
if (processDefineMapper.updateById(processDefinition) > 0) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
}
return result;
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.