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,182 | [Bug] [plugin] python task execute error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
PYTHON_HOME configuration is as follows:
export PYTHON_HOME=/usr/bin/python3
When performing the task, the prompt cannot find the relevant python module:

Scripts run correctly on the server.

If I change the "python” to “python3”, the python task will run successfully.

or
Delete the python soft link on the server, create a new soft link and point to python3, and the task can also run successfully.


### What you expected to happen
Python tasks can be executed normally.
### How to reproduce
See "What happened"
### Anything else
_No response_
### Version
2.0.3
### 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/8182 | https://github.com/apache/dolphinscheduler/pull/8196 | fb9f4a1339b31fdfcf43828cbe024ac11d8392d1 | a1cc2fd11ac97b2bace6977f946c0bc0480cc620 | 2022-01-25T00:28:28Z | java | 2022-01-26T03:09:57Z | dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,182 | [Bug] [plugin] python task execute error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
PYTHON_HOME configuration is as follows:
export PYTHON_HOME=/usr/bin/python3
When performing the task, the prompt cannot find the relevant python module:

Scripts run correctly on the server.

If I change the "python” to “python3”, the python task will run successfully.

or
Delete the python soft link on the server, create a new soft link and point to python3, and the task can also run successfully.


### What you expected to happen
Python tasks can be executed normally.
### How to reproduce
See "What happened"
### Anything else
_No response_
### Version
2.0.3
### 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/8182 | https://github.com/apache/dolphinscheduler/pull/8196 | fb9f4a1339b31fdfcf43828cbe024ac11d8392d1 | a1cc2fd11ac97b2bace6977f946c0bc0480cc620 | 2022-01-25T00:28:28Z | java | 2022-01-26T03:09:57Z | dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java | * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.python;
import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor;
import org.apache.dolphinscheduler.plugin.task.api.ShellCommandExecutor;
import org.apache.dolphinscheduler.plugin.task.api.TaskException;
import org.apache.dolphinscheduler.plugin.task.api.TaskResponse;
import org.apache.dolphinscheduler.plugin.task.util.MapUtils;
import org.apache.dolphinscheduler.spi.task.AbstractParameters;
import org.apache.dolphinscheduler.spi.task.Property;
import org.apache.dolphinscheduler.spi.task.TaskConstants;
import org.apache.dolphinscheduler.spi.task.paramparser.ParamUtils;
import org.apache.dolphinscheduler.spi.task.paramparser.ParameterUtils;
import org.apache.dolphinscheduler.spi.task.request.TaskRequest;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
/**
* python task
*/
public class PythonTask extends AbstractTaskExecutor { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,182 | [Bug] [plugin] python task execute error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
PYTHON_HOME configuration is as follows:
export PYTHON_HOME=/usr/bin/python3
When performing the task, the prompt cannot find the relevant python module:

Scripts run correctly on the server.

If I change the "python” to “python3”, the python task will run successfully.

or
Delete the python soft link on the server, create a new soft link and point to python3, and the task can also run successfully.


### What you expected to happen
Python tasks can be executed normally.
### How to reproduce
See "What happened"
### Anything else
_No response_
### Version
2.0.3
### 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/8182 | https://github.com/apache/dolphinscheduler/pull/8196 | fb9f4a1339b31fdfcf43828cbe024ac11d8392d1 | a1cc2fd11ac97b2bace6977f946c0bc0480cc620 | 2022-01-25T00:28:28Z | java | 2022-01-26T03:09:57Z | dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java | /**
* python parameters
*/
private PythonParameters pythonParameters;
/**
* shell command executor
*/
private ShellCommandExecutor shellCommandExecutor;
private TaskRequest taskRequest;
/**
* constructor
*
* @param taskRequest taskRequest
*/
public PythonTask(TaskRequest taskRequest) {
super(taskRequest);
this.taskRequest = taskRequest;
this.shellCommandExecutor = new ShellCommandExecutor(this::logHandle,
taskRequest,
logger);
}
@Override
public void init() {
logger.info("python task params {}", taskRequest.getTaskParams());
pythonParameters = JSONUtils.parseObject(taskRequest.getTaskParams(), PythonParameters.class);
if (!pythonParameters.checkParameters()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,182 | [Bug] [plugin] python task execute error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
PYTHON_HOME configuration is as follows:
export PYTHON_HOME=/usr/bin/python3
When performing the task, the prompt cannot find the relevant python module:

Scripts run correctly on the server.

If I change the "python” to “python3”, the python task will run successfully.

or
Delete the python soft link on the server, create a new soft link and point to python3, and the task can also run successfully.


### What you expected to happen
Python tasks can be executed normally.
### How to reproduce
See "What happened"
### Anything else
_No response_
### Version
2.0.3
### 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/8182 | https://github.com/apache/dolphinscheduler/pull/8196 | fb9f4a1339b31fdfcf43828cbe024ac11d8392d1 | a1cc2fd11ac97b2bace6977f946c0bc0480cc620 | 2022-01-25T00:28:28Z | java | 2022-01-26T03:09:57Z | dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java | throw new TaskException("python task params is not valid");
}
}
@Override
public String getPreScript() {
String rawPythonScript = pythonParameters.getRawScript().replaceAll("\\r\\n", "\n");
try {
rawPythonScript = convertPythonScriptPlaceholders(rawPythonScript);
} catch (StringIndexOutOfBoundsException e) {
logger.error("setShareVar field format error, raw python script : {}", rawPythonScript);
}
return rawPythonScript;
}
@Override
public void handle() throws Exception {
try {
String pythonScriptContent = buildPythonScriptContent();
String pythonScriptFile = buildPythonCommandFilePath();
createPythonCommandFileIfNotExists(pythonScriptContent,pythonScriptFile);
String command = "python " + pythonScriptFile;
TaskResponse taskResponse = shellCommandExecutor.run(command);
setExitStatusCode(taskResponse.getExitStatusCode());
setAppIds(taskResponse.getAppIds());
setProcessId(taskResponse.getProcessId());
setVarPool(shellCommandExecutor.getVarPool());
} catch (Exception e) {
logger.error("python task failure", e); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,182 | [Bug] [plugin] python task execute error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
PYTHON_HOME configuration is as follows:
export PYTHON_HOME=/usr/bin/python3
When performing the task, the prompt cannot find the relevant python module:

Scripts run correctly on the server.

If I change the "python” to “python3”, the python task will run successfully.

or
Delete the python soft link on the server, create a new soft link and point to python3, and the task can also run successfully.


### What you expected to happen
Python tasks can be executed normally.
### How to reproduce
See "What happened"
### Anything else
_No response_
### Version
2.0.3
### 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/8182 | https://github.com/apache/dolphinscheduler/pull/8196 | fb9f4a1339b31fdfcf43828cbe024ac11d8392d1 | a1cc2fd11ac97b2bace6977f946c0bc0480cc620 | 2022-01-25T00:28:28Z | java | 2022-01-26T03:09:57Z | dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java | setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE);
throw new TaskException("run python task error", e);
}
}
@Override
public void cancelApplication(boolean cancelApplication) throws Exception {
shellCommandExecutor.cancelApplication();
}
@Override
public AbstractParameters getParameters() {
return pythonParameters;
}
/**
* convertPythonScriptPlaceholders
*
* @param rawScript rawScript
* @return String
* @throws StringIndexOutOfBoundsException StringIndexOutOfBoundsException
*/
private static String convertPythonScriptPlaceholders(String rawScript) throws StringIndexOutOfBoundsException {
int len = "${setShareVar(${".length();
int scriptStart = 0;
while ((scriptStart = rawScript.indexOf("${setShareVar(${", scriptStart)) != -1) {
int start = -1;
int end = rawScript.indexOf('}', scriptStart + len);
String prop = rawScript.substring(scriptStart + len, end);
start = rawScript.indexOf(',', end);
end = rawScript.indexOf(')', start);
String value = rawScript.substring(start + 1, end); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,182 | [Bug] [plugin] python task execute error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
PYTHON_HOME configuration is as follows:
export PYTHON_HOME=/usr/bin/python3
When performing the task, the prompt cannot find the relevant python module:

Scripts run correctly on the server.

If I change the "python” to “python3”, the python task will run successfully.

or
Delete the python soft link on the server, create a new soft link and point to python3, and the task can also run successfully.


### What you expected to happen
Python tasks can be executed normally.
### How to reproduce
See "What happened"
### Anything else
_No response_
### Version
2.0.3
### 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/8182 | https://github.com/apache/dolphinscheduler/pull/8196 | fb9f4a1339b31fdfcf43828cbe024ac11d8392d1 | a1cc2fd11ac97b2bace6977f946c0bc0480cc620 | 2022-01-25T00:28:28Z | java | 2022-01-26T03:09:57Z | dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java | start = rawScript.indexOf('}', start) + 1;
end = rawScript.length();
String replaceScript = String.format("print(\"${{setValue({},{})}}\".format(\"%s\",%s))", prop, value);
rawScript = rawScript.substring(0, scriptStart) + replaceScript + rawScript.substring(start, end);
scriptStart += replaceScript.length();
}
return rawScript;
}
/**
* create python command file if not exists
*
* @param pythonScript exec python script
* @param pythonScriptFile python script file
* @throws IOException io exception
*/
protected void createPythonCommandFileIfNotExists(String pythonScript, String pythonScriptFile) throws IOException {
logger.info("tenantCode :{}, task dir:{}", taskRequest.getTenantCode(), taskRequest.getExecutePath());
if (!Files.exists(Paths.get(pythonScriptFile))) {
logger.info("generate python script file:{}", pythonScriptFile);
StringBuilder sb = new StringBuilder();
sb.append("#-*- encoding=utf8 -*-\n");
sb.append("\n\n");
sb.append(pythonScript);
logger.info(sb.toString());
FileUtils.writeStringToFile(new File(pythonScriptFile),
sb.toString(),
StandardCharsets.UTF_8);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,182 | [Bug] [plugin] python task execute error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
PYTHON_HOME configuration is as follows:
export PYTHON_HOME=/usr/bin/python3
When performing the task, the prompt cannot find the relevant python module:

Scripts run correctly on the server.

If I change the "python” to “python3”, the python task will run successfully.

or
Delete the python soft link on the server, create a new soft link and point to python3, and the task can also run successfully.


### What you expected to happen
Python tasks can be executed normally.
### How to reproduce
See "What happened"
### Anything else
_No response_
### Version
2.0.3
### 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/8182 | https://github.com/apache/dolphinscheduler/pull/8196 | fb9f4a1339b31fdfcf43828cbe024ac11d8392d1 | a1cc2fd11ac97b2bace6977f946c0bc0480cc620 | 2022-01-25T00:28:28Z | java | 2022-01-26T03:09:57Z | dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java | /**
* build python command file path
*
* @return python command file path
*/
protected String buildPythonCommandFilePath() {
return String.format("%s/py_%s.py", taskRequest.getExecutePath(), taskRequest.getTaskAppId());
}
/**
* build python script content
*
* @return raw python script
* @throws Exception exception
*/
private String buildPythonScriptContent() throws Exception {
String rawPythonScript = pythonParameters.getRawScript().replaceAll("\\r\\n", "\n");
Map<String, Property> paramsMap = ParamUtils.convert(taskRequest, pythonParameters);
if (MapUtils.isEmpty(paramsMap)) {
paramsMap = new HashMap<>();
}
if (MapUtils.isNotEmpty(taskRequest.getParamsMap())) {
paramsMap.putAll(taskRequest.getParamsMap());
}
rawPythonScript = ParameterUtils.convertParameterPlaceholders(rawPythonScript, ParamUtils.convert(paramsMap));
logger.info("raw python script : {}", pythonParameters.getRawScript());
return rawPythonScript;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,204 | [Bug] [Dev] standalone-server start error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

### What you expected to happen
start successfully.
### How to reproduce
./bin/dolphinscheduler-daemon.sh start standalone-server
### Anything else
_No response_
### Version
dev
### 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/8204 | https://github.com/apache/dolphinscheduler/pull/8205 | 7945a2f3aad15649e671dfa2e80586b14f3472e4 | b05ba4d1b9e6e66fb42f9cd5f7212e919c07725c | 2022-01-26T08:17:34Z | java | 2022-01-26T09:51:20Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/HostUpdateProcessor.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker.processor;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.remote.command.Command;
import org.apache.dolphinscheduler.remote.command.CommandType;
import org.apache.dolphinscheduler.remote.command.HostUpdateCommand;
import org.apache.dolphinscheduler.remote.processor.NettyRemoteChannel; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,204 | [Bug] [Dev] standalone-server start error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

### What you expected to happen
start successfully.
### How to reproduce
./bin/dolphinscheduler-daemon.sh start standalone-server
### Anything else
_No response_
### Version
dev
### 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/8204 | https://github.com/apache/dolphinscheduler/pull/8205 | 7945a2f3aad15649e671dfa2e80586b14f3472e4 | b05ba4d1b9e6e66fb42f9cd5f7212e919c07725c | 2022-01-26T08:17:34Z | java | 2022-01-26T09:51:20Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/HostUpdateProcessor.java | import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.google.common.base.Preconditions;
import io.netty.channel.Channel;
/**
* update process host
* this used when master failover
*/
@Component
public class HostUpdateProcessor implements NettyRequestProcessor {
private final Logger logger = LoggerFactory.getLogger(HostUpdateProcessor.class);
/**
* task callback service
*/
private final TaskCallbackService taskCallbackService;
public HostUpdateProcessor() {
this.taskCallbackService = SpringApplicationContext.getBean(TaskCallbackService.class);
}
@Override
public void process(Channel channel, Command command) {
Preconditions.checkArgument(CommandType.PROCESS_HOST_UPDATE_REQUEST == command.getType(), String.format("invalid command type : %s", command.getType()));
HostUpdateCommand updateCommand = JSONUtils.parseObject(command.getBody(), HostUpdateCommand.class);
logger.info("received host update command : {}", updateCommand);
taskCallbackService.changeRemoteChannel(updateCommand.getTaskInstanceId(), new NettyRemoteChannel(channel, command.getOpaque()));
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.alert.dingtalk;
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_FALSE;
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_NO;
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_TRUE;
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_YES;
import org.apache.dolphinscheduler.alert.api.AlertChannel;
import org.apache.dolphinscheduler.alert.api.AlertChannelFactory;
import org.apache.dolphinscheduler.spi.params.PasswordParam;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;
import org.apache.dolphinscheduler.spi.params.input.InputParam; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java | import org.apache.dolphinscheduler.spi.params.radio.RadioParam;
import java.util.Arrays;
import java.util.List;
import com.google.auto.service.AutoService;
@AutoService(AlertChannelFactory.class)
public final class DingTalkAlertChannelFactory implements AlertChannelFactory {
@Override
public String name() {
return "DingTalk";
}
@Override
public List<PluginParams> params() {
InputParam webHookParam = InputParam
.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_WEB_HOOK, DingTalkParamsConstants.DING_TALK_WEB_HOOK)
.addValidate(Validate.newBuilder()
.setRequired(true)
.build())
.build();
InputParam keywordParam = InputParam
.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_KEYWORD, DingTalkParamsConstants.DING_TALK_KEYWORD)
.addValidate(Validate.newBuilder()
.setRequired(false)
.build())
.build();
InputParam secretParam = InputParam
.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_SECRET, DingTalkParamsConstants.DING_TALK_SECRET)
.addValidate(Validate.newBuilder()
.setRequired(false)
.build())
.build(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java | InputParam atMobilesParam = InputParam
.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_AT_MOBILES, DingTalkParamsConstants.DING_TALK_AT_MOBILES)
.addValidate(Validate.newBuilder()
.setRequired(false)
.build())
.build();
InputParam atUserIdsParam = InputParam
.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_AT_USERIDS, DingTalkParamsConstants.DING_TALK_AT_USERIDS)
.addValidate(Validate.newBuilder()
.setRequired(false)
.build())
.build();
RadioParam isAtAll = RadioParam
.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_AT_ALL, DingTalkParamsConstants.DING_TALK_AT_ALL)
.addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false))
.addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false))
.setValue(STRING_FALSE)
.addValidate(Validate.newBuilder()
.setRequired(false)
.build())
.build();
RadioParam isEnableProxy = RadioParam
.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE, DingTalkParamsConstants.DING_TALK_PROXY_ENABLE)
.addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false))
.addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false))
.setValue(STRING_FALSE)
.addValidate(Validate.newBuilder()
.setRequired(false)
.build())
.build(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java | InputParam proxyParam = InputParam
.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PROXY, DingTalkParamsConstants.DING_TALK_PROXY)
.addValidate(Validate.newBuilder()
.setRequired(false)
.build())
.build();
InputParam portParam = InputParam
.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PORT, DingTalkParamsConstants.DING_TALK_PORT)
.addValidate(Validate.newBuilder()
.setRequired(false)
.build())
.build();
InputParam userParam = InputParam
.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_USER, DingTalkParamsConstants.DING_TALK_USER)
.addValidate(Validate.newBuilder()
.setRequired(false)
.build())
.build();
PasswordParam passwordParam = PasswordParam
.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PASSWORD, DingTalkParamsConstants.DING_TALK_PASSWORD)
.setPlaceholder("if enable use authentication, you need input password")
.build();
return Arrays.asList(webHookParam, keywordParam, secretParam, atMobilesParam, atUserIdsParam, isAtAll, isEnableProxy, proxyParam, portParam, userParam, passwordParam);
}
@Override
public AlertChannel create() {
return new DingTalkAlertChannel();
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkParamsConstants.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.alert.dingtalk;
public final class DingTalkParamsConstants { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkParamsConstants.java | static final String DING_TALK_PROXY_ENABLE = "$t('isEnableProxy')";
static final String NAME_DING_TALK_PROXY_ENABLE = "IsEnableProxy";
static final String DING_TALK_WEB_HOOK = "$t('webhook')";
static final String NAME_DING_TALK_WEB_HOOK = "WebHook";
static final String DING_TALK_KEYWORD = "$t('keyword')";
static final String NAME_DING_TALK_KEYWORD = "Keyword";
static final String DING_TALK_SECRET = "$t('secret')";
static final String NAME_DING_TALK_SECRET = "Secret";
static final String DING_TALK_AT_MOBILES = "$t('atMobiles')";
static final String NAME_DING_TALK_AT_MOBILES = "AtMobiles";
static final String DING_TALK_AT_USERIDS = "$t('atUserIds')";
static final String NAME_DING_TALK_AT_USERIDS = "AtUserIds";
static final String DING_TALK_AT_ALL = "$t('isAtAll')";
static final String NAME_DING_TALK_AT_ALL = "IsAtAll";
static final String DING_TALK_PROXY = "$t('proxy')";
static final String NAME_DING_TALK_PROXY = "Proxy";
static final String DING_TALK_PORT = "$t('port')";
static final String NAME_DING_TALK_PORT = "Port";
static final String DING_TALK_USER = "$t('user')";
static final String NAME_DING_TALK_USER = "User";
static final String DING_TALK_PASSWORD = "$t('password')";
static final String NAME_DING_TALK_PASSWORD = "Password";
private DingTalkParamsConstants() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.alert.dingtalk;
import org.apache.dolphinscheduler.alert.api.AlertResult;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java | import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <p>
* https://open.dingtalk.com/document/robots/custom-robot-access
* https://open.dingtalk.com/document/robots/customize-robot-security-settings
* </p>
*/
public final class DingTalkSender { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java | private static final Logger logger = LoggerFactory.getLogger(DingTalkSender.class);
private final String url;
private final String keyword;
private final String secret;
private final String atMobiles;
private final String atUserIds;
private final Boolean atAll;
private final Boolean enableProxy;
private String proxy;
private Integer port;
private String user;
private String password;
DingTalkSender(Map<String, String> config) {
url = config.get(DingTalkParamsConstants.NAME_DING_TALK_WEB_HOOK);
keyword = config.get(DingTalkParamsConstants.NAME_DING_TALK_KEYWORD);
secret = config.get(DingTalkParamsConstants.NAME_DING_TALK_SECRET);
atMobiles = config.get(DingTalkParamsConstants.NAME_DING_TALK_AT_MOBILES);
atUserIds = config.get(DingTalkParamsConstants.NAME_DING_TALK_AT_USERIDS);
atAll = Boolean.valueOf(config.get(DingTalkParamsConstants.NAME_DING_TALK_AT_ALL));
enableProxy = Boolean.valueOf(config.get(DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE));
if (Boolean.TRUE.equals(enableProxy)) {
port = Integer.parseInt(config.get(DingTalkParamsConstants.NAME_DING_TALK_PORT));
proxy = config.get(DingTalkParamsConstants.NAME_DING_TALK_PROXY);
user = config.get(DingTalkParamsConstants.NAME_DING_TALK_USER);
password = config.get(DingTalkParamsConstants.NAME_DING_TALK_PASSWORD); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java | }
}
private static HttpPost constructHttpPost(String url, String msg) {
HttpPost post = new HttpPost(url);
StringEntity entity = new StringEntity(msg, StandardCharsets.UTF_8);
post.setEntity(entity);
post.addHeader("Content-Type", "application/json; charset=utf-8");
return post;
}
private static CloseableHttpClient getProxyClient(String proxy, int port, String user, String password) {
HttpHost httpProxy = new HttpHost(proxy, port);
CredentialsProvider provider = new BasicCredentialsProvider();
provider.setCredentials(new AuthScope(httpProxy), new UsernamePasswordCredentials(user, password));
return HttpClients.custom().setDefaultCredentialsProvider(provider).build();
}
private static CloseableHttpClient getDefaultClient() {
return HttpClients.createDefault();
}
private static RequestConfig getProxyConfig(String proxy, int port) {
HttpHost httpProxy = new HttpHost(proxy, port);
return RequestConfig.custom().setProxy(httpProxy).build();
}
private String textToJsonString(String text) {
Map<String, Object> items = new HashMap<>();
items.put("msgtype", "text");
Map<String, String> textContent = new HashMap<>();
byte[] byt = StringUtils.getBytesUtf8(text);
String txt = StringUtils.newStringUtf8(byt);
textContent.put("content", txt);
items.put("text", textContent); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java | setMsgAt(items);
return JSONUtils.toJsonString(items);
}
private void setMsgAt(Map<String, Object> items) {
Map<String, Object> at = new HashMap<>();
String[] atMobileArray = org.apache.dolphinscheduler.spi.utils.StringUtils.isNotBlank(atMobiles) ? atMobiles.split(",") : new String[0];
String[] atUserArray = org.apache.dolphinscheduler.spi.utils.StringUtils.isNotBlank(atUserIds) ? atUserIds.split(",") : new String[0];
boolean isAtAll = Objects.isNull(atAll) ? false : atAll;
at.put("atMobiles", atMobileArray);
at.put("atUserIds", atUserArray);
at.put("isAtAll", isAtAll);
items.put("at", at);
}
private AlertResult checkSendDingTalkSendMsgResult(String result) {
AlertResult alertResult = new AlertResult();
alertResult.setStatus("false");
if (null == result) {
alertResult.setMessage("send ding talk msg error");
logger.info("send ding talk msg error,ding talk server resp is null");
return alertResult;
}
DingTalkSendMsgResponse sendMsgResponse = JSONUtils.parseObject(result, DingTalkSendMsgResponse.class);
if (null == sendMsgResponse) {
alertResult.setMessage("send ding talk msg fail");
logger.info("send ding talk msg error,resp error");
return alertResult;
}
if (sendMsgResponse.errcode == 0) {
alertResult.setStatus("true");
alertResult.setMessage("send ding talk msg success"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java | return alertResult;
}
alertResult.setMessage(String.format("alert send ding talk msg error : %s", sendMsgResponse.getErrmsg()));
logger.info("alert send ding talk msg error : {}", sendMsgResponse.getErrmsg());
return alertResult;
}
public AlertResult sendDingTalkMsg(String title, String content) {
AlertResult alertResult;
try {
String resp = sendMsg(title, content);
return checkSendDingTalkSendMsgResult(resp);
} catch (Exception e) {
logger.info("send ding talk alert msg exception : {}", e.getMessage());
alertResult = new AlertResult();
alertResult.setStatus("false");
alertResult.setMessage("send ding talk alert fail.");
}
return alertResult;
}
private String sendMsg(String title, String content) throws IOException {
StringBuilder text = new StringBuilder();
if (org.apache.dolphinscheduler.spi.utils.StringUtils.isNotBlank(keyword)) {
text.append(keyword);
text.append(":");
}
text.append(title);
text.append("\n");
text.append(content);
String msgToJson = textToJsonString(text.toString());
HttpPost httpPost = constructHttpPost(org.apache.dolphinscheduler.spi.utils.StringUtils.isBlank(secret) ? url : generateSignedUrl(), msgToJson); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java | CloseableHttpClient httpClient;
if (Boolean.TRUE.equals(enableProxy)) {
httpClient = getProxyClient(proxy, port, user, password);
RequestConfig rcf = getProxyConfig(proxy, port);
httpPost.setConfig(rcf);
} else {
httpClient = getDefaultClient();
}
try {
CloseableHttpResponse response = httpClient.execute(httpPost);
String resp;
try {
HttpEntity entity = response.getEntity();
resp = EntityUtils.toString(entity, "UTF-8");
EntityUtils.consume(entity);
} finally {
response.close();
}
logger.info("Ding Talk send title :{},content : {}, resp: {}", title, content, resp);
return resp;
} finally {
httpClient.close();
}
}
private String generateSignedUrl() {
Long timestamp = System.currentTimeMillis();
String stringToSign = timestamp + "\n" + secret;
String sign = org.apache.dolphinscheduler.spi.utils.StringUtils.EMPTY;
try {
Mac mac = Mac.getInstance("HmacSHA256"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java | mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA256"));
byte[] signData = mac.doFinal(stringToSign.getBytes("UTF-8"));
sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)),"UTF-8");
} catch (Exception e) {
logger.error("generate sign error, message:{}", e);
}
return url + "×tamp=" + timestamp + "&sign=" + sign;
}
static final class DingTalkSendMsgResponse {
private Integer errcode;
private String errmsg;
public DingTalkSendMsgResponse() {
}
public Integer getErrcode() {
return this.errcode;
}
public void setErrcode(Integer errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return this.errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof DingTalkSendMsgResponse)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java | return false;
}
final DingTalkSendMsgResponse other = (DingTalkSendMsgResponse) o;
final Object this$errcode = this.getErrcode();
final Object other$errcode = other.getErrcode();
if (this$errcode == null ? other$errcode != null : !this$errcode.equals(other$errcode)) {
return false;
}
final Object this$errmsg = this.getErrmsg();
final Object other$errmsg = other.getErrmsg();
if (this$errmsg == null ? other$errmsg != null : !this$errmsg.equals(other$errmsg)) {
return false;
}
return true;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $errcode = this.getErrcode();
result = result * PRIME + ($errcode == null ? 43 : $errcode.hashCode());
final Object $errmsg = this.getErrmsg();
result = result * PRIME + ($errmsg == null ? 43 : $errmsg.hashCode());
return result;
}
public String toString() {
return "DingTalkSender.DingTalkSendMsgResponse(errcode=" + this.getErrcode() + ", errmsg=" + this.getErrmsg() + ")";
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactoryTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.alert.dingtalk;
import org.apache.dolphinscheduler.alert.api.AlertChannel;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
public class DingTalkAlertChannelFactoryTest { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactoryTest.java | @Test
public void testGetParams() {
DingTalkAlertChannelFactory dingTalkAlertChannelFactory = new DingTalkAlertChannelFactory();
List<PluginParams> params = dingTalkAlertChannelFactory.params();
JSONUtils.toJsonString(params);
Assert.assertEquals(11, params.size());
}
@Test
public void testCreate() {
DingTalkAlertChannelFactory dingTalkAlertChannelFactory = new DingTalkAlertChannelFactory();
AlertChannel alertChannel = dingTalkAlertChannelFactory.create();
Assert.assertNotNull(alertChannel);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSenderTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.alert.dingtalk;
import org.apache.dolphinscheduler.alert.api.AlertResult;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class DingTalkSenderTest { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,284 | [Improvement][Alert] Dingtalk alert plugin supports markdown message type | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dingtalk alert plugin supports markdown message type
### Use case
Dingtalk alert plugin supports markdown message type to format alert content for easy viewing of specific content.
### Related issues
_No response_
### Are you willing to submit a 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/8284 | https://github.com/apache/dolphinscheduler/pull/8285 | 78cac085323b1a28d866ed10357c89f2122d06a3 | 36d526d3a803f2ad9203ea54d93a255663bc6eaf | 2022-02-05T12:10:47Z | java | 2022-02-07T14:07:37Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSenderTest.java | private static final Map<String, String> dingTalkConfig = new HashMap<>();
@Before
public void initDingTalkConfig() {
dingTalkConfig.put(DingTalkParamsConstants.NAME_DING_TALK_KEYWORD, "keyWord");
dingTalkConfig.put(DingTalkParamsConstants.NAME_DING_TALK_WEB_HOOK, "url");
dingTalkConfig.put(DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE, "false");
dingTalkConfig.put(DingTalkParamsConstants.NAME_DING_TALK_PASSWORD, "password");
dingTalkConfig.put(DingTalkParamsConstants.NAME_DING_TALK_PORT, "9988");
dingTalkConfig.put(DingTalkParamsConstants.NAME_DING_TALK_USER, "user1,user2");
}
@Test
public void testSend() {
DingTalkSender dingTalkSender = new DingTalkSender(dingTalkConfig);
dingTalkSender.sendDingTalkMsg("keyWord+Welcome", "UTF-8");
dingTalkConfig.put(DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE, "true");
dingTalkSender = new DingTalkSender(dingTalkConfig);
AlertResult alertResult = dingTalkSender.sendDingTalkMsg("title", "content test");
Assert.assertEquals("false", alertResult.getStatus());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,887 | [Bug] [Parameter Context] The preparameter OUT is null | ### 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
在首节点设定两个OUT参数,其中一个给常量,另一个以shell设置参数值传递的方式,传递到下一个节点时,其中常量的参数为null



### What you expected to happen
AbstractParameters中在给OUT参数设置value时,把原有的常量值设置了为null
### How to reproduce




### Anything else
每次都会发生
### Version
2.0.1
### 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/7887 | https://github.com/apache/dolphinscheduler/pull/8315 | b9406d356cd20fdb96d2fe0eeac327c346eaf1c5 | 703d7904159b6e839209d498af47cb4d112ae22a | 2022-01-07T14:33:24Z | java | 2022-02-14T06:25:23Z | dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/AbstractParameters.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.spi.task;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,887 | [Bug] [Parameter Context] The preparameter OUT is null | ### 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
在首节点设定两个OUT参数,其中一个给常量,另一个以shell设置参数值传递的方式,传递到下一个节点时,其中常量的参数为null



### What you expected to happen
AbstractParameters中在给OUT参数设置value时,把原有的常量值设置了为null
### How to reproduce




### Anything else
每次都会发生
### Version
2.0.1
### 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/7887 | https://github.com/apache/dolphinscheduler/pull/8315 | b9406d356cd20fdb96d2fe0eeac327c346eaf1c5 | 703d7904159b6e839209d498af47cb4d112ae22a | 2022-01-07T14:33:24Z | java | 2022-02-14T06:25:23Z | dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/AbstractParameters.java | * job params related class
*/
public abstract class AbstractParameters implements IParameters {
/**
* local parameters
*/
protected List<Property> localParams;
/**
* var pool
*/
public List<Property> varPool;
/**
* get local parameters list
* @return Property list
*/
public List<Property> getLocalParams() {
return localParams;
}
public void setLocalParams(List<Property> localParams) {
this.localParams = localParams;
}
/**
* get local parameters map
* @return parameters map
*/
public Map<String, Property> getLocalParametersMap() {
if (localParams != null) {
Map<String, Property> localParametersMaps = new LinkedHashMap<>();
for (Property property : localParams) {
localParametersMaps.put(property.getProp(),property); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,887 | [Bug] [Parameter Context] The preparameter OUT is null | ### 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
在首节点设定两个OUT参数,其中一个给常量,另一个以shell设置参数值传递的方式,传递到下一个节点时,其中常量的参数为null



### What you expected to happen
AbstractParameters中在给OUT参数设置value时,把原有的常量值设置了为null
### How to reproduce




### Anything else
每次都会发生
### Version
2.0.1
### 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/7887 | https://github.com/apache/dolphinscheduler/pull/8315 | b9406d356cd20fdb96d2fe0eeac327c346eaf1c5 | 703d7904159b6e839209d498af47cb4d112ae22a | 2022-01-07T14:33:24Z | java | 2022-02-14T06:25:23Z | dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/AbstractParameters.java | }
return localParametersMaps;
}
return null;
}
/**
* get varPool map
*
* @return parameters map
*/
public Map<String, Property> getVarPoolMap() {
if (varPool != null) {
Map<String, Property> varPoolMap = new LinkedHashMap<>();
for (Property property : varPool) {
varPoolMap.put(property.getProp(), property);
}
return varPoolMap;
}
return null;
}
public List<Property> getVarPool() {
return varPool;
}
public void setVarPool(String varPool) {
if (StringUtils.isEmpty(varPool)) {
this.varPool = new ArrayList<>();
} else {
this.varPool = JSONUtils.toList(varPool, Property.class);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,887 | [Bug] [Parameter Context] The preparameter OUT is null | ### 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
在首节点设定两个OUT参数,其中一个给常量,另一个以shell设置参数值传递的方式,传递到下一个节点时,其中常量的参数为null



### What you expected to happen
AbstractParameters中在给OUT参数设置value时,把原有的常量值设置了为null
### How to reproduce




### Anything else
每次都会发生
### Version
2.0.1
### 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/7887 | https://github.com/apache/dolphinscheduler/pull/8315 | b9406d356cd20fdb96d2fe0eeac327c346eaf1c5 | 703d7904159b6e839209d498af47cb4d112ae22a | 2022-01-07T14:33:24Z | java | 2022-02-14T06:25:23Z | dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/AbstractParameters.java | public void dealOutParam(String result) {
if (CollectionUtils.isEmpty(localParams)) {
return;
}
List<Property> outProperty = getOutProperty(localParams);
if (CollectionUtils.isEmpty(outProperty)) {
return;
}
if (StringUtils.isEmpty(result)) {
varPool.addAll(outProperty);
return;
}
Map<String, String> taskResult = getMapByString(result);
if (taskResult == null || taskResult.size() == 0) {
return;
}
for (Property info : outProperty) {
info.setValue(taskResult.get(info.getProp()));
varPool.add(info);
}
}
public List<Property> getOutProperty(List<Property> params) {
if (CollectionUtils.isEmpty(params)) {
return new ArrayList<>();
}
List<Property> result = new ArrayList<>();
for (Property info : params) {
if (info.getDirect() == Direct.OUT) {
result.add(info);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,887 | [Bug] [Parameter Context] The preparameter OUT is null | ### 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
在首节点设定两个OUT参数,其中一个给常量,另一个以shell设置参数值传递的方式,传递到下一个节点时,其中常量的参数为null



### What you expected to happen
AbstractParameters中在给OUT参数设置value时,把原有的常量值设置了为null
### How to reproduce




### Anything else
每次都会发生
### Version
2.0.1
### 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/7887 | https://github.com/apache/dolphinscheduler/pull/8315 | b9406d356cd20fdb96d2fe0eeac327c346eaf1c5 | 703d7904159b6e839209d498af47cb4d112ae22a | 2022-01-07T14:33:24Z | java | 2022-02-14T06:25:23Z | dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/AbstractParameters.java | }
return result;
}
public List<Map<String, String>> getListMapByString(String json) {
List<Map<String, String>> allParams = new ArrayList<>();
ArrayNode paramsByJson = JSONUtils.parseArray(json);
for (JsonNode jsonNode : paramsByJson) {
Map<String, String> param = JSONUtils.toMap(jsonNode.toString());
allParams.add(param);
}
return allParams;
}
/**
* shell's result format is key=value$VarPool$key=value$VarPool$
* @param result
* @return
*/
public static Map<String, String> getMapByString(String result) {
String[] formatResult = result.split("\\$VarPool\\$");
Map<String, String> format = new HashMap<>();
for (String info : formatResult) {
if (StringUtils.isNotEmpty(info) && info.contains("=")) {
String[] keyValue = info.split("=");
format.put(keyValue[0], keyValue[1]);
}
}
return format;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service.impl;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.service.TaskDefinitionService;
import org.apache.dolphinscheduler.api.utils.CheckUtils;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.ConditionType;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.TaskType;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils.CodeGenerateException;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
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.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.TaskMainInfo;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.service.permission.PermissionCheck;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
/**
* task definition service impl
*/
@Service
public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDefinitionService {
private static final Logger logger = LoggerFactory.getLogger(TaskDefinitionServiceImpl.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | private static final String RELEASESTATE = "releaseState";
@Autowired
private ProjectMapper projectMapper;
@Autowired
private ProjectService projectService;
@Autowired
private TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private TaskDefinitionLogMapper taskDefinitionLogMapper;
@Autowired
private ProcessTaskRelationMapper processTaskRelationMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
@Autowired
private ProcessService processService;
/**
* create task definition
*
* @param loginUser login user
* @param projectCode project code
* @param taskDefinitionJson task definition json
*/
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Map<String, Object> createTaskDefinition(User loginUser,
long projectCode,
String taskDefinitionJson) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
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;
}
}
int saveTaskResult = processService.saveTaskDefine(loginUser, projectCode, taskDefinitionLogs, Boolean.TRUE);
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
}
Map<String, Object> resData = new HashMap<>();
resData.put("total", taskDefinitionLogs.size());
resData.put("code", StringUtils.join(taskDefinitionLogs.stream().map(TaskDefinition::getCode).collect(Collectors.toList()), ","));
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, resData);
return result;
}
/**
* create single task definition that binds the workflow |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | *
* @param loginUser login user
* @param projectCode project code
* @param processDefinitionCode process definition code
* @param taskDefinitionJsonObj task definition json object
* @param upstreamCodes upstream task codes, sep comma
* @return create result code
*/
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Map<String, Object> createTaskBindsWorkFlow(User loginUser,
long projectCode,
long processDefinitionCode,
String taskDefinitionJsonObj,
String upstreamCodes) {
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(processDefinitionCode);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionCode);
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, processDefinitionCode);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | TaskDefinitionLog taskDefinition = JSONUtils.parseObject(taskDefinitionJsonObj, TaskDefinitionLog.class);
if (taskDefinition == null) {
logger.error("taskDefinitionJsonObj is not valid json");
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJsonObj);
return result;
}
if (!CheckUtils.checkTaskDefinitionParameters(taskDefinition)) {
logger.error("task definition {} parameter invalid", taskDefinition.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinition.getName());
return result;
}
long taskCode = taskDefinition.getCode();
if (taskCode == 0) {
try {
taskCode = CodeGenerateUtils.getInstance().genCode();
taskDefinition.setCode(taskCode);
} catch (CodeGenerateException e) {
logger.error("Task code get error, ", e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, taskDefinitionJsonObj);
return result;
}
}
if (StringUtils.isNotBlank(upstreamCodes)) {
Set<Long> upstreamTaskCodes = Arrays.stream(upstreamCodes.split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet());
List<TaskDefinition> upstreamTaskDefinitionList = taskDefinitionMapper.queryByCodeList(upstreamTaskCodes);
Set<Long> queryUpStreamTaskCodes = upstreamTaskDefinitionList.stream().map(TaskDefinition::getCode).collect(Collectors.toSet());
Set<Long> diffCode = upstreamTaskCodes.stream().filter(code -> !queryUpStreamTaskCodes.contains(code)).collect(Collectors.toSet());
if (!diffCode.isEmpty()) {
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, StringUtils.join(diffCode, Constants.COMMA)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | return result;
}
List<ProcessTaskRelationLog> processTaskRelationLogList = Lists.newArrayList();
for (TaskDefinition upstreamTask : upstreamTaskDefinitionList) {
ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog();
processTaskRelationLog.setPreTaskCode(upstreamTask.getCode());
processTaskRelationLog.setPreTaskVersion(upstreamTask.getVersion());
processTaskRelationLog.setPostTaskCode(taskCode);
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST);
processTaskRelationLog.setConditionType(ConditionType.NONE);
processTaskRelationLog.setConditionParams("{}");
processTaskRelationLogList.add(processTaskRelationLog);
}
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode);
if (!processTaskRelationList.isEmpty()) {
processTaskRelationLogList.addAll(processTaskRelationList.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList()));
}
int insertResult = processService.saveTaskRelation(loginUser, projectCode, processDefinition.getCode(), processDefinition.getVersion(),
processTaskRelationLogList, Lists.newArrayList(), Boolean.TRUE);
if (insertResult != Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.CREATE_PROCESS_TASK_RELATION_ERROR);
throw new ServiceException(Status.CREATE_PROCESS_TASK_RELATION_ERROR);
}
}
int saveTaskResult = processService.saveTaskDefine(loginUser, projectCode, Lists.newArrayList(taskDefinition), Boolean.TRUE);
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
}
putMsg(result, Status.SUCCESS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | result.put(Constants.DATA_LIST, taskDefinition);
return result;
}
/**
* query task definition
*
* @param loginUser login user
* @param projectCode project code
* @param taskName task name
*/
@Override
public Map<String, Object> queryTaskDefinitionByName(User loginUser, long projectCode, String taskName) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByName(project.getCode(), taskName);
if (taskDefinition == null) {
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskName);
} else {
result.put(Constants.DATA_LIST, taskDefinition);
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* delete task definition
* Only offline and no downstream dependency can be deleted |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | * @param loginUser login user
* @param projectCode project code
* @param taskCode task code
*/
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Map<String, Object> deleteTaskDefinitionByCode(User loginUser, long projectCode, long taskCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (taskCode == 0) {
putMsg(result, Status.DELETE_TASK_DEFINE_BY_CODE_ERROR);
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode);
if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) {
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode);
return result;
}
if (processService.isTaskOnline(taskCode) && taskDefinition.getFlag() == Flag.YES) {
putMsg(result, Status.TASK_DEFINE_STATE_ONLINE, taskCode);
return result;
}
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryDownstreamByTaskCode(taskCode);
if (!processTaskRelationList.isEmpty()) {
Set<Long> postTaskCodes = processTaskRelationList
.stream() |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | .map(ProcessTaskRelation::getPostTaskCode)
.collect(Collectors.toSet());
putMsg(result, Status.TASK_HAS_DOWNSTREAM, StringUtils.join(postTaskCodes, ","));
return result;
}
int delete = taskDefinitionMapper.deleteByCode(taskCode);
if (delete > 0) {
List<ProcessTaskRelation> taskRelationList = processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode);
if (!taskRelationList.isEmpty()) {
long processDefinitionCode = taskRelationList.get(0).getProcessDefinitionCode();
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode);
List<ProcessTaskRelation> relationList = processTaskRelations.stream().filter(r -> r.getPostTaskCode() != taskCode).collect(Collectors.toList());
updateDag(loginUser, result, processDefinitionCode, relationList, Lists.newArrayList());
} else {
putMsg(result, Status.SUCCESS);
}
} else {
putMsg(result, Status.DELETE_TASK_DEFINE_BY_CODE_ERROR);
throw new ServiceException(Status.DELETE_TASK_DEFINE_BY_CODE_ERROR);
}
return result;
}
private void updateDag(User loginUser, Map<String, Object> result, long processDefinitionCode, List<ProcessTaskRelation> processTaskRelationList,
List<TaskDefinitionLog> taskDefinitionLogs) {
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode);
if (processDefinition == null) {
throw new ServiceException(Status.PROCESS_DEFINE_NOT_EXIST);
}
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE);
if (insertVersion <= 0) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
List<ProcessTaskRelationLog> relationLogs = processTaskRelationList.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList());
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(),
insertVersion, relationLogs, taskDefinitionLogs, Boolean.TRUE);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
}
/**
* update task definition
*
* @param loginUser login user
* @param projectCode project code
* @param taskCode task code
* @param taskDefinitionJsonObj task definition json object
*/
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Map<String, Object> updateTaskDefinition(User loginUser, long projectCode, long taskCode, String taskDefinitionJsonObj) {
Map<String, Object> result = new HashMap<>();
TaskDefinitionLog taskDefinitionToUpdate = updateTask(loginUser, projectCode, taskCode, taskDefinitionJsonObj, result);
if (taskDefinitionToUpdate == null) {
return result;
}
List<ProcessTaskRelation> taskRelationList = processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | if (!taskRelationList.isEmpty()) {
long processDefinitionCode = taskRelationList.get(0).getProcessDefinitionCode();
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode);
updateDag(loginUser, result, processDefinitionCode, processTaskRelations, Lists.newArrayList(taskDefinitionToUpdate));
}
result.put(Constants.DATA_LIST, taskCode);
putMsg(result, Status.SUCCESS);
return result;
}
private TaskDefinitionLog updateTask(User loginUser, long projectCode, long taskCode, String taskDefinitionJsonObj, Map<String, Object> result) {
Project project = projectMapper.queryByCode(projectCode);
result.putAll(projectService.checkProjectAndAuth(loginUser, project, projectCode));
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return null;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode);
if (taskDefinition == null) {
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode);
return null;
}
if (processService.isTaskOnline(taskCode) && taskDefinition.getFlag() == Flag.YES) {
putMsg(result, Status.NOT_SUPPORT_UPDATE_TASK_DEFINITION);
return null;
}
TaskDefinitionLog taskDefinitionToUpdate = JSONUtils.parseObject(taskDefinitionJsonObj, TaskDefinitionLog.class);
if (taskDefinition.equals(taskDefinitionToUpdate)) {
return null;
}
if (taskDefinitionToUpdate == null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | logger.error("taskDefinitionJson is not valid json");
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJsonObj);
return null;
}
if (!CheckUtils.checkTaskDefinitionParameters(taskDefinitionToUpdate)) {
logger.error("task definition {} parameter invalid", taskDefinitionToUpdate.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionToUpdate.getName());
return null;
}
Integer version = taskDefinitionLogMapper.queryMaxVersionForDefinition(taskCode);
if (version == null || version == 0) {
putMsg(result, Status.DATA_IS_NOT_VALID, taskCode);
return null;
}
Date now = new Date();
taskDefinitionToUpdate.setCode(taskCode);
taskDefinitionToUpdate.setId(taskDefinition.getId());
taskDefinitionToUpdate.setProjectCode(projectCode);
taskDefinitionToUpdate.setUserId(taskDefinition.getUserId());
taskDefinitionToUpdate.setVersion(++version);
taskDefinitionToUpdate.setTaskType(taskDefinitionToUpdate.getTaskType().toUpperCase());
taskDefinitionToUpdate.setResourceIds(processService.getResourceIds(taskDefinitionToUpdate));
taskDefinitionToUpdate.setUpdateTime(now);
int update = taskDefinitionMapper.updateById(taskDefinitionToUpdate);
taskDefinitionToUpdate.setOperator(loginUser.getId());
taskDefinitionToUpdate.setOperateTime(now);
taskDefinitionToUpdate.setCreateTime(now);
int insert = taskDefinitionLogMapper.insert(taskDefinitionToUpdate);
if ((update & insert) != 1) {
putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR);
}
return taskDefinitionToUpdate;
}
/**
* update task definition and upstream
*
* @param loginUser login user
* @param projectCode project code
* @param taskCode task definition code
* @param taskDefinitionJsonObj task definition json object
* @param upstreamCodes upstream task codes, sep comma
* @return update result code
*/
@Override
public Map<String, Object> updateTaskWithUpstream(User loginUser, long projectCode, long taskCode, String taskDefinitionJsonObj, String upstreamCodes) {
Map<String, Object> result = new HashMap<>();
TaskDefinitionLog taskDefinitionToUpdate = updateTask(loginUser, projectCode, taskCode, taskDefinitionJsonObj, result);
if (result.get(Constants.STATUS) != Status.SUCCESS && taskDefinitionToUpdate == null) {
return result;
}
List<ProcessTaskRelation> upstreamTaskRelations = processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode);
Set<Long> upstreamCodeSet = upstreamTaskRelations.stream().map(ProcessTaskRelation::getPreTaskCode).collect(Collectors.toSet());
Set<Long> upstreamTaskCodes = Arrays.stream(upstreamCodes.split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet());
if (CollectionUtils.isEqualCollection(upstreamCodeSet, upstreamTaskCodes) && taskDefinitionToUpdate == null) {
putMsg(result, Status.SUCCESS);
return result;
} else {
if (taskDefinitionToUpdate == null) {
taskDefinitionToUpdate = JSONUtils.parseObject(taskDefinitionJsonObj, TaskDefinitionLog.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | }
}
Map<Long, TaskDefinition> queryUpStreamTaskCodeMap;
if (!upstreamTaskCodes.isEmpty()) {
List<TaskDefinition> upstreamTaskDefinitionList = taskDefinitionMapper.queryByCodeList(upstreamTaskCodes);
queryUpStreamTaskCodeMap = upstreamTaskDefinitionList.stream().collect(Collectors.toMap(TaskDefinition::getCode, taskDefinition -> taskDefinition));
upstreamTaskCodes.removeAll(queryUpStreamTaskCodeMap.keySet());
if (!upstreamTaskCodes.isEmpty()) {
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, StringUtils.join(upstreamTaskCodes, Constants.COMMA));
return result;
}
} else {
queryUpStreamTaskCodeMap = new HashMap<>();
}
if (!upstreamTaskRelations.isEmpty()) {
ProcessTaskRelation taskRelation = upstreamTaskRelations.get(0);
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, taskRelation.getProcessDefinitionCode());
List<ProcessTaskRelation> processTaskRelationList = Lists.newArrayList(processTaskRelations);
List<ProcessTaskRelation> relationList = Lists.newArrayList();
for (ProcessTaskRelation processTaskRelation : processTaskRelationList) {
if (processTaskRelation.getPostTaskCode() == taskCode) {
if (queryUpStreamTaskCodeMap.containsKey(processTaskRelation.getPreTaskCode()) && processTaskRelation.getPreTaskCode() != 0L) {
queryUpStreamTaskCodeMap.remove(processTaskRelation.getPreTaskCode());
} else {
processTaskRelation.setPreTaskCode(0L);
processTaskRelation.setPreTaskVersion(0);
relationList.add(processTaskRelation);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | }
processTaskRelationList.removeAll(relationList);
for (Map.Entry<Long, TaskDefinition> queryUpStreamTask : queryUpStreamTaskCodeMap.entrySet()) {
taskRelation.setPreTaskCode(queryUpStreamTask.getKey());
taskRelation.setPreTaskVersion(queryUpStreamTask.getValue().getVersion());
processTaskRelationList.add(taskRelation);
}
if (queryUpStreamTaskCodeMap.isEmpty() && !processTaskRelationList.isEmpty()) {
processTaskRelationList.add(processTaskRelationList.get(0));
}
updateDag(loginUser, result, taskRelation.getProcessDefinitionCode(), processTaskRelations, Lists.newArrayList(taskDefinitionToUpdate));
}
result.put(Constants.DATA_LIST, taskCode);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* switch task definition
*
* @param loginUser login user
* @param projectCode project code
* @param taskCode task code
* @param version the version user want to switch
*/
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Map<String, Object> switchVersion(User loginUser, long projectCode, long taskCode, int version) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (processService.isTaskOnline(taskCode)) {
putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE);
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode);
if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) {
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode);
return result;
}
TaskDefinitionLog taskDefinitionUpdate = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, version);
taskDefinitionUpdate.setUserId(loginUser.getId());
taskDefinitionUpdate.setUpdateTime(new Date());
taskDefinitionUpdate.setId(taskDefinition.getId());
int switchVersion = taskDefinitionMapper.updateById(taskDefinitionUpdate);
if (switchVersion > 0) {
List<ProcessTaskRelation> taskRelationList = processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode);
if (!taskRelationList.isEmpty()) {
long processDefinitionCode = taskRelationList.get(0).getProcessDefinitionCode();
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode);
updateDag(loginUser, result, processDefinitionCode, processTaskRelations, Lists.newArrayList(taskDefinitionUpdate));
} else {
putMsg(result, Status.SUCCESS);
}
} else {
putMsg(result, Status.SWITCH_TASK_DEFINITION_VERSION_ERROR);
}
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | }
@Override
public Result queryTaskDefinitionVersions(User loginUser,
long projectCode,
long taskCode,
int pageNo,
int 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;
}
PageInfo<TaskDefinitionLog> pageInfo = new PageInfo<>(pageNo, pageSize);
Page<TaskDefinitionLog> page = new Page<>(pageNo, pageSize);
IPage<TaskDefinitionLog> taskDefinitionVersionsPaging = taskDefinitionLogMapper.queryTaskDefinitionVersionsPaging(page, taskCode, projectCode);
List<TaskDefinitionLog> taskDefinitionLogs = taskDefinitionVersionsPaging.getRecords();
pageInfo.setTotalList(taskDefinitionLogs);
pageInfo.setTotal((int) taskDefinitionVersionsPaging.getTotal());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
@Override
public Map<String, Object> deleteByCodeAndVersion(User loginUser, long projectCode, long taskCode, int version) {
Project project = projectMapper.queryByCode(projectCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode);
if (taskDefinition == null) {
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode);
} else {
if (taskDefinition.getVersion() == version) {
putMsg(result, Status.MAIN_TABLE_USING_VERSION);
return result;
}
int delete = taskDefinitionLogMapper.deleteByCodeAndVersion(taskCode, version);
if (delete > 0) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.DELETE_TASK_DEFINITION_VERSION_ERROR);
}
}
return result;
}
@Override
public Map<String, Object> queryTaskDefinitionDetail(User loginUser, long projectCode, long taskCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) {
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode);
} else {
result.put(Constants.DATA_LIST, taskDefinition);
putMsg(result, Status.SUCCESS);
}
return result;
}
@Override
public Result queryTaskDefinitionListPaging(User loginUser,
long projectCode,
String searchWorkflowName,
String searchTaskName,
TaskType taskType,
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<TaskMainInfo> page = new Page<>(pageNo, pageSize);
IPage<TaskMainInfo> taskMainInfoIPage = taskDefinitionMapper.queryDefineListPaging(page, projectCode, searchWorkflowName,
searchTaskName, taskType == null ? StringUtils.EMPTY : taskType.getDesc());
List<TaskMainInfo> records = taskMainInfoIPage.getRecords();
if (!records.isEmpty()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | Map<Long, TaskMainInfo> taskMainInfoMap = new HashMap<>();
for (TaskMainInfo info : records) {
taskMainInfoMap.compute(info.getTaskCode(), (k, v) -> {
if (v == null) {
Map<Long, String> upstreamTaskMap = new HashMap<>();
if (info.getUpstreamTaskCode() != 0) {
upstreamTaskMap.put(info.getUpstreamTaskCode(), info.getUpstreamTaskName());
info.setUpstreamTaskCode(0L);
info.setUpstreamTaskName(StringUtils.EMPTY);
}
info.setUpstreamTaskMap(upstreamTaskMap);
v = info;
}
if (info.getUpstreamTaskCode() != 0) {
v.getUpstreamTaskMap().put(info.getUpstreamTaskCode(), info.getUpstreamTaskName());
}
return v;
});
}
taskMainInfoIPage.setRecords(Lists.newArrayList(taskMainInfoMap.values()));
taskMainInfoIPage.setTotal(taskMainInfoMap.values().size());
}
PageInfo<TaskMainInfo> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) taskMainInfoIPage.getTotal());
pageInfo.setTotalList(taskMainInfoIPage.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | public Map<String, Object> genTaskCodeList(Integer genNum) {
Map<String, Object> result = new HashMap<>();
if (genNum == null || genNum < 1 || genNum > 100) {
logger.error("the genNum must be great than 1 and less than 100");
putMsg(result, Status.DATA_IS_NOT_VALID, genNum);
return result;
}
List<Long> taskCodes = new ArrayList<>();
try {
for (int i = 0; i < genNum; i++) {
taskCodes.add(CodeGenerateUtils.getInstance().genCode());
}
} catch (CodeGenerateException e) {
logger.error("Task code get error, ", e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code");
}
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, taskCodes);
return result;
}
/**
* release task definition
*
* @param loginUser login user
* @param projectCode project code
* @param code task definition code
* @param releaseState releaseState
* @return update result code
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | @Transactional(rollbackFor = RuntimeException.class)
@Override
public Map<String, Object> releaseTaskDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
Status resultStatus = (Status) result.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
return result;
}
if (null == releaseState) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(code);
if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) {
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, code);
return result;
}
TaskDefinitionLog taskDefinitionLog = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(code, taskDefinition.getVersion());
if (taskDefinitionLog == null) {
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, code);
return result;
}
switch (releaseState) {
case OFFLINE:
taskDefinition.setFlag(Flag.NO);
taskDefinitionLog.setFlag(Flag.NO);
break;
case ONLINE: |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,406 | [Bug] [Project] Error in editing task save. | ### 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 edited a task in the Task Definition page, and then saved.

I got this error.

### What you expected to happen
Save successfully.
### How to reproduce
Open the task definition page and pick a record to edit it and save it.
### Anything else
_No response_
### Version
dev
### 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/8406 | https://github.com/apache/dolphinscheduler/pull/8405 | bc5f8b3b3482443dbd5654fc0ac8aafabbd65def | 71fcea593782b7dc5d5ee4133e5bbadbefcf963d | 2022-02-16T13:07:06Z | java | 2022-02-16T15:06:32Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java | String resourceIds = taskDefinition.getResourceIds();
if (StringUtils.isNotBlank(resourceIds)) {
Integer[] resourceIdArray = Arrays.stream(resourceIds.split(",")).map(Integer::parseInt).toArray(Integer[]::new);
PermissionCheck<Integer> permissionCheck = new PermissionCheck(AuthorizationType.RESOURCE_FILE_ID,processService,resourceIdArray,loginUser.getId(),logger);
try {
permissionCheck.checkPermission();
} catch (Exception e) {
logger.error(e.getMessage(),e);
putMsg(result, Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION);
return result;
}
}
taskDefinition.setFlag(Flag.YES);
taskDefinitionLog.setFlag(Flag.YES);
break;
default:
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
int update = taskDefinitionMapper.updateById(taskDefinition);
int updateLog = taskDefinitionLogMapper.updateById(taskDefinitionLog);
if ((update == 0 && updateLog == 1) || (update == 1 && updateLog == 0)) {
putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR);
}
putMsg(result, Status.SUCCESS);
return result;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.api;
import static org.apache.dolphinscheduler.spi.task.TaskConstants.EXIT_CODE_FAILURE;
import static org.apache.dolphinscheduler.spi.task.TaskConstants.EXIT_CODE_KILL;
import org.apache.dolphinscheduler.plugin.task.util.OSUtils;
import org.apache.dolphinscheduler.spi.task.TaskConstants; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | import org.apache.dolphinscheduler.spi.task.TaskExecutionContextCacheManager;
import org.apache.dolphinscheduler.spi.task.request.TaskRequest;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import org.apache.hadoop.hive.common.LogUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
/**
* abstract command executor
*/
public abstract class AbstractCommandExecutor {
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | * rules for extracting application ID
*/
protected static final Pattern APPLICATION_REGEX = Pattern.compile(TaskConstants.APPLICATION_REGEX);
protected StringBuilder varPool = new StringBuilder();
/**
* process
*/
private Process process;
/**
* log handler
*/
protected Consumer<LinkedBlockingQueue<String>> logHandler;
/**
* logger
*/
protected Logger logger;
/**
* log list
*/
protected LinkedBlockingQueue<String> logBuffer;
protected boolean logOutputIsSuccess = false;
/*
* SHELL result string
*/
protected String taskResultString;
/**
* taskRequest
*/
protected TaskRequest taskRequest;
public AbstractCommandExecutor(Consumer<LinkedBlockingQueue<String>> logHandler, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | TaskRequest taskRequest,
Logger logger) {
this.logHandler = logHandler;
this.taskRequest = taskRequest;
this.logger = logger;
this.logBuffer = new LinkedBlockingQueue<>();
}
public AbstractCommandExecutor(LinkedBlockingQueue<String> logBuffer) {
this.logBuffer = logBuffer;
}
/**
* build process
*
* @param commandFile command file
* @throws IOException IO Exception
*/
private void buildProcess(String commandFile) throws IOException {
List<String> command = new LinkedList<>();
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.directory(new File(taskRequest.getExecutePath()));
processBuilder.redirectErrorStream(true);
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | command.addAll(Collections.emptyList());
command.add(commandFile);
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
public TaskResponse run(String execCommand) throws IOException, InterruptedException {
TaskResponse result = new TaskResponse();
int taskInstanceId = taskRequest.getTaskInstanceId();
if (null == TaskExecutionContextCacheManager.getByTaskInstanceId(taskInstanceId)) {
result.setExitStatusCode(EXIT_CODE_KILL);
return result;
}
if (StringUtils.isEmpty(execCommand)) {
TaskExecutionContextCacheManager.removeByTaskInstanceId(taskInstanceId);
return result;
}
String commandFilePath = buildCommandFilePath();
createCommandFileIfNotExists(execCommand, commandFilePath);
buildProcess(commandFilePath);
parseProcessOutput(process);
int processId = getProcessId(process);
result.setProcessId(processId);
taskRequest.setProcessId(processId);
boolean updateTaskExecutionContextStatus = TaskExecutionContextCacheManager.updateTaskExecutionContext(taskRequest); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | if (Boolean.FALSE.equals(updateTaskExecutionContextStatus)) {
ProcessUtils.kill(taskRequest);
result.setExitStatusCode(EXIT_CODE_KILL);
return result;
}
logger.info("process start, process id is: {}", processId);
long remainTime = getRemainTime();
boolean status = process.waitFor(remainTime, TimeUnit.SECONDS);
if (status) {
List<String> appIds = getAppIds(taskRequest.getLogPath());
result.setAppIds(String.join(TaskConstants.COMMA, appIds));
result.setExitStatusCode(process.exitValue());
} else {
logger.error("process has failure , exitStatusCode:{}, processExitValue:{}, ready to kill ...",
result.getExitStatusCode(), process.exitValue());
ProcessUtils.kill(taskRequest);
result.setExitStatusCode(EXIT_CODE_FAILURE);
}
logger.info("process has exited, execute path:{}, processId:{} ,exitStatusCode:{} ,processWaitForStatus:{} ,processExitValue:{}",
taskRequest.getExecutePath(), processId, result.getExitStatusCode(), status, process.exitValue());
return result;
}
public String getVarPool() {
return varPool.toString(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | }
/**
* cancel application
*
* @throws Exception exception
*/
public void cancelApplication() throws Exception {
if (process == null) {
return;
}
clear();
int processId = getProcessId(process);
logger.info("cancel process: {}", processId);
boolean killed = softKill(processId);
if (!killed) {
hardKill(processId);
process.destroy();
process = null;
}
}
/**
* soft kill
*
* @param processId process id
* @return process is alive
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | private boolean softKill(int processId) {
if (processId != 0 && process.isAlive()) {
try {
String cmd = String.format("kill %d", processId);
cmd = OSUtils.getSudoCmd(taskRequest.getTenantCode(), cmd);
logger.info("soft kill task:{}, process id:{}, cmd:{}", taskRequest.getTaskAppId(), processId, cmd);
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
logger.info("kill attempt failed", e);
}
}
return process.isAlive();
}
/**
* hard kill
*
* @param processId process id
*/
private void hardKill(int processId) {
if (processId != 0 && process.isAlive()) {
try {
String cmd = String.format("kill -9 %d", processId);
cmd = OSUtils.getSudoCmd(taskRequest.getTenantCode(), cmd);
logger.info("hard kill task:{}, process id:{}, cmd:{}", taskRequest.getTaskAppId(), processId, cmd);
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
logger.error("kill attempt failed ", e);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | }
private void printCommand(List<String> commands) {
logger.info("task run command: {}", String.join(" ", commands));
}
/**
* clear
*/
private void clear() {
LinkedBlockingQueue<String> markerLog = new LinkedBlockingQueue<>(1);
markerLog.add(ch.qos.logback.classic.ClassicConstants.FINALIZE_SESSION_MARKER.toString());
if (!logBuffer.isEmpty()) {
logHandler.accept(logBuffer);
logBuffer.clear();
}
logHandler.accept(markerLog);
}
/**
* get the standard output of the process
*
* @param process process
*/
private void parseProcessOutput(Process process) {
String threadLoggerInfoName = taskRequest.getTaskLogName();
ExecutorService getOutputLogService = newDaemonSingleThreadExecutor(threadLoggerInfoName);
getOutputLogService.submit(() -> {
try (BufferedReader inReader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
String line;
while ((line = inReader.readLine()) != null) {
if (line.startsWith("${setValue(")) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | varPool.append(line, "${setValue(".length(), line.length() - 2);
varPool.append("$VarPool$");
} else {
logBuffer.add(line);
taskResultString = line;
}
}
logOutputIsSuccess = true;
} catch (Exception e) {
logger.error(e.getMessage(), e);
logOutputIsSuccess = true;
}
});
getOutputLogService.shutdown();
ExecutorService parseProcessOutputExecutorService = newDaemonSingleThreadExecutor(threadLoggerInfoName);
parseProcessOutputExecutorService.submit(() -> {
try {
long lastFlushTime = System.currentTimeMillis();
while (logBuffer.size() > 0 || !logOutputIsSuccess) {
if (logBuffer.size() > 0) {
lastFlushTime = flush(lastFlushTime);
} else {
Thread.sleep(TaskConstants.DEFAULT_LOG_FLUSH_INTERVAL);
}
}
} catch (Exception e) {
Thread.currentThread().interrupt();
logger.error(e.getMessage(), e);
} finally {
clear(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | }
});
parseProcessOutputExecutorService.shutdown();
}
/**
* get app links
*
* @param logPath log path
* @return app id list
*/
private List<String> getAppIds(String logPath) {
List<String> logs = convertFile2List(logPath);
List<String> appIds = new ArrayList<>();
/*
* analysis log?get submited yarn application id
*/
for (String log : logs) {
String appId = findAppId(log);
if (StringUtils.isNotEmpty(appId) && !appIds.contains(appId)) {
logger.info("find app id: {}", appId);
appIds.add(appId);
}
}
return appIds;
}
/**
* convert file to list
*
* @param filename file name
* @return line list |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | */
private List<String> convertFile2List(String filename) {
List<String> lineList = new ArrayList<>(100);
File file = new File(filename);
if (!file.exists()) {
return lineList;
}
try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filename), StandardCharsets.UTF_8))) {
String line;
while ((line = br.readLine()) != null) {
lineList.add(line);
}
} catch (Exception e) {
logger.error(String.format("read file: %s failed : ", filename), e);
}
return lineList;
}
/**
* find app id
*
* @param line line
* @return appid
*/
private String findAppId(String line) {
Matcher matcher = APPLICATION_REGEX.matcher(line);
if (matcher.find()) {
return matcher.group();
}
return null;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | /**
* get remain time(s)
*
* @return remain time
*/
private long getRemainTime() {
long usedTime = (System.currentTimeMillis() - taskRequest.getStartTime().getTime()) / 1000;
long remainTime = taskRequest.getTaskTimeout() - usedTime;
if (remainTime < 0) {
throw new RuntimeException("task execution time out");
}
return remainTime;
}
/**
* get process id
*
* @param process process
* @return process id
*/
private int getProcessId(Process process) {
int processId = 0;
try {
Field f = process.getClass().getDeclaredField(TaskConstants.PID);
f.setAccessible(true);
processId = f.getInt(process);
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
return processId;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java | /**
* when log buffer siz or flush time reach condition , then flush
*
* @param lastFlushTime last flush time
* @return last flush time
*/
private long flush(long lastFlushTime) {
long now = System.currentTimeMillis();
/*
* when log buffer siz or flush time reach condition , then flush
*/
if (logBuffer.size() >= TaskConstants.DEFAULT_LOG_ROWS_NUM || now - lastFlushTime > TaskConstants.DEFAULT_LOG_FLUSH_INTERVAL) {
lastFlushTime = now;
logHandler.accept(logBuffer);
logBuffer.clear();
}
return lastFlushTime;
}
protected abstract String buildCommandFilePath();
protected abstract void createCommandFileIfNotExists(String execCommand, String commandFile) throws IOException;
ExecutorService newDaemonSingleThreadExecutor(String threadName) {
ThreadFactory threadFactory = new ThreadFactoryBuilder()
.setDaemon(true)
.setNameFormat(threadName)
.build();
return Executors.newSingleThreadExecutor(threadFactory);
}
protected abstract String commandInterpreter();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/util/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.plugin.task.util;
import org.apache.dolphinscheduler.plugin.task.api.ShellExecutor;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import java.io.IOException;
import java.util.StringTokenizer;
public class OSUtils { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/util/OSUtils.java | private OSUtils() {
throw new IllegalStateException("Utility class");
}
/**
* get sudo command
*
* @param tenantCode tenantCode
* @param command command
* @return result of sudo execute command
*/
public static String getSudoCmd(String tenantCode, String command) {
return StringUtils.isEmpty(tenantCode) ? command : "sudo -u " + tenantCode + " " + command;
}
/**
* whether is macOS
*
* @return true if mac
*/
public static boolean isMacOS() {
return getOSName().startsWith("Mac");
}
/**
* whether is windows
*
* @return true if windows
*/
public static boolean isWindows() {
return getOSName().startsWith("Windows");
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,366 | sudo.enable=false Is invalid | ### 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
Hello, I don't want to use 「sudo-u」 scheduling tasks
so change 「conf/common.properties」 this configuration:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
but is invalid
shell task still use 「sudu -u」.
log info:
…..
[INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run command: sudo -u hadoop sh /home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
[INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, process id is: 92386
[INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has exited, execute path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15, processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] - -> welcome to use bigdata scheduling system...
hadoop 不在 sudoers 文件中。此事将被报告。
…...
### What you expected to happen
I think it would not use [sudo -u ] scheduling
### How to reproduce
use this config:
```shell
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=false
```
### Anything else
**source code in class:**
Is it fixed to use [sudo-u]
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
```java
private void buildProcess(String commandFile) throws IOException {
// setting up user to run commands
List<String> command = new LinkedList<>();
//init process builder
ProcessBuilder processBuilder = new ProcessBuilder();
// setting up a working directory
processBuilder.directory(new File(taskRequest.getExecutePath()));
// merge error information to standard output stream
processBuilder.redirectErrorStream(true);
// setting up user to run commands
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add(commandInterpreter());
command.addAll(Collections.emptyList());
command.add(commandFile);
// setting commands
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
```
### Version
2.0.2
### 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/8366 | https://github.com/apache/dolphinscheduler/pull/8388 | d9129297abac14aba74e87009477fc3502ac116b | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | 2022-02-14T00:24:11Z | java | 2022-02-17T07:23:21Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/util/OSUtils.java | /**
* 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);
}
public static String getOSName() {
return System.getProperty("os.name");
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service.impl;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.ProcessTaskRelationService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ConditionType;
import org.apache.dolphinscheduler.common.enums.TaskType;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.google.common.collect.Lists;
/**
* process task relation service impl
*/
@Service
public class ProcessTaskRelationServiceImpl extends BaseServiceImpl implements ProcessTaskRelationService { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | @Autowired
private ProjectMapper projectMapper;
@Autowired
private ProjectService projectService;
@Autowired
private ProcessTaskRelationMapper processTaskRelationMapper;
@Autowired
private TaskDefinitionLogMapper taskDefinitionLogMapper;
@Autowired
private TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
@Autowired
private ProcessService processService;
/**
* create process task relation
*
* @param loginUser login user
* @param projectCode project code
* @param processDefinitionCode processDefinitionCode
* @param preTaskCode preTaskCode
* @param postTaskCode postTaskCode
* @return create result code
*/
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Map<String, Object> createProcessTaskRelation(User loginUser, long projectCode, long processDefinitionCode, long preTaskCode, long postTaskCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionCode);
return result;
}
if (processDefinition.getProjectCode() != projectCode) {
putMsg(result, Status.PROJECT_PROCESS_NOT_MATCH);
return result;
}
updateProcessDefiniteVersion(loginUser, result, processDefinition);
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode);
List<ProcessTaskRelation> processTaskRelations = Lists.newArrayList(processTaskRelationList);
if (!processTaskRelations.isEmpty()) {
Map<Long, ProcessTaskRelation> preTaskCodeMap = processTaskRelations.stream().filter(r -> r.getPostTaskCode() == postTaskCode)
.collect(Collectors.toMap(ProcessTaskRelation::getPreTaskCode, processTaskRelation -> processTaskRelation));
if (!preTaskCodeMap.isEmpty()) {
if (preTaskCodeMap.containsKey(preTaskCode) || (!preTaskCodeMap.containsKey(0L) && preTaskCode == 0L)) {
putMsg(result, Status.PROCESS_TASK_RELATION_EXIST, processDefinitionCode);
return result;
}
if (preTaskCodeMap.containsKey(0L) && preTaskCode != 0L) {
processTaskRelations.remove(preTaskCodeMap.get(0L));
}
}
}
TaskDefinition postTaskDefinition = taskDefinitionMapper.queryByCode(postTaskCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | ProcessTaskRelation processTaskRelation = setRelation(processDefinition, postTaskDefinition);
if (preTaskCode != 0L) {
TaskDefinition preTaskDefinition = taskDefinitionMapper.queryByCode(preTaskCode);
List<ProcessTaskRelation> upstreamTaskRelationList = processTaskRelations.stream().filter(r -> r.getPostTaskCode() == preTaskCode).collect(Collectors.toList());
if (upstreamTaskRelationList.isEmpty()) {
ProcessTaskRelation preProcessTaskRelation = setRelation(processDefinition, preTaskDefinition);
preProcessTaskRelation.setPreTaskCode(0L);
preProcessTaskRelation.setPreTaskVersion(0);
processTaskRelations.add(preProcessTaskRelation);
}
processTaskRelation.setPreTaskCode(preTaskDefinition.getCode());
processTaskRelation.setPreTaskVersion(preTaskDefinition.getVersion());
} else {
processTaskRelation.setPreTaskCode(0L);
processTaskRelation.setPreTaskVersion(0);
}
processTaskRelations.add(processTaskRelation);
updateRelation(loginUser, result, processDefinition, processTaskRelations);
return result;
}
private ProcessTaskRelation setRelation(ProcessDefinition processDefinition, TaskDefinition taskDefinition) {
Date now = new Date();
ProcessTaskRelation processTaskRelation = new ProcessTaskRelation();
processTaskRelation.setProjectCode(processDefinition.getProjectCode());
processTaskRelation.setProcessDefinitionCode(processDefinition.getCode());
processTaskRelation.setProcessDefinitionVersion(processDefinition.getVersion());
processTaskRelation.setPostTaskCode(taskDefinition.getCode());
processTaskRelation.setPostTaskVersion(taskDefinition.getVersion());
processTaskRelation.setConditionType(ConditionType.NONE); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | processTaskRelation.setConditionParams("{}");
processTaskRelation.setCreateTime(now);
processTaskRelation.setUpdateTime(now);
return processTaskRelation;
}
private void updateProcessDefiniteVersion(User loginUser, Map<String, Object> result, ProcessDefinition processDefinition) {
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);
}
processDefinition.setVersion(insertVersion);
}
/**
* delete process task relation
*
* @param loginUser login user
* @param projectCode project code
* @param processDefinitionCode process definition code
* @param taskCode the post task code
* @return delete result code
*/
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Map<String, Object> deleteTaskProcessRelation(User loginUser, long projectCode, long processDefinitionCode, long taskCode) {
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,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | }
if (taskCode == 0) {
putMsg(result, Status.DELETE_TASK_PROCESS_RELATION_ERROR);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionCode);
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode);
if (null == taskDefinition) {
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode);
return result;
}
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode);
List<ProcessTaskRelation> processTaskRelationList = Lists.newArrayList(processTaskRelations);
if (CollectionUtils.isEmpty(processTaskRelationList)) {
putMsg(result, Status.DATA_IS_NULL, "processTaskRelationList");
return result;
}
List<Long> downstreamList = Lists.newArrayList();
for (ProcessTaskRelation processTaskRelation : processTaskRelationList) {
if (processTaskRelation.getPreTaskCode() == taskCode) {
downstreamList.add(processTaskRelation.getPostTaskCode());
}
if (processTaskRelation.getPostTaskCode() == taskCode) {
processTaskRelationList.remove(processTaskRelation);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | if (CollectionUtils.isNotEmpty(downstreamList)) {
putMsg(result, Status.TASK_HAS_DOWNSTREAM, org.apache.commons.lang.StringUtils.join(downstreamList, ","));
return result;
}
updateProcessDefiniteVersion(loginUser, result, processDefinition);
updateRelation(loginUser, result, processDefinition, processTaskRelationList);
if (TaskType.CONDITIONS.getDesc().equals(taskDefinition.getTaskType())
|| TaskType.DEPENDENT.getDesc().equals(taskDefinition.getTaskType())
|| TaskType.SUB_PROCESS.getDesc().equals(taskDefinition.getTaskType())) {
int deleteTaskDefinition = taskDefinitionMapper.deleteByCode(taskCode);
if (0 == deleteTaskDefinition) {
putMsg(result, Status.DELETE_TASK_DEFINE_BY_CODE_ERROR);
throw new ServiceException(Status.DELETE_TASK_DEFINE_BY_CODE_ERROR);
}
}
putMsg(result, Status.SUCCESS);
return result;
}
private void updateRelation(User loginUser, Map<String, Object> result, ProcessDefinition processDefinition,
List<ProcessTaskRelation> processTaskRelationList) {
List<ProcessTaskRelationLog> relationLogs = processTaskRelationList.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList());
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(),
processDefinition.getVersion(), relationLogs, Lists.newArrayList(), Boolean.TRUE);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | }
/**
* delete task upstream relation
*
* @param loginUser login user
* @param projectCode project code
* @param preTaskCodes the pre task codes, sep ','
* @param taskCode the post task code
* @return delete result code
*/
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Map<String, Object> deleteUpstreamRelation(User loginUser, long projectCode, String preTaskCodes, long taskCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (StringUtils.isEmpty(preTaskCodes)) {
putMsg(result, Status.DATA_IS_NULL, "preTaskCodes");
return result;
}
List<ProcessTaskRelation> upstreamList = processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode);
if (CollectionUtils.isEmpty(upstreamList)) {
putMsg(result, Status.DATA_IS_NULL, "taskCode");
return result;
}
List<Long> preTaskCodeList = Lists.newArrayList(preTaskCodes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toList());
if (preTaskCodeList.contains(0L)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | putMsg(result, Status.DATA_IS_NULL, "preTaskCodes");
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(upstreamList.get(0).getProcessDefinitionCode());
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, upstreamList.get(0).getProcessDefinitionCode());
return result;
}
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinition.getCode());
List<ProcessTaskRelation> processTaskRelationList = Lists.newArrayList(processTaskRelations);
List<ProcessTaskRelation> processTaskRelationWaitRemove = Lists.newArrayList();
for (ProcessTaskRelation processTaskRelation : processTaskRelationList) {
if (preTaskCodeList.size() > 1) {
if (preTaskCodeList.contains(processTaskRelation.getPreTaskCode())) {
preTaskCodeList.remove(processTaskRelation.getPreTaskCode());
processTaskRelationWaitRemove.add(processTaskRelation);
}
} else {
if (processTaskRelation.getPostTaskCode() == taskCode) {
processTaskRelation.setPreTaskVersion(0);
processTaskRelation.setPreTaskCode(0L);
}
}
if (preTaskCodeList.contains(processTaskRelation.getPostTaskCode())) {
processTaskRelationWaitRemove.add(processTaskRelation);
}
}
processTaskRelationList.removeAll(processTaskRelationWaitRemove);
updateProcessDefiniteVersion(loginUser, result, processDefinition);
updateRelation(loginUser, result, processDefinition, processTaskRelationList); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | return result;
}
/**
* delete task downstream relation
*
* @param loginUser login user
* @param projectCode project code
* @param postTaskCodes the post task codes, sep ','
* @param taskCode the pre task code
* @return delete result code
*/
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Map<String, Object> deleteDownstreamRelation(User loginUser, long projectCode, String postTaskCodes, long taskCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (StringUtils.isEmpty(postTaskCodes)) {
putMsg(result, Status.DATA_IS_NULL, "postTaskCodes");
return result;
}
List<ProcessTaskRelation> downstreamList = processTaskRelationMapper.queryDownstreamByCode(projectCode, taskCode);
if (CollectionUtils.isEmpty(downstreamList)) {
putMsg(result, Status.DATA_IS_NULL, "taskCode");
return result;
}
List<Long> postTaskCodeList = Lists.newArrayList(postTaskCodes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toList()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | if (postTaskCodeList.contains(0L)) {
putMsg(result, Status.DATA_IS_NULL, "postTaskCodes");
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(downstreamList.get(0).getProcessDefinitionCode());
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, downstreamList.get(0).getProcessDefinitionCode());
return result;
}
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinition.getCode());
List<ProcessTaskRelation> processTaskRelationList = Lists.newArrayList(processTaskRelations);
processTaskRelationList.removeIf(processTaskRelation -> postTaskCodeList.contains(processTaskRelation.getPostTaskCode()) && processTaskRelation.getPreTaskCode() == taskCode);
updateProcessDefiniteVersion(loginUser, result, processDefinition);
updateRelation(loginUser, result, processDefinition, processTaskRelationList);
return result;
}
/**
* query task upstream relation
*
* @param loginUser login user
* @param projectCode project code
* @param taskCode current task code (post task code)
* @return the upstream task definitions
*/
@Override
public Map<String, Object> queryUpstreamRelation(User loginUser, long projectCode, long taskCode) {
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,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | return result;
}
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode);
List<TaskDefinitionLog> taskDefinitionLogList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(processTaskRelationList)) {
Set<TaskDefinition> taskDefinitions = processTaskRelationList
.stream()
.map(processTaskRelation -> {
TaskDefinition taskDefinition = buildTaskDefinition();
taskDefinition.setProjectCode(processTaskRelation.getProjectCode());
taskDefinition.setCode(processTaskRelation.getPreTaskCode());
taskDefinition.setVersion(processTaskRelation.getPreTaskVersion());
return taskDefinition;
})
.collect(Collectors.toSet());
taskDefinitionLogList = taskDefinitionLogMapper.queryByTaskDefinitions(taskDefinitions);
}
result.put(Constants.DATA_LIST, taskDefinitionLogList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query task downstream relation
*
* @param loginUser login user
* @param projectCode project code
* @param taskCode pre task code
* @return the downstream task definitions
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | public Map<String, Object> queryDownstreamRelation(User loginUser, long projectCode, long taskCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryDownstreamByCode(projectCode, taskCode);
List<TaskDefinitionLog> taskDefinitionLogList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(processTaskRelationList)) {
Set<TaskDefinition> taskDefinitions = processTaskRelationList
.stream()
.map(processTaskRelation -> {
TaskDefinition taskDefinition = buildTaskDefinition();
taskDefinition.setProjectCode(processTaskRelation.getProjectCode());
taskDefinition.setCode(processTaskRelation.getPostTaskCode());
taskDefinition.setVersion(processTaskRelation.getPostTaskVersion());
return taskDefinition;
})
.collect(Collectors.toSet());
taskDefinitionLogList = taskDefinitionLogMapper.queryByTaskDefinitions(taskDefinitions);
}
result.put(Constants.DATA_LIST, taskDefinitionLogList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete edge
*
* @param loginUser login user |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | * @param projectCode project code
* @param processDefinitionCode process definition code
* @param preTaskCode pre task code
* @param postTaskCode post task code
* @return delete result code
*/
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Map<String, Object> deleteEdge(User loginUser, long projectCode, long processDefinitionCode, long preTaskCode, long postTaskCode) {
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(processDefinitionCode);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionCode);
return result;
}
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode);
List<ProcessTaskRelation> processTaskRelationList = Lists.newArrayList(processTaskRelations);
if (CollectionUtils.isEmpty(processTaskRelationList)) {
putMsg(result, Status.DATA_IS_NULL, "processTaskRelationList");
return result;
}
Map<Long, List<ProcessTaskRelation>> taskRelationMap = new HashMap<>();
for (ProcessTaskRelation processTaskRelation : processTaskRelationList) {
taskRelationMap.compute(processTaskRelation.getPostTaskCode(), (k, v) -> {
if (v == null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | v = new ArrayList<>();
}
v.add(processTaskRelation);
return v;
});
}
if (!taskRelationMap.containsKey(postTaskCode)) {
putMsg(result, Status.DATA_IS_NULL, "postTaskCode");
return result;
}
if (taskRelationMap.get(postTaskCode).size() > 1) {
for (ProcessTaskRelation processTaskRelation : taskRelationMap.get(postTaskCode)) {
if (processTaskRelation.getPreTaskCode() == preTaskCode) {
int delete = processTaskRelationMapper.deleteById(processTaskRelation.getId());
if (delete == 0) {
putMsg(result, Status.DELETE_EDGE_ERROR);
throw new ServiceException(Status.DELETE_EDGE_ERROR);
}
processTaskRelationList.remove(processTaskRelation);
}
}
} else {
ProcessTaskRelation processTaskRelation = taskRelationMap.get(postTaskCode).get(0);
processTaskRelationList.remove(processTaskRelation);
processTaskRelation.setPreTaskVersion(0);
processTaskRelation.setPreTaskCode(0L);
processTaskRelationList.add(processTaskRelation);
}
updateProcessDefiniteVersion(loginUser, result, processDefinition);
updateRelation(loginUser, result, processDefinition, processTaskRelationList); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,378 | [Bug] [API] DeleteTaskRelation api report ConcurrentModificationException | ### 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
<img width="1434" alt="lQLPDhsmXnHJphTNATDNCzSwRBcst_MOkoUCD4luqgD0AA_2868_304" src="https://user-images.githubusercontent.com/42576980/153859728-0abf23be-33f5-4274-aa85-2d14f785378e.png">
### What you expected to happen
It can operate normally
### How to reproduce
Unbinding task and processDefinition
### 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/8378 | https://github.com/apache/dolphinscheduler/pull/8379 | 806333a11c03e5757d0c8dc56b5d1ca62fbacd1d | f9c090e048250a6ec57719be9bc0f385d5b97f97 | 2022-02-14T11:58:33Z | java | 2022-02-17T07:38:13Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java | return result;
}
/**
* build task definition
*
* @return task definition
*/
private TaskDefinition buildTaskDefinition() {
return new TaskDefinition() {
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof TaskDefinition)) {
return false;
}
TaskDefinition that = (TaskDefinition) o;
return getCode() == that.getCode()
&& getVersion() == that.getVersion()
&& getProjectCode() == that.getProjectCode();
}
@Override
public int hashCode() {
return Objects.hash(getCode(), getVersion(), getProjectCode());
}
};
}
} |
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 | /*
* 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,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 | 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,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 | 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,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 | /**
* 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,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 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,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 | 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,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 run() {
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);
}
}
}
}
}
/**
* worker group node listener
*/
class WorkerDataListener 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();
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) { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.