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
timestamp[us, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,432
[Bug] [Standalone] table t_ds_worker_group not found in standalone mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened table t_ds_worker_group not found in standalone mode ### What you expected to happen running successfully. ### How to reproduce running standalone server. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8432
https://github.com/apache/dolphinscheduler/pull/8433
668b36c73187279349ee91e128791926b1bbc86b
8200a3f15ab5c7de0ea8e4d356ce968c6380e42a
2022-02-18T11:10:48Z
java
2022-02-18T13:46:52Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
logger.debug("worker group node : {} update, data: {}", path, data); String group = parseGroup(path); Collection<String> currentNodes = registryClient.getWorkerGroupNodesDirectly(group); syncWorkerGroupNodes(group, currentNodes); String node = parseNode(path); syncSingleWorkerNodeInfo(node, data); } } catch (IllegalArgumentException ex) { logger.warn(ex.getMessage()); } catch (Exception ex) { logger.error("WorkerGroupListener capture data change and get data failed", ex); } } } private String parseGroup(String path) { String[] parts = path.split("/"); if (parts.length < WORKER_LISTENER_CHECK_LENGTH) { throw new IllegalArgumentException(String.format("worker group path : %s is not valid, ignore", path)); } return parts[parts.length - 2]; } private String parseNode(String path) { String[] parts = path.split("/"); if (parts.length < WORKER_LISTENER_CHECK_LENGTH) { throw new IllegalArgumentException(String.format("worker group path : %s is not valid, ignore", path)); } return parts[parts.length - 1]; } } class MasterDataListener implements SubscribeListener {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,432
[Bug] [Standalone] table t_ds_worker_group not found in standalone mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened table t_ds_worker_group not found in standalone mode ### What you expected to happen running successfully. ### How to reproduce running standalone server. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8432
https://github.com/apache/dolphinscheduler/pull/8433
668b36c73187279349ee91e128791926b1bbc86b
8200a3f15ab5c7de0ea8e4d356ce968c6380e42a
2022-02-18T11:10:48Z
java
2022-02-18T13:46:52Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
@Override public void notify(Event event) { final String path = event.path(); final Type type = event.type(); if (registryClient.isMasterPath(path)) { try { if (type.equals(Type.ADD)) { logger.info("master node : {} added.", path); updateMasterNodes(); } if (type.equals(Type.REMOVE)) { logger.info("master node : {} down.", path); updateMasterNodes(); alertDao.sendServerStopedAlert(1, path, "MASTER"); } } catch (Exception ex) { logger.error("MasterNodeListener capture data change and get data failed.", ex); } } } } private void updateMasterNodes() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,432
[Bug] [Standalone] table t_ds_worker_group not found in standalone mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened table t_ds_worker_group not found in standalone mode ### What you expected to happen running successfully. ### How to reproduce running standalone server. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8432
https://github.com/apache/dolphinscheduler/pull/8433
668b36c73187279349ee91e128791926b1bbc86b
8200a3f15ab5c7de0ea8e4d356ce968c6380e42a
2022-02-18T11:10:48Z
java
2022-02-18T13:46:52Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
MASTER_SLOT = 0; this.masterNodes.clear(); String nodeLock = Constants.REGISTRY_DOLPHINSCHEDULER_LOCK_MASTERS; try { registryClient.getLock(nodeLock); Collection<String> currentNodes = registryClient.getMasterNodesDirectly(); List<Server> masterNodes = registryClient.getServerList(NodeType.MASTER); syncMasterNodes(currentNodes, masterNodes); } catch (Exception e) { logger.error("update master nodes error", e); } finally { registryClient.releaseLock(nodeLock); } } /** * get master nodes * * @return master nodes */ public Set<String> getMasterNodes() { masterLock.lock(); try { return Collections.unmodifiableSet(masterNodes); } finally { masterLock.unlock(); } } /** * sync master nodes *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,432
[Bug] [Standalone] table t_ds_worker_group not found in standalone mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened table t_ds_worker_group not found in standalone mode ### What you expected to happen running successfully. ### How to reproduce running standalone server. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8432
https://github.com/apache/dolphinscheduler/pull/8433
668b36c73187279349ee91e128791926b1bbc86b
8200a3f15ab5c7de0ea8e4d356ce968c6380e42a
2022-02-18T11:10:48Z
java
2022-02-18T13:46:52Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
* @param nodes master nodes */ private void syncMasterNodes(Collection<String> nodes, List<Server> masterNodes) { masterLock.lock(); try { String host = NetUtils.getHost(); this.masterNodes.addAll(nodes); this.masterPriorityQueue.clear(); this.masterPriorityQueue.putList(masterNodes); int index = masterPriorityQueue.getIndex(host); if (index >= 0) { MASTER_SIZE = nodes.size(); MASTER_SLOT = index; } else { logger.warn("current host:{} is not in active master list", host); } logger.info("update master nodes, master size: {}, slot: {}", MASTER_SIZE, MASTER_SLOT); } finally { masterLock.unlock(); } } /** * sync worker group nodes * * @param workerGroup worker group * @param nodes worker nodes */ private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,432
[Bug] [Standalone] table t_ds_worker_group not found in standalone mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened table t_ds_worker_group not found in standalone mode ### What you expected to happen running successfully. ### How to reproduce running standalone server. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8432
https://github.com/apache/dolphinscheduler/pull/8433
668b36c73187279349ee91e128791926b1bbc86b
8200a3f15ab5c7de0ea8e4d356ce968c6380e42a
2022-02-18T11:10:48Z
java
2022-02-18T13:46:52Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } public Map<String, Set<String>> getWorkerGroupNodes() { return Collections.unmodifiableMap(workerGroupNodes); } /** * get worker group nodes * * @param workerGroup workerGroup * @return worker nodes */ public Set<String> getWorkerGroupNodes(String workerGroup) { workerGroupLock.lock(); try { if (StringUtils.isEmpty(workerGroup)) { workerGroup = Constants.DEFAULT_WORKER_GROUP; } workerGroup = workerGroup.toLowerCase(); Set<String> nodes = workerGroupNodes.get(workerGroup); if (CollectionUtils.isNotEmpty(nodes)) { return Collections.unmodifiableSet(nodes); } return nodes;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,432
[Bug] [Standalone] table t_ds_worker_group not found in standalone mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened table t_ds_worker_group not found in standalone mode ### What you expected to happen running successfully. ### How to reproduce running standalone server. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8432
https://github.com/apache/dolphinscheduler/pull/8433
668b36c73187279349ee91e128791926b1bbc86b
8200a3f15ab5c7de0ea8e4d356ce968c6380e42a
2022-02-18T11:10:48Z
java
2022-02-18T13:46:52Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
} finally { workerGroupLock.unlock(); } } /** * get worker node info * * @return worker node info */ public Map<String, String> getWorkerNodeInfo() { return Collections.unmodifiableMap(workerNodeInfo); } /** * get worker node info * * @param workerNode worker node * @return worker node info */ public String getWorkerNodeInfo(String workerNode) { workerNodeInfoLock.lock(); try { return workerNodeInfo.getOrDefault(workerNode, null); } finally { workerNodeInfoLock.unlock(); } } /** * sync worker node info * * @param newWorkerNodeInfo new worker node info
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,432
[Bug] [Standalone] table t_ds_worker_group not found in standalone mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened table t_ds_worker_group not found in standalone mode ### What you expected to happen running successfully. ### How to reproduce running standalone server. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8432
https://github.com/apache/dolphinscheduler/pull/8433
668b36c73187279349ee91e128791926b1bbc86b
8200a3f15ab5c7de0ea8e4d356ce968c6380e42a
2022-02-18T11:10:48Z
java
2022-02-18T13:46:52Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
*/ private void syncAllWorkerNodeInfo(Map<String, String> newWorkerNodeInfo) { workerNodeInfoLock.lock(); try { workerNodeInfo.clear(); workerNodeInfo.putAll(newWorkerNodeInfo); } finally { workerNodeInfoLock.unlock(); } } /** * sync single worker node info */ private void syncSingleWorkerNodeInfo(String node, String info) { workerNodeInfoLock.lock(); try { workerNodeInfo.put(node, info); } finally { workerNodeInfoLock.unlock(); } } /** * destroy */ @PreDestroy public void destroy() { executorService.shutdownNow(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,135
[Bug] [DataSource] jdbc connect parameters can not input '@'
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In 2.0.2 version, when I create hive datasource with kerberos, then need input principal to jdbc connect parameters, when Test connect , The error is reported below ![image](https://user-images.githubusercontent.com/13765310/150292211-af7d1fb0-51f5-4eab-990e-5bf223248577.png) ### What you expected to happen when input correct principal, can connect to hive ![image](https://user-images.githubusercontent.com/13765310/150292515-7f4dbd33-d91d-416e-b300-3d9db9e19500.png) ### How to reproduce in AbstractDatasourceProcessor.java, modify PARAMS_PATTER field, appropriate value is > private static final PARAMS_PATTER = Pattern.compile("^[a-zA-Z0-9\\-\\_\\/\\@\\.]+$"); ### Anything else _No response_ ### Version 2.0.2 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8135
https://github.com/apache/dolphinscheduler/pull/8293
8200a3f15ab5c7de0ea8e4d356ce968c6380e42a
2a1406073a73b349f63396567919f81a802785d8
2022-01-20T07:29:54Z
java
2022-02-18T13:58:43Z
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.plugin.datasource.api.datasource; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.commons.collections4.MapUtils; import java.text.MessageFormat; import java.util.Map; import java.util.regex.Pattern; public abstract class AbstractDataSourceProcessor implements DataSourceProcessor {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,135
[Bug] [DataSource] jdbc connect parameters can not input '@'
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In 2.0.2 version, when I create hive datasource with kerberos, then need input principal to jdbc connect parameters, when Test connect , The error is reported below ![image](https://user-images.githubusercontent.com/13765310/150292211-af7d1fb0-51f5-4eab-990e-5bf223248577.png) ### What you expected to happen when input correct principal, can connect to hive ![image](https://user-images.githubusercontent.com/13765310/150292515-7f4dbd33-d91d-416e-b300-3d9db9e19500.png) ### How to reproduce in AbstractDatasourceProcessor.java, modify PARAMS_PATTER field, appropriate value is > private static final PARAMS_PATTER = Pattern.compile("^[a-zA-Z0-9\\-\\_\\/\\@\\.]+$"); ### Anything else _No response_ ### Version 2.0.2 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8135
https://github.com/apache/dolphinscheduler/pull/8293
8200a3f15ab5c7de0ea8e4d356ce968c6380e42a
2a1406073a73b349f63396567919f81a802785d8
2022-01-20T07:29:54Z
java
2022-02-18T13:58:43Z
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java
private static final Pattern IPV4_PATTERN = Pattern.compile("^[a-zA-Z0-9\\_\\-\\.\\,]+$"); private static final Pattern IPV6_PATTERN = Pattern.compile("^[a-zA-Z0-9\\_\\-\\.\\:\\[\\]\\,]+$"); private static final Pattern DATABASE_PATTER = Pattern.compile("^[a-zA-Z0-9\\_\\-\\.]+$"); private static final Pattern PARAMS_PATTER = Pattern.compile("^[a-zA-Z0-9\\-\\_\\/]+$"); @Override public void checkDatasourceParam(BaseDataSourceParamDTO baseDataSourceParamDTO) { checkHost(baseDataSourceParamDTO.getHost()); checkDatasourcePatter(baseDataSourceParamDTO.getDatabase()); checkOther(baseDataSourceParamDTO.getOther()); } /** * Check the host is valid * * @param host datasource host */ protected void checkHost(String host) { if (!IPV4_PATTERN.matcher(host).matches() || !IPV6_PATTERN.matcher(host).matches()) { throw new IllegalArgumentException("datasource host illegal"); } } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,135
[Bug] [DataSource] jdbc connect parameters can not input '@'
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In 2.0.2 version, when I create hive datasource with kerberos, then need input principal to jdbc connect parameters, when Test connect , The error is reported below ![image](https://user-images.githubusercontent.com/13765310/150292211-af7d1fb0-51f5-4eab-990e-5bf223248577.png) ### What you expected to happen when input correct principal, can connect to hive ![image](https://user-images.githubusercontent.com/13765310/150292515-7f4dbd33-d91d-416e-b300-3d9db9e19500.png) ### How to reproduce in AbstractDatasourceProcessor.java, modify PARAMS_PATTER field, appropriate value is > private static final PARAMS_PATTER = Pattern.compile("^[a-zA-Z0-9\\-\\_\\/\\@\\.]+$"); ### Anything else _No response_ ### Version 2.0.2 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8135
https://github.com/apache/dolphinscheduler/pull/8293
8200a3f15ab5c7de0ea8e4d356ce968c6380e42a
2a1406073a73b349f63396567919f81a802785d8
2022-01-20T07:29:54Z
java
2022-02-18T13:58:43Z
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java
* check database name is valid * * @param database database name */ protected void checkDatasourcePatter(String database) { if (!DATABASE_PATTER.matcher(database).matches()) { throw new IllegalArgumentException("datasource name illegal"); } } /** * check other is valid * * @param other other */ protected void checkOther(Map<String, String> other) { if (MapUtils.isEmpty(other)) { return; } boolean paramsCheck = other.entrySet().stream().allMatch(p -> PARAMS_PATTER.matcher(p.getValue()).matches()); if (!paramsCheck) { throw new IllegalArgumentException("datasource other params illegal"); } } @Override public String getDatasourceUniqueId(ConnectionParam connectionParam, DbType dbType) { BaseConnectionParam baseConnectionParam = (BaseConnectionParam) connectionParam; return MessageFormat.format("{0}@{1}@{2}", dbType.getDescp(), baseConnectionParam.getUser(), baseConnectionParam.getJdbcUrl()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.master.registry; import static org.apache.dolphinscheduler.common.Constants.REGISTRY_DOLPHINSCHEDULER_MASTERS; import static org.apache.dolphinscheduler.common.Constants.REGISTRY_DOLPHINSCHEDULER_WORKERS; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.NodeType; import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.common.utils.NetUtils; import org.apache.dolphinscheduler.dao.AlertDao; import org.apache.dolphinscheduler.dao.entity.WorkerGroup; import org.apache.dolphinscheduler.dao.mapper.WorkerGroupMapper; import org.apache.dolphinscheduler.registry.api.Event;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
import org.apache.dolphinscheduler.registry.api.Event.Type; import org.apache.dolphinscheduler.registry.api.SubscribeListener; import org.apache.dolphinscheduler.remote.utils.NamedThreadFactory; import org.apache.dolphinscheduler.service.queue.MasterPriorityQueue; import org.apache.dolphinscheduler.service.registry.RegistryClient; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import javax.annotation.PreDestroy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * server node manager */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
public class ServerNodeManager implements InitializingBean { private final Logger logger = LoggerFactory.getLogger(ServerNodeManager.class); /** * master lock */ private final Lock masterLock = new ReentrantLock(); /** * worker group lock */ private final Lock workerGroupLock = new ReentrantLock();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
/** * worker node info lock */ private final Lock workerNodeInfoLock = new ReentrantLock(); /** * worker group nodes */ private final ConcurrentHashMap<String, Set<String>> workerGroupNodes = new ConcurrentHashMap<>(); /** * master nodes */ private final Set<String> masterNodes = new HashSet<>(); /** * worker node info */ private final Map<String, String> workerNodeInfo = new HashMap<>(); /** * executor service */ private ScheduledExecutorService executorService; @Autowired private RegistryClient registryClient; /** * eg : /node/worker/group/127.0.0.1:xxx */ private static final int WORKER_LISTENER_CHECK_LENGTH = 5; /** * worker group mapper */ @Autowired
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
private WorkerGroupMapper workerGroupMapper; private final MasterPriorityQueue masterPriorityQueue = new MasterPriorityQueue(); /** * alert dao */ @Autowired private AlertDao alertDao; private static volatile int MASTER_SLOT = 0; private static volatile int MASTER_SIZE = 0; public static int getSlot() { return MASTER_SLOT; } public static int getMasterSize() { return MASTER_SIZE; } /** * init listener * * @throws Exception if error throws Exception */ @Override public void afterPropertiesSet() throws Exception { /** * load nodes from zookeeper */ load(); /** * init executor service */ executorService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("ServerNodeManagerExecutor"));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
executorService.scheduleWithFixedDelay(new WorkerNodeInfoAndGroupDbSyncTask(), 0, 10, TimeUnit.SECONDS); /* * init MasterNodeListener listener */ registryClient.subscribe(REGISTRY_DOLPHINSCHEDULER_MASTERS, new MasterDataListener()); /* * init WorkerNodeListener listener */ registryClient.subscribe(REGISTRY_DOLPHINSCHEDULER_WORKERS, new WorkerDataListener()); } /** * load nodes from zookeeper */ public void load() { /* * master nodes from zookeeper */ updateMasterNodes(); /* * worker group nodes from zookeeper */ Collection<String> workerGroups = registryClient.getWorkerGroupDirectly(); for (String workerGroup : workerGroups) { syncWorkerGroupNodes(workerGroup, registryClient.getWorkerGroupNodesDirectly(workerGroup)); } } /** * worker node info and worker group db sync task */ class WorkerNodeInfoAndGroupDbSyncTask implements Runnable {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
@Override public void run() { try { Map<String, String> newWorkerNodeInfo = registryClient.getServerMaps(NodeType.WORKER, true); syncAllWorkerNodeInfo(newWorkerNodeInfo); List<WorkerGroup> workerGroupList = workerGroupMapper.queryAllWorkerGroup(); if (CollectionUtils.isNotEmpty(workerGroupList)) { for (WorkerGroup wg : workerGroupList) { String workerGroup = wg.getName(); Set<String> nodes = new HashSet<>(); String[] addrs = wg.getAddrList().split(Constants.COMMA); for (String addr : addrs) { if (newWorkerNodeInfo.containsKey(addr)) { nodes.add(addr); } } if (!nodes.isEmpty()) { syncWorkerGroupNodes(workerGroup, nodes); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
} } catch (Exception e) { logger.error("WorkerNodeInfoAndGroupDbSyncTask error:", e); } } } /** * worker group node listener */ class WorkerDataListener implements SubscribeListener { @Override public void notify(Event event) { final String path = event.path(); final Type type = event.type(); final String data = event.data(); if (registryClient.isWorkerPath(path)) { try { if (type == Type.ADD) { logger.info("worker group node : {} added.", path); String group = parseGroup(path); Collection<String> currentNodes = registryClient.getWorkerGroupNodesDirectly(group); logger.info("currentNodes : {}", currentNodes); syncWorkerGroupNodes(group, currentNodes); } else if (type == Type.REMOVE) { logger.info("worker group node : {} down.", path); String group = parseGroup(path); Collection<String> currentNodes = registryClient.getWorkerGroupNodesDirectly(group); syncWorkerGroupNodes(group, currentNodes); alertDao.sendServerStopedAlert(1, path, "WORKER"); } else if (type == Type.UPDATE) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
logger.debug("worker group node : {} update, data: {}", path, data); String group = parseGroup(path); Collection<String> currentNodes = registryClient.getWorkerGroupNodesDirectly(group); syncWorkerGroupNodes(group, currentNodes); String node = parseNode(path); syncSingleWorkerNodeInfo(node, data); } } catch (IllegalArgumentException ex) { logger.warn(ex.getMessage()); } catch (Exception ex) { logger.error("WorkerGroupListener capture data change and get data failed", ex); } } } private String parseGroup(String path) { String[] parts = path.split("/"); if (parts.length < WORKER_LISTENER_CHECK_LENGTH) { throw new IllegalArgumentException(String.format("worker group path : %s is not valid, ignore", path)); } return parts[parts.length - 2]; } private String parseNode(String path) { String[] parts = path.split("/"); if (parts.length < WORKER_LISTENER_CHECK_LENGTH) { throw new IllegalArgumentException(String.format("worker group path : %s is not valid, ignore", path)); } return parts[parts.length - 1]; } } class MasterDataListener implements SubscribeListener {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
@Override public void notify(Event event) { final String path = event.path(); final Type type = event.type(); if (registryClient.isMasterPath(path)) { try { if (type.equals(Type.ADD)) { logger.info("master node : {} added.", path); updateMasterNodes(); } if (type.equals(Type.REMOVE)) { logger.info("master node : {} down.", path); updateMasterNodes(); alertDao.sendServerStopedAlert(1, path, "MASTER"); } } catch (Exception ex) { logger.error("MasterNodeListener capture data change and get data failed.", ex); } } } } private void updateMasterNodes() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
MASTER_SLOT = 0; this.masterNodes.clear(); String nodeLock = Constants.REGISTRY_DOLPHINSCHEDULER_LOCK_MASTERS; try { registryClient.getLock(nodeLock); Collection<String> currentNodes = registryClient.getMasterNodesDirectly(); List<Server> masterNodes = registryClient.getServerList(NodeType.MASTER); syncMasterNodes(currentNodes, masterNodes); } catch (Exception e) { logger.error("update master nodes error", e); } finally { registryClient.releaseLock(nodeLock); } } /** * get master nodes * * @return master nodes */ public Set<String> getMasterNodes() { masterLock.lock(); try { return Collections.unmodifiableSet(masterNodes); } finally { masterLock.unlock(); } } /** * sync master nodes *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
* @param nodes master nodes */ private void syncMasterNodes(Collection<String> nodes, List<Server> masterNodes) { masterLock.lock(); try { String host = NetUtils.getHost(); this.masterNodes.addAll(nodes); this.masterPriorityQueue.clear(); this.masterPriorityQueue.putList(masterNodes); int index = masterPriorityQueue.getIndex(host); if (index >= 0) { MASTER_SIZE = nodes.size(); MASTER_SLOT = index; } else { logger.warn("current host:{} is not in active master list", host); } logger.info("update master nodes, master size: {}, slot: {}", MASTER_SIZE, MASTER_SLOT); } finally { masterLock.unlock(); } } /** * sync worker group nodes * * @param workerGroup worker group * @param nodes worker nodes */ private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } public Map<String, Set<String>> getWorkerGroupNodes() { return Collections.unmodifiableMap(workerGroupNodes); } /** * get worker group nodes * * @param workerGroup workerGroup * @return worker nodes */ public Set<String> getWorkerGroupNodes(String workerGroup) { workerGroupLock.lock(); try { if (StringUtils.isEmpty(workerGroup)) { workerGroup = Constants.DEFAULT_WORKER_GROUP; } workerGroup = workerGroup.toLowerCase(); Set<String> nodes = workerGroupNodes.get(workerGroup); if (CollectionUtils.isNotEmpty(nodes)) { return Collections.unmodifiableSet(nodes); } return nodes;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
} finally { workerGroupLock.unlock(); } } /** * get worker node info * * @return worker node info */ public Map<String, String> getWorkerNodeInfo() { return Collections.unmodifiableMap(workerNodeInfo); } /** * get worker node info * * @param workerNode worker node * @return worker node info */ public String getWorkerNodeInfo(String workerNode) { workerNodeInfoLock.lock(); try { return workerNodeInfo.getOrDefault(workerNode, null); } finally { workerNodeInfoLock.unlock(); } } /** * sync worker node info * * @param newWorkerNodeInfo new worker node info
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,213
[Bug] [dolphinscheduler-server] task run error when worker group name contains uppercase letters
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened worker group名称存在大写的时候,运行任务报错;错误如下 _[INFO] 2022-01-27 08:00:00.389 TaskLogLogger:[134] - set work flow 299 task 463 running [INFO] 2022-01-27 08:00:00.390 TaskLogLogger:[104] - work flow 299 task 463, sub work flow: 301 state: running [ERROR] 2022-01-27 08:00:01.081 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511226, bodyLen=3375] due to no suitable worker, current task needs worker group test to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [ERROR] 2022-01-27 08:00:01.082 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[144] - ExecuteException dispatch error: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=3511227, bodyLen=3106] due to no suitable worker, current task needs worker group Tenant_2_DS资源组3 to execute at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:89) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:138) at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:101) [WARN] 2022-01-27 08:00:01.360 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat [WARN] 2022-01-27 08:00:02.361 org.apache.dolphinscheduler.server.master.dispatch.host.LowerWeightHostManager:[153] - worker 192.168.92.31:1234 in work group test have not received the heartbeat _ 原因:master ServerNodeManager.syncWorkerGroupNodes() 方法,将读取到的worker group名称转为了小写,但是,从任务内读取的workergroup名称仍然是大写,因此任务找不到需要的worker group; 处理:将//workerGroup = workerGroup.toLowerCase(); 注释掉。 ` private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) { workerGroupLock.lock(); try { //workerGroup = workerGroup.toLowerCase(); Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>()); workerNodes.clear(); workerNodes.addAll(nodes); workerGroupNodes.put(workerGroup, workerNodes); } finally { workerGroupLock.unlock(); } } ` ### What you expected to happen 当worker group 名称存在大写字符时,任务正常运行 ### How to reproduce 创建一个包含大写字符的workergroup 名称,创建任意一个任务并关联到 创建的worker group 运行; ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8213
https://github.com/apache/dolphinscheduler/pull/8448
02e47da30b76334c6847c8142a735cdd94f0cc43
234f399488e7fb0937cbf322c928f7abb9eb8365
2022-01-27T04:05:26Z
java
2022-02-19T13:38:58Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
*/ private void syncAllWorkerNodeInfo(Map<String, String> newWorkerNodeInfo) { workerNodeInfoLock.lock(); try { workerNodeInfo.clear(); workerNodeInfo.putAll(newWorkerNodeInfo); } finally { workerNodeInfoLock.unlock(); } } /** * sync single worker node info */ private void syncSingleWorkerNodeInfo(String node, String info) { workerNodeInfoLock.lock(); try { workerNodeInfo.put(node, info); } finally { workerNodeInfoLock.unlock(); } } /** * destroy */ @PreDestroy public void destroy() { executorService.shutdownNow(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.common.utils; import org.apache.dolphinscheduler.common.shell.ShellExecutor; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.SystemUtils; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
import java.io.InputStreamReader; import java.lang.management.ManagementFactory; import java.lang.management.OperatingSystemMXBean; import java.lang.management.RuntimeMXBean; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.StringTokenizer; import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import oshi.SystemInfo; import oshi.hardware.CentralProcessor; import oshi.hardware.GlobalMemory; import oshi.hardware.HardwareAbstractionLayer; /** * os utils */ public class OSUtils { private static final Logger logger = LoggerFactory.getLogger(OSUtils.class); private static final SystemInfo SI = new SystemInfo(); public static final String TWO_DECIMAL = "0.00"; /** * return -1 when the function can not get hardware env info * e.g {@link OSUtils#loadAverage()} {@link OSUtils#cpuUsage()} */ public static final double NEGATIVE_ONE = -1;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
private static final HardwareAbstractionLayer hal = SI.getHardware(); private OSUtils() { throw new UnsupportedOperationException("Construct OSUtils"); } /** * Initialization regularization, solve the problem of pre-compilation performance, * avoid the thread safety problem of multi-thread operation */ private static final Pattern PATTERN = Pattern.compile("\\s+"); /** * get memory usage * Keep 2 decimal * * @return percent % */ public static double memoryUsage() { GlobalMemory memory = hal.getMemory(); double memoryUsage = (memory.getTotal() - memory.getAvailable()) * 1.0 / memory.getTotal(); DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(memoryUsage)); } /** * get available physical memory size * <p> * Keep 2 decimal * * @return available Physical Memory Size, unit: G */ public static double availablePhysicalMemorySize() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
GlobalMemory memory = hal.getMemory(); double availablePhysicalMemorySize = memory.getAvailable() / 1024.0 / 1024 / 1024; DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(availablePhysicalMemorySize)); } /** * load average * * @return load average */ public static double loadAverage() { double loadAverage; try { OperatingSystemMXBean osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class); loadAverage = osBean.getSystemLoadAverage(); } catch (Exception e) { logger.error("get operation system load average exception, try another method ", e); loadAverage = hal.getProcessor().getSystemLoadAverage(); if (Double.isNaN(loadAverage)) { return NEGATIVE_ONE; } } DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(loadAverage)); } /** * get cpu usage *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
* @return cpu usage */ public static double cpuUsage() { CentralProcessor processor = hal.getProcessor(); double cpuUsage = processor.getSystemCpuLoad(); if (Double.isNaN(cpuUsage)) { return NEGATIVE_ONE; } DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(cpuUsage)); } public static List<String> getUserList() { try { if (SystemUtils.IS_OS_MAC) { return getUserListFromMac(); } else if (SystemUtils.IS_OS_WINDOWS) { return getUserListFromWindows(); } else { return getUserListFromLinux(); } } catch (Exception e) { logger.error(e.getMessage(), e); } return Collections.emptyList(); } /** * get user list from linux * * @return user list
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
*/ private static List<String> getUserListFromLinux() throws IOException { List<String> userList = new ArrayList<>(); try (BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(new FileInputStream("/etc/passwd")))) { String line; while ((line = bufferedReader.readLine()) != null) { if (line.contains(":")) { String[] userInfo = line.split(":"); userList.add(userInfo[0]); } } } return userList; } /** * get user list from mac * * @return user list */ private static List<String> getUserListFromMac() throws IOException { String result = exeCmd("dscl . list /users"); if (!StringUtils.isEmpty(result)) { return Arrays.asList(result.split("\n")); } return Collections.emptyList(); } /** * get user list from windows *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
* @return user list */ private static List<String> getUserListFromWindows() throws IOException { String result = exeCmd("net user"); String[] lines = result.split("\n"); int startPos = 0; int endPos = lines.length - 2; for (int i = 0; i < lines.length; i++) { if (lines[i].isEmpty()) { continue; } int count = 0; if (lines[i].charAt(0) == '-') { for (int j = 0; j < lines[i].length(); j++) { if (lines[i].charAt(i) == '-') { count++; } } } if (count == lines[i].length()) { startPos = i + 1; break; } } List<String> users = new ArrayList<>(); while (startPos <= endPos) { users.addAll(Arrays.asList(PATTERN.split(lines[startPos]))); startPos++; } return users;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
} /** * create user * * @param userName user name */ public static void createUserIfAbsent(String userName) { if (!getUserList().contains(userName)) { boolean isSuccess = createUser(userName); logger.info("create user {} {}", userName, isSuccess ? "success" : "fail"); } } /** * create user * * @param userName user name * @return true if creation was successful, otherwise false */ public static boolean createUser(String userName) { try { String userGroup = getGroup(); if (StringUtils.isEmpty(userGroup)) { String errorLog = String.format("%s group does not exist for this operating system.", userGroup); logger.error(errorLog); return false; } if (SystemUtils.IS_OS_MAC) { createMacUser(userName, userGroup); } else if (SystemUtils.IS_OS_WINDOWS) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
createWindowsUser(userName, userGroup); } else { createLinuxUser(userName, userGroup); } return true; } catch (Exception e) { logger.error(e.getMessage(), e); } return false; } /** * create linux user * * @param userName user name * @param userGroup user group * @throws IOException in case of an I/O error */ private static void createLinuxUser(String userName, String userGroup) throws IOException { logger.info("create linux os user: {}", userName); String cmd = String.format("sudo useradd -g %s %s", userGroup, userName); logger.info("execute cmd: {}", cmd); exeCmd(cmd); } /** * create mac user (Supports Mac OSX 10.10+) * * @param userName user name * @param userGroup user group * @throws IOException in case of an I/O error */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
private static void createMacUser(String userName, String userGroup) throws IOException { logger.info("create mac os user: {}", userName); String createUserCmd = String.format("sudo sysadminctl -addUser %s -password %s", userName, userName); logger.info("create user command: {}", createUserCmd); exeCmd(createUserCmd); String appendGroupCmd = String.format("sudo dseditgroup -o edit -a %s -t user %s", userName, userGroup); logger.info("append user to group: {}", appendGroupCmd); exeCmd(appendGroupCmd); } /** * create windows user * * @param userName user name * @param userGroup user group * @throws IOException in case of an I/O error */ private static void createWindowsUser(String userName, String userGroup) throws IOException { logger.info("create windows os user: {}", userName); String userCreateCmd = String.format("net user \"%s\" /add", userName); logger.info("execute create user command: {}", userCreateCmd); exeCmd(userCreateCmd); String appendGroupCmd = String.format("net localgroup \"%s\" \"%s\" /add", userGroup, userName); logger.info("execute append user to group: {}", appendGroupCmd); exeCmd(appendGroupCmd); } /** * get system group information * * @return system group info * @throws IOException errors
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
*/ public static String getGroup() throws IOException { if (SystemUtils.IS_OS_WINDOWS) { String currentProcUserName = System.getProperty("user.name"); String result = exeCmd(String.format("net user \"%s\"", currentProcUserName)); String line = result.split("\n")[22]; String group = PATTERN.split(line)[1]; if (group.charAt(0) == '*') { return group.substring(1); } else { return group; } } else { String result = exeCmd("groups"); if (!StringUtils.isEmpty(result)) { String[] groupInfo = result.split(" "); return groupInfo[0]; } } return null; } /** * get sudo command * * @param tenantCode tenantCode * @param command command * @return result of sudo execute command */ public static String getSudoCmd(String tenantCode, String command) { if (!CommonUtils.isSudoEnable() || StringUtils.isEmpty(tenantCode)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
return command; } return String.format("sudo -u %s %s", tenantCode, command); } /** * Execute the corresponding command of Linux or Windows * * @param command command * @return result of execute command * @throws IOException errors */ public static String exeCmd(String command) throws IOException { StringTokenizer st = new StringTokenizer(command); String[] cmdArray = new String[st.countTokens()]; for (int i = 0; st.hasMoreTokens(); i++) { cmdArray[i] = st.nextToken(); } return exeShell(cmdArray); } /** * Execute the shell * * @param command command * @return result of execute the shell * @throws IOException errors */ public static String exeShell(String[] command) throws IOException { return ShellExecutor.execCommand(command); } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
* get process id * * @return process id */ public static int getProcessID() { RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean(); return Integer.parseInt(runtimeMXBean.getName().split("@")[0]); } /** * check memory and cpu usage * * @param maxCpuloadAvg maxCpuloadAvg * @param reservedMemory reservedMemory * @return check memory and cpu usage */ public static Boolean checkResource(double maxCpuloadAvg, double reservedMemory) { double loadAverage = loadAverage(); double availablePhysicalMemorySize = availablePhysicalMemorySize(); if (loadAverage > maxCpuloadAvg || availablePhysicalMemorySize < reservedMemory) { logger.warn("current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G", loadAverage, availablePhysicalMemorySize, maxCpuloadAvg, reservedMemory); return false; } else { return true; } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/os/OshiTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.common.os; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import oshi.SystemInfo; import oshi.hardware.CentralProcessor; import oshi.hardware.CentralProcessor.TickType; import oshi.hardware.GlobalMemory; import oshi.hardware.HardwareAbstractionLayer;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/os/OshiTest.java
import oshi.util.FormatUtil; import oshi.util.Util; import java.util.Arrays; /** * os information test */ public class OshiTest { private static Logger logger = LoggerFactory.getLogger(OshiTest.class); @Test public void test() { SystemInfo si = new SystemInfo(); HardwareAbstractionLayer hal = si.getHardware(); logger.info("Checking Memory..."); printMemory(hal.getMemory()); logger.info("Checking CPU..."); printCpu(hal.getProcessor()); } private static void printMemory(GlobalMemory memory) { logger.info("memory avail:{} MB" , memory.getAvailable() / 1024 / 1024 ); logger.info("memory total:{} MB" , memory.getTotal() / 1024 / 1024 ); } private static void printCpu(CentralProcessor processor) { logger.info(String.format("CPU load: %.1f%% (OS MXBean)%n", processor.getSystemCpuLoad() * 100)); logger.info("CPU load averages : {}", processor.getSystemLoadAverage()); logger.info("Uptime: " + FormatUtil.formatElapsedSecs(processor.getSystemUptime())); logger.info("Context Switches/Interrupts: " + processor.getContextSwitches() + " / " + processor.getInterrupts()); long[] prevTicks = processor.getSystemCpuLoadTicks(); logger.info("CPU, IOWait, and IRQ ticks @ 0 sec:" + Arrays.toString(prevTicks)); Util.sleep(1000);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,389
[Bug] [common] oshi compatibility issues cause it fail to boot on m1 mac
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I use a macbook with m1 chip, when starting StandaloneServer, I get the following error `Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp: dlopen(/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp, 0x0001): tried: '/private/var/folders/k6/h_l1w_m53l76tkylxlc33q4h0000gn/T/jna-113105/jna1882043576609991586.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna1882043576609991586.tmp' (no such file) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) at java.lang.Runtime.load0(Runtime.java:811) at java.lang.System.load(System.java:1088) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) at com.sun.jna.Native.<clinit>(Native.java:190) at com.sun.jna.Pointer.<clinit>(Pointer.java:54) at com.sun.jna.Structure.<clinit>(Structure.java:2130) at oshi.hardware.platform.mac.MacCentralProcessor.<clinit>(MacCentralProcessor.java:53) at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getProcessor(MacHardwareAbstractionLayer.java:54) at org.apache.dolphinscheduler.common.utils.OSUtils.cpuUsage(OSUtils.java:136) at org.apache.dolphinscheduler.common.utils.HeartBeat.fillSystemInfo(HeartBeat.java:176) at org.apache.dolphinscheduler.common.utils.HeartBeat.encodeHeartBeat(HeartBeat.java:204) at org.apache.dolphinscheduler.server.registry.HeartBeatTask.getHeartBeatInfo(HeartBeatTask.java:71) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.registry(MasterRegistryClient.java:498) at org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient.start(MasterRegistryClient.java:120) at org.apache.dolphinscheduler.server.master.MasterServer.run(MasterServer.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ... 18 common frames omitted` To fix this, we need upgrade oshi-core version , and modify some method calls in OSUtils to adapt the new api. ### What you expected to happen backend service can run on m1 chip system ### How to reproduce Start StandaloneServer on a m1 chip macbook ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8389
https://github.com/apache/dolphinscheduler/pull/8390
df6eef84cde877237ef23802338c7a95f97ede9b
83e88c4bc6cc3081dd6c99663d06fe32bb4a8e29
2022-02-15T06:02:03Z
java
2022-02-21T03:14:39Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/os/OshiTest.java
long[] ticks = processor.getSystemCpuLoadTicks(); logger.info("CPU, IOWait, and IRQ ticks @ 1 sec:" + Arrays.toString(ticks)); long user = ticks[TickType.USER.getIndex()] - prevTicks[TickType.USER.getIndex()]; long nice = ticks[TickType.NICE.getIndex()] - prevTicks[TickType.NICE.getIndex()]; long sys = ticks[TickType.SYSTEM.getIndex()] - prevTicks[TickType.SYSTEM.getIndex()]; long idle = ticks[TickType.IDLE.getIndex()] - prevTicks[TickType.IDLE.getIndex()]; long iowait = ticks[TickType.IOWAIT.getIndex()] - prevTicks[TickType.IOWAIT.getIndex()]; long irq = ticks[TickType.IRQ.getIndex()] - prevTicks[TickType.IRQ.getIndex()]; long softirq = ticks[TickType.SOFTIRQ.getIndex()] - prevTicks[TickType.SOFTIRQ.getIndex()]; long steal = ticks[TickType.STEAL.getIndex()] - prevTicks[TickType.STEAL.getIndex()]; long totalCpu = user + nice + sys + idle + iowait + irq + softirq + steal; logger.info(String.format( "User: %.1f%% Nice: %.1f%% System: %.1f%% Idle: %.1f%% IOwait: %.1f%% IRQ: %.1f%% SoftIRQ: %.1f%% Steal: %.1f%%%n", 100d * user / totalCpu, 100d * nice / totalCpu, 100d * sys / totalCpu, 100d * idle / totalCpu, 100d * iowait / totalCpu, 100d * irq / totalCpu, 100d * softirq / totalCpu, 100d * steal / totalCpu)); logger.info(String.format("CPU load: %.1f%% (counting ticks)%n", processor.getSystemCpuLoadBetweenTicks() * 100)); double[] loadAverage = processor.getSystemLoadAverage(3); logger.info("CPU load averages:" + (loadAverage[0] < 0 ? " N/A" : String.format(" %.2f", loadAverage[0])) + (loadAverage[1] < 0 ? " N/A" : String.format(" %.2f", loadAverage[1])) + (loadAverage[2] < 0 ? " N/A" : String.format(" %.2f", loadAverage[2]))); StringBuilder procCpu = new StringBuilder("CPU load per processor:"); double[] load = processor.getProcessorCpuLoadBetweenTicks(); for (double avg : load) { procCpu.append(String.format(" %.1f%%", avg * 100)); } logger.info(procCpu.toString()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* limitations under the License. */ package org.apache.dolphinscheduler.api.service.impl; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE; import static org.apache.dolphinscheduler.common.Constants.DEFAULT_WORKER_GROUP; import org.apache.dolphinscheduler.api.dto.DagDataSchedule; import org.apache.dolphinscheduler.api.dto.ScheduleParam; import org.apache.dolphinscheduler.api.dto.treeview.Instance; import org.apache.dolphinscheduler.api.dto.treeview.TreeViewDto; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.service.ProcessDefinitionService; import org.apache.dolphinscheduler.api.service.ProcessInstanceService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.service.SchedulerService; import org.apache.dolphinscheduler.api.utils.CheckUtils; import org.apache.dolphinscheduler.api.utils.FileUtils; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ConditionType; 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.ProcessExecutionTypeEnum; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.TaskTimeoutStrategy; import org.apache.dolphinscheduler.common.enums.TaskType; import org.apache.dolphinscheduler.common.enums.TimeoutFlag; import org.apache.dolphinscheduler.common.enums.UserType;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.graph.DAG; import org.apache.dolphinscheduler.common.model.TaskNode; import org.apache.dolphinscheduler.common.model.TaskNodeRelation; import org.apache.dolphinscheduler.common.task.sql.SqlParameters; import org.apache.dolphinscheduler.common.task.sql.SqlType; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils.CodeGenerateException; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.DagData; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationLogMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.TenantMapper; import org.apache.dolphinscheduler.dao.mapper.UserMapper; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.hadoop.fs.Stat; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import java.util.zip.ZipEntry;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import java.util.zip.ZipInputStream; 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.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.Lists; /** * process definition service impl */ @Service public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements ProcessDefinitionService { private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class); private static final String RELEASESTATE = "releaseState"; @Autowired private ProjectMapper projectMapper; @Autowired private ProjectService projectService; @Autowired private UserMapper userMapper; @Autowired
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
private ProcessDefinitionLogMapper processDefinitionLogMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private ProcessInstanceService processInstanceService; @Autowired private TaskInstanceMapper taskInstanceMapper; @Autowired private ScheduleMapper scheduleMapper; @Autowired private ProcessService processService; @Autowired private ProcessTaskRelationMapper processTaskRelationMapper; @Autowired private ProcessTaskRelationLogMapper processTaskRelationLogMapper; @Autowired TaskDefinitionLogMapper taskDefinitionLogMapper; @Autowired private TaskDefinitionMapper taskDefinitionMapper; @Autowired private SchedulerService schedulerService; @Autowired private TenantMapper tenantMapper; @Autowired private DataSourceMapper dataSourceMapper; /** * create process definition * * @param loginUser login user * @param projectCode project code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @param name process definition name * @param description description * @param globalParams global params * @param locations locations for nodes * @param timeout timeout * @param tenantCode tenantCode * @param taskRelationJson relation json for nodes * @param taskDefinitionJson taskDefinitionJson * @return create result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> createProcessDefinition(User loginUser, long projectCode, String name, String description, String globalParams, String locations, int timeout, String tenantCode, String taskRelationJson, String taskDefinitionJson, ProcessExecutionTypeEnum executionType) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name); if (definition != null) { putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name); return result; } List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); Map<String, Object> checkTaskDefinitions = checkTaskDefinitionList(taskDefinitionLogs, taskDefinitionJson); if (checkTaskDefinitions.get(Constants.STATUS) != Status.SUCCESS) { return checkTaskDefinitions; } List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class); Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs); if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) { return checkRelationJson; } int tenantId = -1; if (!Constants.DEFAULT.equals(tenantCode)) { Tenant tenant = tenantMapper.queryByTenantCode(tenantCode); if (tenant == null) { putMsg(result, Status.TENANT_NOT_EXIST); return result; } tenantId = tenant.getId(); } long processDefinitionCode; try { processDefinitionCode = CodeGenerateUtils.getInstance().genCode(); } catch (CodeGenerateException e) { putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description, globalParams, locations, timeout, loginUser.getId(), tenantId); processDefinition.setExecutionType(executionType); return createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs); } private Map<String, Object> createDagDefine(User loginUser, List<ProcessTaskRelationLog> taskRelationList, ProcessDefinition processDefinition, List<TaskDefinitionLog> taskDefinitionLogs) { Map<String, Object> result = new HashMap<>(); int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs, Boolean.TRUE); if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) { logger.info("The task has not changed, so skip"); } if (saveTaskResult == Constants.DEFINITION_FAILURE) { putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR); } int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE); if (insertVersion == 0) { putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR); } int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs, Boolean.TRUE); if (insertResult == Constants.EXIT_CODE_SUCCESS) { putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition); } else {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
putMsg(result, Status.CREATE_PROCESS_TASK_RELATION_ERROR); throw new ServiceException(Status.CREATE_PROCESS_TASK_RELATION_ERROR); } return result; } private Map<String, Object> checkTaskDefinitionList(List<TaskDefinitionLog> taskDefinitionLogs, String taskDefinitionJson) { Map<String, Object> result = new HashMap<>(); try { if (taskDefinitionLogs.isEmpty()) { logger.error("taskDefinitionJson invalid: {}", taskDefinitionJson); putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson); return result; } for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { if (!CheckUtils.checkTaskDefinitionParameters(taskDefinitionLog)) { logger.error("task definition {} parameter invalid", taskDefinitionLog.getName()); putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName()); return result; } } putMsg(result, Status.SUCCESS); } catch (Exception e) { result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR); result.put(Constants.MSG, e.getMessage()); } return result; } private Map<String, Object> checkTaskRelationList(List<ProcessTaskRelationLog> taskRelationList, String taskRelationJson, List<TaskDefinitionLog> taskDefinitionLogs) { Map<String, Object> result = new HashMap<>(); try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (taskRelationList == null || taskRelationList.isEmpty()) { logger.error("task relation list is null"); putMsg(result, Status.DATA_IS_NOT_VALID, taskRelationJson); return result; } List<ProcessTaskRelation> processTaskRelations = taskRelationList.stream() .map(processTaskRelationLog -> JSONUtils.parseObject(JSONUtils.toJsonString(processTaskRelationLog), ProcessTaskRelation.class)) .collect(Collectors.toList()); List<TaskNode> taskNodeList = processService.transformTask(processTaskRelations, taskDefinitionLogs); if (taskNodeList.size() != taskRelationList.size()) { Set<Long> postTaskCodes = taskRelationList.stream().map(ProcessTaskRelationLog::getPostTaskCode).collect(Collectors.toSet()); Set<Long> taskNodeCodes = taskNodeList.stream().map(TaskNode::getCode).collect(Collectors.toSet()); Collection<Long> codes = CollectionUtils.subtract(postTaskCodes, taskNodeCodes); if (CollectionUtils.isNotEmpty(codes)) { logger.error("the task code is not exist"); putMsg(result, Status.TASK_DEFINE_NOT_EXIST, org.apache.commons.lang.StringUtils.join(codes, Constants.COMMA)); return result; } } if (graphHasCycle(taskNodeList)) { logger.error("process DAG has cycle"); putMsg(result, Status.PROCESS_NODE_HAS_CYCLE); return result; } for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) { if (processTaskRelationLog.getPostTaskCode() == 0) { logger.error("the post_task_code or post_task_version can't be zero"); putMsg(result, Status.CHECK_PROCESS_TASK_RELATION_ERROR); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} } putMsg(result, Status.SUCCESS); } catch (Exception e) { result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR); result.put(Constants.MSG, e.getMessage()); } return result; } /** * query process definition list * * @param loginUser login user * @param projectCode project code * @return definition list */ @Override public Map<String, Object> queryProcessDefinitionList(User loginUser, long projectCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<ProcessDefinition> resourceList = processDefinitionMapper.queryAllDefinitionList(projectCode); List<DagData> dagDataList = resourceList.stream().map(processService::genDagData).collect(Collectors.toList()); result.put(Constants.DATA_LIST, dagDataList); putMsg(result, Status.SUCCESS); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
/** * query process definition simple list * * @param loginUser login user * @param projectCode project code * @return definition simple list */ @Override public Map<String, Object> queryProcessDefinitionSimpleList(User loginUser, long projectCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode); ArrayNode arrayNode = JSONUtils.createArrayNode(); for (ProcessDefinition processDefinition : processDefinitions) { ObjectNode processDefinitionNode = JSONUtils.createObjectNode(); processDefinitionNode.put("id", processDefinition.getId()); processDefinitionNode.put("code", processDefinition.getCode()); processDefinitionNode.put("name", processDefinition.getName()); processDefinitionNode.put("projectCode", processDefinition.getProjectCode()); arrayNode.add(processDefinitionNode); } result.put(Constants.DATA_LIST, arrayNode); putMsg(result, Status.SUCCESS); return result; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* query process definition list paging * * @param loginUser login user * @param projectCode project code * @param searchVal search value * @param userId user id * @param pageNo page number * @param pageSize page size * @return process definition page */ @Override public Result queryProcessDefinitionListPaging(User loginUser, long projectCode, String searchVal, Integer userId, Integer pageNo, Integer pageSize) { Result result = new Result(); Project project = projectMapper.queryByCode(projectCode); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { putMsg(result, resultStatus); return result; } Page<ProcessDefinition> page = new Page<>(pageNo, pageSize); IPage<ProcessDefinition> processDefinitionIPage = processDefinitionMapper.queryDefineListPaging( page, searchVal, userId, project.getCode(), isAdmin(loginUser)); List<ProcessDefinition> records = processDefinitionIPage.getRecords(); for (ProcessDefinition pd : records) { ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(pd.getCode(), pd.getVersion()); User user = userMapper.selectById(processDefinitionLog.getOperator()); pd.setModifyBy(user.getUserName()); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
processDefinitionIPage.setRecords(records); PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotal((int) processDefinitionIPage.getTotal()); pageInfo.setTotalList(processDefinitionIPage.getRecords()); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * query detail of process definition * * @param loginUser login user * @param projectCode project code * @param code process definition code * @return process definition detail */ @Override public Map<String, Object> queryProcessDefinitionByCode(User loginUser, long projectCode, long code) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); } else { Tenant tenant = tenantMapper.queryById(processDefinition.getTenantId()); if (tenant != null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
processDefinition.setTenantCode(tenant.getTenantCode()); } DagData dagData = processService.genDagData(processDefinition); result.put(Constants.DATA_LIST, dagData); putMsg(result, Status.SUCCESS); } return result; } @Override public Map<String, Object> queryProcessDefinitionByName(User loginUser, long projectCode, String name) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, name); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, name); } else { DagData dagData = processService.genDagData(processDefinition); result.put(Constants.DATA_LIST, dagData); putMsg(result, Status.SUCCESS); } return result; } /** * update process definition * * @param loginUser login user
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @param projectCode project code * @param name process definition name * @param code process definition code * @param description description * @param globalParams global params * @param locations locations for nodes * @param timeout timeout * @param tenantCode tenantCode * @param taskRelationJson relation json for nodes * @param taskDefinitionJson taskDefinitionJson * @return update result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> updateProcessDefinition(User loginUser, long projectCode, String name, long code, String description, String globalParams, String locations, int timeout, String tenantCode, String taskRelationJson, String taskDefinitionJson, ProcessExecutionTypeEnum executionType) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return result; } List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); Map<String, Object> checkTaskDefinitions = checkTaskDefinitionList(taskDefinitionLogs, taskDefinitionJson); if (checkTaskDefinitions.get(Constants.STATUS) != Status.SUCCESS) { return checkTaskDefinitions; } List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class); Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs); if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) { return checkRelationJson; } int tenantId = -1; if (!Constants.DEFAULT.equals(tenantCode)) { Tenant tenant = tenantMapper.queryByTenantCode(tenantCode); if (tenant == null) { putMsg(result, Status.TENANT_NOT_EXIST); return result; } tenantId = tenant.getId(); } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); return result; } if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return result; } if (!name.equals(processDefinition.getName())) { ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name); if (definition != null) { putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name); return result; } } ProcessDefinition processDefinitionDeepCopy = JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class); processDefinition.set(projectCode, name, description, globalParams, locations, timeout, tenantId); processDefinition.setExecutionType(executionType); return updateDagDefine(loginUser, taskRelationList, processDefinition, processDefinitionDeepCopy, taskDefinitionLogs); } private Map<String, Object> updateDagDefine(User loginUser, List<ProcessTaskRelationLog> taskRelationList, ProcessDefinition processDefinition, ProcessDefinition processDefinitionDeepCopy, List<TaskDefinitionLog> taskDefinitionLogs) { Map<String, Object> result = new HashMap<>(); int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs, Boolean.TRUE); if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) { logger.info("The task has not changed, so skip"); } if (saveTaskResult == Constants.DEFINITION_FAILURE) { putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR); } boolean isChange = false;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (processDefinition.equals(processDefinitionDeepCopy) && saveTaskResult == Constants.EXIT_CODE_SUCCESS) { List<ProcessTaskRelationLog> processTaskRelationLogList = processTaskRelationLogMapper.queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion()); if (taskRelationList.size() == processTaskRelationLogList.size()) { Set<ProcessTaskRelationLog> taskRelationSet = taskRelationList.stream().collect(Collectors.toSet()); Set<ProcessTaskRelationLog> processTaskRelationLogSet = processTaskRelationLogList.stream().collect(Collectors.toSet()); if (taskRelationSet.size() == processTaskRelationLogSet.size()) { taskRelationSet.removeAll(processTaskRelationLogSet); if (!taskRelationSet.isEmpty()) { isChange = true; } } else { isChange = true; } } else { isChange = true; } } else { isChange = true; } if (isChange) { processDefinition.setUpdateTime(new Date()); int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE); if (insertVersion <= 0) { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR); } int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs, Boolean.TRUE); if (insertResult == Constants.EXIT_CODE_SUCCESS) { putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
result.put(Constants.DATA_LIST, processDefinition); } else { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR); } } else { putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition); } return result; } /** * verify process definition name unique * * @param loginUser login user * @param projectCode project code * @param name name * @return true if process definition name not exists, otherwise false */ @Override public Map<String, Object> verifyProcessDefinitionName(User loginUser, long projectCode, String name) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.verifyByDefineName(project.getCode(), name.trim()); if (processDefinition == null) { putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} else { putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name.trim()); } return result; } /** * delete process definition by code * * @param loginUser login user * @param projectCode project code * @param code process definition code * @return delete result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> deleteProcessDefinitionByCode(User loginUser, long projectCode, long code) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); return result; } if (loginUser.getId() != processDefinition.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) { putMsg(result, Status.USER_NO_OPERATION_PERM);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return result; } if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, code); return result; } List<ProcessInstance> processInstances = processInstanceService.queryByProcessDefineCodeAndStatus(processDefinition.getCode(), Constants.NOT_TERMINATED_STATES); if (CollectionUtils.isNotEmpty(processInstances)) { putMsg(result, Status.DELETE_PROCESS_DEFINITION_BY_CODE_FAIL, processInstances.size()); return result; } Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(code); if (scheduleObj != null) { if (scheduleObj.getReleaseState() == ReleaseState.OFFLINE) { int delete = scheduleMapper.deleteById(scheduleObj.getId()); if (delete == 0) { putMsg(result, Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR); throw new ServiceException(Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR); } } if (scheduleObj.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, scheduleObj.getId()); return result; } } int delete = processDefinitionMapper.deleteById(processDefinition.getId()); if (delete == 0) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); } int deleteRelation = processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode()); if (deleteRelation == 0) { logger.warn("The process definition has not relation, it will be delete successfully"); } putMsg(result, Status.SUCCESS); return result; } /** * release process definition: online / offline * * @param loginUser login user * @param projectCode project code * @param code process definition code * @param releaseState release state * @return release result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> releaseProcessDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (null == releaseState) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); return result; } switch (releaseState) { case ONLINE: List<ProcessTaskRelation> relationList = processService.findRelationByCode(code, processDefinition.getVersion()); if (CollectionUtils.isEmpty(relationList)) { putMsg(result, Status.PROCESS_DAG_IS_EMPTY); return result; } processDefinition.setReleaseState(releaseState); processDefinitionMapper.updateById(processDefinition); break; case OFFLINE: processDefinition.setReleaseState(releaseState); int updateProcess = processDefinitionMapper.updateById(processDefinition); Schedule schedule = scheduleMapper.queryByProcessDefinitionCode(code); if (updateProcess > 0 && schedule != null) { logger.info("set schedule offline, project code: {}, schedule id: {}, process definition code: {}", projectCode, schedule.getId(), code); schedule.setReleaseState(releaseState); int updateSchedule = scheduleMapper.updateById(schedule); if (updateSchedule == 0) { putMsg(result, Status.OFFLINE_SCHEDULE_ERROR); throw new ServiceException(Status.OFFLINE_SCHEDULE_ERROR);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} 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 codes */ @Override public void batchExportProcessDefinitionByCodes(User loginUser, long projectCode, String codes, HttpServletResponse response) { if (org.apache.commons.lang.StringUtils.isEmpty(codes)) { return; } Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return; } Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet()); List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet); if (CollectionUtils.isEmpty(processDefinitionList)) { return; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream().filter(o -> projectCode == o.getProjectCode()).collect(Collectors.toList()); List<DagDataSchedule> dagDataSchedules = processDefinitionListInProject.stream().map(this::exportProcessDagData).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(dagDataSchedules)) { downloadProcessDefinitionFile(response, dagDataSchedules); } } /** * download the process definition file */ private void downloadProcessDefinitionFile(HttpServletResponse response, List<DagDataSchedule> dagDataSchedules) { response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE); BufferedOutputStream buff = null; ServletOutputStream out = null; try { out = response.getOutputStream(); buff = new BufferedOutputStream(out); buff.write(JSONUtils.toJsonString(dagDataSchedules).getBytes(StandardCharsets.UTF_8)); buff.flush(); buff.close(); } catch (IOException e) { logger.warn("export process fail", e); } finally { if (null != buff) { try { buff.close(); } catch (Exception e) { logger.warn("export process buffer not close", e); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (null != out) { try { out.close(); } catch (Exception e) { logger.warn("export process output stream not close", e); } } } } /** * get export process dag data * * @param processDefinition process definition * @return DagDataSchedule */ public DagDataSchedule exportProcessDagData(ProcessDefinition processDefinition) { Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(processDefinition.getCode()); DagDataSchedule dagDataSchedule = new DagDataSchedule(processService.genDagData(processDefinition)); if (scheduleObj != null) { scheduleObj.setReleaseState(ReleaseState.OFFLINE); dagDataSchedule.setSchedule(scheduleObj); } return dagDataSchedule; } /** * import process definition * * @param loginUser login user * @param projectCode project code * @param file process metadata json file
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @return import process */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> importProcessDefinition(User loginUser, long projectCode, MultipartFile file) { Map<String, Object> result = new HashMap<>(); String dagDataScheduleJson = FileUtils.file2String(file); List<DagDataSchedule> dagDataScheduleList = JSONUtils.toList(dagDataScheduleJson, DagDataSchedule.class); if (CollectionUtils.isEmpty(dagDataScheduleList)) { putMsg(result, Status.DATA_IS_NULL, "fileContent"); return result; } for (DagDataSchedule dagDataSchedule : dagDataScheduleList) { if (!checkAndImport(loginUser, projectCode, result, dagDataSchedule)) { return result; } } return result; } @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> importSqlProcessDefinition(User loginUser, long projectCode, MultipartFile file) { Map<String, Object> result = new HashMap<>(); String processDefinitionName = file.getOriginalFilename() == null ? file.getName() : file.getOriginalFilename(); int index = processDefinitionName.lastIndexOf("."); if (index > 0) { processDefinitionName = processDefinitionName.substring(0, index); } processDefinitionName = processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
ProcessDefinition processDefinition; List<TaskDefinitionLog> taskDefinitionList = new ArrayList<>(); List<ProcessTaskRelationLog> processTaskRelationList = new ArrayList<>(); final int THRESHOLD_ENTRIES = 10000; final int THRESHOLD_SIZE = 1000000000; final double THRESHOLD_RATIO = 10; int totalEntryArchive = 0; int totalSizeEntry = 0; Map<String, DataSource> dataSourceCache = new HashMap<>(1); Map<String, Long> taskNameToCode = new HashMap<>(16); Map<String, List<String>> taskNameToUpstream = new HashMap<>(16); try (ZipInputStream zIn = new ZipInputStream(file.getInputStream()); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(zIn))) { processDefinition = new ProcessDefinition(projectCode, processDefinitionName, CodeGenerateUtils.getInstance().genCode(), "", "[]", null, 0, loginUser.getId(), loginUser.getTenantId()); ZipEntry entry; while ((entry = zIn.getNextEntry()) != null) { totalEntryArchive++; int totalSizeArchive = 0; if (!entry.isDirectory()) { StringBuilder sql = new StringBuilder(); String taskName = null; String datasourceName = null;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<String> upstreams = Collections.emptyList(); String line; while ((line = bufferedReader.readLine()) != null) { int nBytes = line.getBytes(StandardCharsets.UTF_8).length; totalSizeEntry += nBytes; totalSizeArchive += nBytes; long compressionRatio = totalSizeEntry / entry.getCompressedSize(); if (compressionRatio > THRESHOLD_RATIO) { throw new IllegalStateException("ratio between compressed and uncompressed data is highly suspicious, looks like a Zip Bomb Attack"); } int commentIndex = line.indexOf("-- "); if (commentIndex >= 0) { int colonIndex = line.indexOf(":", commentIndex); if (colonIndex > 0) { String key = line.substring(commentIndex + 3, colonIndex).trim().toLowerCase(); String value = line.substring(colonIndex + 1).trim(); switch (key) { case "name": taskName = value; line = line.substring(0, commentIndex); break; case "upstream": upstreams = Arrays.stream(value.split(",")).map(String::trim) .filter(s -> !"".equals(s)).collect(Collectors.toList()); line = line.substring(0, commentIndex); break; case "datasource": datasourceName = value; line = line.substring(0, commentIndex); break;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
default: break; } } } if (!"".equals(line)) { sql.append(line).append("\n"); } } if (taskName == null) { taskName = entry.getName(); index = taskName.indexOf("/"); if (index > 0) { taskName = taskName.substring(index + 1); } index = taskName.lastIndexOf("."); if (index > 0) { taskName = taskName.substring(0, index); } } DataSource dataSource = dataSourceCache.get(datasourceName); if (dataSource == null) { dataSource = queryDatasourceByNameAndUser(datasourceName, loginUser); } if (dataSource == null) { putMsg(result, Status.DATASOURCE_NAME_ILLEGAL); return result; } dataSourceCache.put(datasourceName, dataSource);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
TaskDefinitionLog taskDefinition = buildNormalSqlTaskDefinition(taskName, dataSource, sql.substring(0, sql.length() - 1)); taskDefinitionList.add(taskDefinition); taskNameToCode.put(taskDefinition.getName(), taskDefinition.getCode()); taskNameToUpstream.put(taskDefinition.getName(), upstreams); } if (totalSizeArchive > THRESHOLD_SIZE) { throw new IllegalStateException("the uncompressed data size is too much for the application resource capacity"); } if (totalEntryArchive > THRESHOLD_ENTRIES) { throw new IllegalStateException("too much entries in this archive, can lead to inodes exhaustion of the system"); } } } catch (Exception e) { logger.error(e.getMessage(), e); putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); return result; } for (Map.Entry<String, Long> entry : taskNameToCode.entrySet()) { List<String> upstreams = taskNameToUpstream.get(entry.getKey()); if (CollectionUtils.isEmpty(upstreams) || (upstreams.size() == 1 && upstreams.contains("root") && !taskNameToCode.containsKey("root"))) { ProcessTaskRelationLog processTaskRelation = buildNormalTaskRelation(0, entry.getValue()); processTaskRelationList.add(processTaskRelation); continue; } for (String upstream : upstreams) { ProcessTaskRelationLog processTaskRelation = buildNormalTaskRelation(taskNameToCode.get(upstream), entry.getValue()); processTaskRelationList.add(processTaskRelation); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} return createDagDefine(loginUser, processTaskRelationList, processDefinition, taskDefinitionList); } private ProcessTaskRelationLog buildNormalTaskRelation(long preTaskCode, long postTaskCode) { ProcessTaskRelationLog processTaskRelation = new ProcessTaskRelationLog(); processTaskRelation.setPreTaskCode(preTaskCode); processTaskRelation.setPreTaskVersion(0); processTaskRelation.setPostTaskCode(postTaskCode); processTaskRelation.setPostTaskVersion(0); processTaskRelation.setConditionType(ConditionType.NONE); processTaskRelation.setName(""); return processTaskRelation; } private DataSource queryDatasourceByNameAndUser(String datasourceName, User loginUser) { if (isAdmin(loginUser)) { List<DataSource> dataSources = dataSourceMapper.queryDataSourceByName(datasourceName); if (CollectionUtils.isNotEmpty(dataSources)) { return dataSources.get(0); } } else { return dataSourceMapper.queryDataSourceByNameAndUserId(loginUser.getId(), datasourceName); } return null; } private TaskDefinitionLog buildNormalSqlTaskDefinition(String taskName, DataSource dataSource, String sql) throws CodeGenerateException { TaskDefinitionLog taskDefinition = new TaskDefinitionLog(); taskDefinition.setName(taskName); taskDefinition.setFlag(Flag.YES); SqlParameters sqlParameters = new SqlParameters(); sqlParameters.setType(dataSource.getType().name());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
sqlParameters.setDatasource(dataSource.getId()); sqlParameters.setSql(sql.substring(0, sql.length() - 1)); sqlParameters.setSqlType(SqlType.NON_QUERY.ordinal()); sqlParameters.setLocalParams(Collections.emptyList()); taskDefinition.setTaskParams(JSONUtils.toJsonString(sqlParameters)); taskDefinition.setCode(CodeGenerateUtils.getInstance().genCode()); taskDefinition.setTaskType(TaskType.SQL.getDesc()); taskDefinition.setFailRetryTimes(0); taskDefinition.setFailRetryInterval(0); taskDefinition.setTimeoutFlag(TimeoutFlag.CLOSE); taskDefinition.setWorkerGroup(DEFAULT_WORKER_GROUP); taskDefinition.setTaskPriority(Priority.MEDIUM); taskDefinition.setEnvironmentCode(-1); taskDefinition.setTimeout(0); taskDefinition.setDelayTime(0); taskDefinition.setTimeoutNotifyStrategy(TaskTimeoutStrategy.WARN); taskDefinition.setVersion(0); taskDefinition.setResourceIds(""); return taskDefinition; } /** * check and import */ private boolean checkAndImport(User loginUser, long projectCode, Map<String, Object> result, DagDataSchedule dagDataSchedule) { if (!checkImportanceParams(dagDataSchedule, result)) { return false; } ProcessDefinition processDefinition = dagDataSchedule.getProcessDefinition();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Map<String, Object> checkResult = verifyProcessDefinitionName(loginUser, projectCode, processDefinition.getName()); if (Status.SUCCESS.equals(checkResult.get(Constants.STATUS))) { putMsg(result, Status.SUCCESS); } else { result.putAll(checkResult); return false; } String processDefinitionName = recursionProcessDefinitionName(projectCode, processDefinition.getName(), 1); processDefinition.setName(processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp()); processDefinition.setId(0); processDefinition.setProjectCode(projectCode); processDefinition.setUserId(loginUser.getId()); try { processDefinition.setCode(CodeGenerateUtils.getInstance().genCode()); } catch (CodeGenerateException e) { putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); return false; } List<TaskDefinition> taskDefinitionList = dagDataSchedule.getTaskDefinitionList(); Map<Long, Long> taskCodeMap = new HashMap<>(); Date now = new Date(); List<TaskDefinitionLog> taskDefinitionLogList = new ArrayList<>(); for (TaskDefinition taskDefinition : taskDefinitionList) { TaskDefinitionLog taskDefinitionLog = new TaskDefinitionLog(taskDefinition); taskDefinitionLog.setName(taskDefinitionLog.getName() + "_import_" + DateUtils.getCurrentTimeStamp()); taskDefinitionLog.setProjectCode(projectCode); taskDefinitionLog.setUserId(loginUser.getId()); taskDefinitionLog.setVersion(Constants.VERSION_FIRST); taskDefinitionLog.setCreateTime(now); taskDefinitionLog.setUpdateTime(now);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
taskDefinitionLog.setOperator(loginUser.getId()); taskDefinitionLog.setOperateTime(now); try { long code = CodeGenerateUtils.getInstance().genCode(); taskCodeMap.put(taskDefinitionLog.getCode(), code); taskDefinitionLog.setCode(code); } catch (CodeGenerateException e) { logger.error("Task code get error, ", e); putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code"); return false; } taskDefinitionLogList.add(taskDefinitionLog); } int insert = taskDefinitionMapper.batchInsert(taskDefinitionLogList); int logInsert = taskDefinitionLogMapper.batchInsert(taskDefinitionLogList); if ((logInsert & insert) == 0) { putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR); } List<ProcessTaskRelation> taskRelationList = dagDataSchedule.getProcessTaskRelationList(); List<ProcessTaskRelationLog> taskRelationLogList = new ArrayList<>(); for (ProcessTaskRelation processTaskRelation : taskRelationList) { ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog(processTaskRelation); if (taskCodeMap.containsKey(processTaskRelationLog.getPreTaskCode())) { processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode())); } if (taskCodeMap.containsKey(processTaskRelationLog.getPostTaskCode())) { processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode())); } processTaskRelationLog.setPreTaskVersion(Constants.VERSION_FIRST);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST); taskRelationLogList.add(processTaskRelationLog); } if (StringUtils.isNotEmpty(processDefinition.getLocations()) && JSONUtils.checkJsonValid(processDefinition.getLocations())) { ArrayNode arrayNode = JSONUtils.parseArray(processDefinition.getLocations()); ArrayNode newArrayNode = JSONUtils.createArrayNode(); for (int i = 0; i < arrayNode.size(); i++) { ObjectNode newObjectNode = newArrayNode.addObject(); JsonNode jsonNode = arrayNode.get(i); Long taskCode = taskCodeMap.get(jsonNode.get("taskCode").asLong()); if (Objects.nonNull(taskCode)) { newObjectNode.put("taskCode", taskCode); newObjectNode.set("x", jsonNode.get("x")); newObjectNode.set("y", jsonNode.get("y")); } } processDefinition.setLocations(newArrayNode.toString()); } processDefinition.setCreateTime(new Date()); processDefinition.setUpdateTime(new Date()); Map<String, Object> createDagResult = createDagDefine(loginUser, taskRelationLogList, processDefinition, Lists.newArrayList()); if (Status.SUCCESS.equals(createDagResult.get(Constants.STATUS))) { putMsg(createDagResult, Status.SUCCESS); } else { result.putAll(createDagResult); throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR); } Schedule schedule = dagDataSchedule.getSchedule(); if (null != schedule) { ProcessDefinition newProcessDefinition = processDefinitionMapper.queryByCode(processDefinition.getCode());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
schedule.setProcessDefinitionCode(newProcessDefinition.getCode()); schedule.setUserId(loginUser.getId()); schedule.setCreateTime(now); schedule.setUpdateTime(now); int scheduleInsert = scheduleMapper.insert(schedule); if (0 == scheduleInsert) { putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR); } } return true; } /** * check importance params */ private boolean checkImportanceParams(DagDataSchedule dagDataSchedule, Map<String, Object> result) { if (dagDataSchedule.getProcessDefinition() == null) { putMsg(result, Status.DATA_IS_NULL, "ProcessDefinition"); return false; } if (CollectionUtils.isEmpty(dagDataSchedule.getTaskDefinitionList())) { putMsg(result, Status.DATA_IS_NULL, "TaskDefinitionList"); return false; } if (CollectionUtils.isEmpty(dagDataSchedule.getProcessTaskRelationList())) { putMsg(result, Status.DATA_IS_NULL, "ProcessTaskRelationList"); return false; } return true; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
private String recursionProcessDefinitionName(long projectCode, String processDefinitionName, int num) { ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, 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(projectCode, processDefinitionName, num + 1); } /** * check the process task relation json * * @param processTaskRelationJson process task relation json * @return check result code */ @Override public Map<String, Object> checkProcessNodeList(String processTaskRelationJson, List<TaskDefinitionLog> taskDefinitionLogsList) { Map<String, Object> result = new HashMap<>(); try { if (processTaskRelationJson == null) { logger.error("process data is null"); putMsg(result, Status.DATA_IS_NOT_VALID, processTaskRelationJson); return result; } List<ProcessTaskRelation> taskRelationList = JSONUtils.toList(processTaskRelationJson, ProcessTaskRelation.class);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<TaskNode> taskNodes = processService.transformTask(taskRelationList, taskDefinitionLogsList); if (CollectionUtils.isEmpty(taskNodes)) { logger.error("process node info is empty"); putMsg(result, Status.PROCESS_DAG_IS_EMPTY); return result; } if (graphHasCycle(taskNodes)) { logger.error("process DAG has cycle"); putMsg(result, Status.PROCESS_NODE_HAS_CYCLE); return result; } for (TaskNode taskNode : taskNodes) { if (!CheckUtils.checkTaskNodeParameters(taskNode)) { logger.error("task node {} parameter invalid", taskNode.getName()); putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName()); return result; } CheckUtils.checkOtherParams(taskNode.getExtras()); } putMsg(result, Status.SUCCESS); } catch (Exception e) { result.put(Constants.STATUS, Status.INTERNAL_SERVER_ERROR_ARGS); putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, e.getMessage()); logger.error(Status.INTERNAL_SERVER_ERROR_ARGS.getMsg(), e); } return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} /** * get task node details based on process definition * * @param loginUser loginUser * @param projectCode project code * @param code process definition code * @return task node list */ @Override public Map<String, Object> getTaskNodeListByDefinitionCode(User loginUser, long projectCode, long code) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { logger.info("process define not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); return result; } DagData dagData = processService.genDagData(processDefinition); result.put(Constants.DATA_LIST, dagData.getTaskDefinitionList()); putMsg(result, Status.SUCCESS); return result; } /** * get task node details map based on process definition
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* * @param loginUser loginUser * @param projectCode project code * @param codes define codes * @return task node list */ @Override public Map<String, Object> getNodeListMapByDefinitionCodes(User loginUser, long projectCode, String codes) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet()); List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet); if (CollectionUtils.isEmpty(processDefinitionList)) { logger.info("process definition not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes); return result; } HashMap<Long, Project> userProjects = new HashMap<>(Constants.DEFAULT_HASH_MAP_SIZE); projectMapper.queryProjectCreatedAndAuthorizedByUserId(loginUser.getId()) .forEach(userProject -> userProjects.put(userProject.getCode(), userProject)); List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream() .filter(o -> userProjects.containsKey(o.getProjectCode())).collect(Collectors.toList()); if (CollectionUtils.isEmpty(processDefinitionListInProject)) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} Map<Long, List<TaskDefinition>> taskNodeMap = new HashMap<>(); for (ProcessDefinition processDefinition : processDefinitionListInProject) { DagData dagData = processService.genDagData(processDefinition); taskNodeMap.put(processDefinition.getCode(), dagData.getTaskDefinitionList()); } result.put(Constants.DATA_LIST, taskNodeMap); putMsg(result, Status.SUCCESS); return result; } /** * query process definition all by project code * * @param loginUser loginUser * @param projectCode project code * @return process definitions in the project */ @Override public Map<String, Object> queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode); List<DagData> dagDataList = processDefinitions.stream().map(processService::genDagData).collect(Collectors.toList()); result.put(Constants.DATA_LIST, dagDataList); putMsg(result, Status.SUCCESS); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} /** * Encapsulates the TreeView structure * * @param projectCode project code * @param code process definition code * @param limit limit * @return tree view json data */ @Override public Map<String, Object> viewTree(long projectCode, long code, Integer limit) { Map<String, Object> result = new HashMap<>(); ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (null == processDefinition || projectCode != processDefinition.getProjectCode()) { logger.info("process define not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); return result; } DAG<String, TaskNode, TaskNodeRelation> dag = processService.genDagGraph(processDefinition); Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>(); Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>(); List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineCode(code, limit); processInstanceList.forEach(processInstance -> processInstance.setDuration(DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()))); List<TaskDefinitionLog> taskDefinitionList = processService.genTaskDefineList(processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode())); Map<Long, TaskDefinitionLog> taskDefinitionMap = taskDefinitionList.stream() .collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog)); if (limit > processInstanceList.size()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
limit = processInstanceList.size(); } TreeViewDto parentTreeViewDto = new TreeViewDto(); parentTreeViewDto.setName("DAG"); parentTreeViewDto.setType(""); parentTreeViewDto.setCode(0L); for (int i = limit - 1; i >= 0; i--) { ProcessInstance processInstance = processInstanceList.get(i); Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime(); parentTreeViewDto.getInstances().add(new Instance(processInstance.getId(), processInstance.getName(), processInstance.getProcessDefinitionCode(), "", processInstance.getState().toString(), processInstance.getStartTime(), endTime, processInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime()))); } List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>(); parentTreeViewDtoList.add(parentTreeViewDto); for (String startNode : dag.getBeginNode()) { runningNodeMap.put(startNode, parentTreeViewDtoList); } while (Stopper.isRunning()) { Set<String> postNodeList; Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<String, List<TreeViewDto>> en = iter.next(); String nodeCode = en.getKey(); parentTreeViewDtoList = en.getValue(); TreeViewDto treeViewDto = new TreeViewDto(); TaskNode taskNode = dag.getNode(nodeCode); treeViewDto.setType(taskNode.getType());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
treeViewDto.setCode(taskNode.getCode()); treeViewDto.setName(taskNode.getName()); for (int i = limit - 1; i >= 0; i--) { ProcessInstance processInstance = processInstanceList.get(i); TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndCode(processInstance.getId(), Long.parseLong(nodeCode)); if (taskInstance == null) { treeViewDto.getInstances().add(new Instance(-1, "not running", 0, "null")); } else { Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime(); Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime(); long subProcessCode = 0L; if (taskInstance.isSubProcess()) { TaskDefinition taskDefinition = taskDefinitionMap.get(taskInstance.getTaskCode()); subProcessCode = Integer.parseInt(JSONUtils.parseObject( taskDefinition.getTaskParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_CODE).asText()); } treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(), taskInstance.getTaskCode(), taskInstance.getTaskType(), taskInstance.getState().toString(), taskInstance.getStartTime(), taskInstance.getEndTime(), taskInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessCode)); } } for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) { pTreeViewDto.getChildren().add(treeViewDto); } postNodeList = dag.getSubsequentNodes(nodeCode); if (CollectionUtils.isNotEmpty(postNodeList)) { for (String nextNodeCode : postNodeList) { List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (CollectionUtils.isEmpty(treeViewDtoList)) { treeViewDtoList = new ArrayList<>(); } treeViewDtoList.add(treeViewDto); waitingRunningNodeMap.put(nextNodeCode, treeViewDtoList); } } runningNodeMap.remove(nodeCode); } if (waitingRunningNodeMap.size() == 0) { break; } else { runningNodeMap.putAll(waitingRunningNodeMap); waitingRunningNodeMap.clear(); } } result.put(Constants.DATA_LIST, parentTreeViewDto); result.put(Constants.STATUS, Status.SUCCESS); result.put(Constants.MSG, Status.SUCCESS.getMsg()); return result; } /** * whether the graph has a ring * * @param taskNodeResponseList task node response list * @return if graph has cycle flag */ private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) { DAG<String, TaskNode, String> graph = new DAG<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
for (TaskNode taskNodeResponse : taskNodeResponseList) { graph.addNode(Long.toString(taskNodeResponse.getCode()), taskNodeResponse); } for (TaskNode taskNodeResponse : taskNodeResponseList) { List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(), String.class); if (CollectionUtils.isNotEmpty(preTasks)) { for (String preTask : preTasks) { if (!graph.addEdge(preTask, Long.toString(taskNodeResponse.getCode()))) { return true; } } } } return graph.hasCycle(); } /** * batch copy process definition * * @param loginUser loginUser * @param projectCode projectCode * @param codes processDefinitionCodes * @param targetProjectCode targetProjectCode */ @Override public Map<String, Object> batchCopyProcessDefinition(User loginUser, long projectCode, String codes, long targetProjectCode) { Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<String> failedProcessList = new ArrayList<>(); doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, true); if (result.get(Constants.STATUS) == Status.NOT_SUPPORT_COPY_TASK_TYPE) { return result; } checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, true); return result; } /** * batch move process definition * Will be deleted * @param loginUser loginUser * @param projectCode projectCode * @param codes processDefinitionCodes * @param targetProjectCode targetProjectCode */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> batchMoveProcessDefinition(User loginUser, long projectCode, String codes, long targetProjectCode) { Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (projectCode == targetProjectCode) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return result; } List<String> failedProcessList = new ArrayList<>(); doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, false); checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, false); return result; } private Map<String, Object> checkParams(User loginUser, long projectCode, String processDefinitionCodes, long targetProjectCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (org.apache.commons.lang.StringUtils.isEmpty(processDefinitionCodes)) { putMsg(result, Status.PROCESS_DEFINITION_CODES_IS_EMPTY, processDefinitionCodes); return result; } if (projectCode != targetProjectCode) { Project targetProject = projectMapper.queryByCode(targetProjectCode); Map<String, Object> targetResult = projectService.checkProjectAndAuth(loginUser, targetProject, targetProjectCode); if (targetResult.get(Constants.STATUS) != Status.SUCCESS) { return targetResult; } } return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} private void doBatchOperateProcessDefinition(User loginUser, long targetProjectCode, List<String> failedProcessList, String processDefinitionCodes, Map<String, Object> result, boolean isCopy) { Set<Long> definitionCodes = Arrays.stream(processDefinitionCodes.split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet()); List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(definitionCodes); Set<Long> queryCodes = processDefinitionList.stream().map(ProcessDefinition::getCode).collect(Collectors.toSet()); Set<Long> diffCode = definitionCodes.stream().filter(code -> !queryCodes.contains(code)).collect(Collectors.toSet()); diffCode.forEach(code -> failedProcessList.add(code + "[null]")); for (ProcessDefinition processDefinition : processDefinitionList) { List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode()); List<ProcessTaskRelationLog> taskRelationList = processTaskRelations.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList()); processDefinition.setProjectCode(targetProjectCode); if (isCopy) { List<TaskDefinitionLog> taskDefinitionLogs = processService.genTaskDefineList(processTaskRelations); Map<Long, Long> taskCodeMap = new HashMap<>(); for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { if (TaskType.CONDITIONS.getDesc().equals(taskDefinitionLog.getTaskType()) || TaskType.SWITCH.getDesc().equals(taskDefinitionLog.getTaskType()) || TaskType.SUB_PROCESS.getDesc().equals(taskDefinitionLog.getTaskType()) || TaskType.DEPENDENT.getDesc().equals(taskDefinitionLog.getTaskType())) { putMsg(result, Status.NOT_SUPPORT_COPY_TASK_TYPE, taskDefinitionLog.getTaskType()); return; } try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
long taskCode = CodeGenerateUtils.getInstance().genCode(); taskCodeMap.put(taskDefinitionLog.getCode(), taskCode); taskDefinitionLog.setCode(taskCode); } catch (CodeGenerateException e) { putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS); throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS); } taskDefinitionLog.setProjectCode(targetProjectCode); taskDefinitionLog.setVersion(0); taskDefinitionLog.setName(taskDefinitionLog.getName() + "_copy_" + DateUtils.getCurrentTimeStamp()); } for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) { if (processTaskRelationLog.getPreTaskCode() > 0) { processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode())); } if (processTaskRelationLog.getPostTaskCode() > 0) { processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode())); } } try { processDefinition.setCode(CodeGenerateUtils.getInstance().genCode()); } catch (CodeGenerateException e) { putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS); throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS); } processDefinition.setId(0); processDefinition.setUserId(loginUser.getId()); processDefinition.setName(processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp()); if (StringUtils.isNotBlank(processDefinition.getLocations())) { ArrayNode jsonNodes = JSONUtils.parseArray(processDefinition.getLocations());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
for (int i = 0; i < jsonNodes.size(); i++) { ObjectNode node = (ObjectNode) jsonNodes.path(i); node.put("taskCode", taskCodeMap.get(node.get("taskCode").asLong())); jsonNodes.set(i, node); } processDefinition.setLocations(JSONUtils.toJsonString(jsonNodes)); } try { result.putAll(createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs)); } catch (Exception e) { putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR); throw new ServiceException(Status.COPY_PROCESS_DEFINITION_ERROR); } } else { try { result.putAll(updateDagDefine(loginUser, taskRelationList, processDefinition, null, Lists.newArrayList())); } catch (Exception e) { putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR); throw new ServiceException(Status.MOVE_PROCESS_DEFINITION_ERROR); } } if (result.get(Constants.STATUS) != Status.SUCCESS) { failedProcessList.add(processDefinition.getCode() + "[" + processDefinition.getName() + "]"); } } } /** * switch the defined process definition version * * @param loginUser login user
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @param projectCode project code * @param code process definition code * @param version the version user want to switch * @return switch process definition version result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> switchProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (Objects.isNull(processDefinition) || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR, code); return result; } ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(code, version); if (Objects.isNull(processDefinitionLog)) { putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR, processDefinition.getCode(), version); return result; } int switchVersion = processService.switchVersion(processDefinition, processDefinitionLog); if (switchVersion <= 0) { putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR); throw new ServiceException(Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR); } putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return result; } /** * check batch operate result * * @param srcProjectCode srcProjectCode * @param targetProjectCode targetProjectCode * @param result result * @param failedProcessList failedProcessList * @param isCopy isCopy */ private void checkBatchOperateResult(long srcProjectCode, long targetProjectCode, Map<String, Object> result, List<String> failedProcessList, boolean isCopy) { if (!failedProcessList.isEmpty()) { if (isCopy) { putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode, String.join(",", failedProcessList)); } else { putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode, String.join(",", failedProcessList)); } } else { putMsg(result, Status.SUCCESS); } } /** * query the pagination versions info by one certain process definition code * * @param loginUser login user info to check auth * @param projectCode project code * @param pageNo page number * @param pageSize page size
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @param code process definition code * @return the pagination process definition versions info of the certain process definition */ @Override public Result queryProcessDefinitionVersions(User loginUser, long projectCode, int pageNo, int pageSize, long code) { Result result = new Result(); Project project = projectMapper.queryByCode(projectCode); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { putMsg(result, resultStatus); return result; } PageInfo<ProcessDefinitionLog> pageInfo = new PageInfo<>(pageNo, pageSize); Page<ProcessDefinitionLog> page = new Page<>(pageNo, pageSize); IPage<ProcessDefinitionLog> processDefinitionVersionsPaging = processDefinitionLogMapper.queryProcessDefinitionVersionsPaging(page, code, projectCode); List<ProcessDefinitionLog> processDefinitionLogs = processDefinitionVersionsPaging.getRecords(); pageInfo.setTotalList(processDefinitionLogs); pageInfo.setTotal((int) processDefinitionVersionsPaging.getTotal()); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * delete one certain process definition by version number and process definition code * * @param loginUser login user info to check auth * @param projectCode project code * @param code process definition code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @param version version number * @return delete result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> deleteProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); } else { if (processDefinition.getVersion() == version) { putMsg(result, Status.MAIN_TABLE_USING_VERSION); return result; } int deleteLog = processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(code, version); int deleteRelationLog = processTaskRelationLogMapper.deleteByCode(code, version); if (deleteLog == 0 || deleteRelationLog == 0) { putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); } putMsg(result, Status.SUCCESS); } return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,463
[Bug] [API] releaseWorkflowAndSchedule api of timing does not take effect/relation api cause workflow offline afterbinding
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened 1. releaseWorkflowAndSchedule api of timing does not take effect 2. relation api cause workflow offline afterbinding ### What you expected to happen Should be used normally. ### How to reproduce Call through API ### Anything else _No response_ ### Version 2.0.3 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8463
https://github.com/apache/dolphinscheduler/pull/8464
cd8c5e1c9aeff536c705c9152b31a09a674ea864
8d0a0f9c323c8153573b159090aa93d6ea87a30d
2022-02-21T07:07:39Z
java
2022-02-21T07:58:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
/** * create empty process definition * * @param loginUser login user * @param projectCode project code * @param name process definition name * @param description description * @param globalParams globalParams * @param timeout timeout * @param tenantCode tenantCode * @param scheduleJson scheduleJson * @return process definition code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> createEmptyProcessDefinition(User loginUser, long projectCode, String name, String description, String globalParams, int timeout, String tenantCode, String scheduleJson, ProcessExecutionTypeEnum executionType) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; }