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
| 12,078 |
[Bug] [dolphinscheduler-api][3.1.0] workflow import 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
<img width="1130" alt="image" src="https://user-images.githubusercontent.com/31528124/191407912-63cf53a0-76c4-4b0c-8380-b6018c746bec.png">
### What you expected to happen
empty
### How to reproduce
1. create a shell workflow
2. export the workflow
3. import the workflow to another project
### Anything else
_No response_
### Version
branch:3.1.0-prepare
### 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/12078
|
https://github.com/apache/dolphinscheduler/pull/12096
|
cc492c3e13fa8de96706d4360ee6f8d628639200
|
6e03a7e5576de795ae1cb66a7ba0fdb40979c95b
| 2022-09-21T03:31:22Z |
java
| 2022-09-22T04:12:43Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
schedulerService.setScheduleState(loginUser, projectCode, scheduleObj.getId(), ReleaseState.ONLINE);
break;
case OFFLINE:
processDefinition.setReleaseState(releaseState);
int updateProcess = processDefinitionMapper.updateById(processDefinition);
if (updateProcess > 0) {
logger.info("Set schedule offline, projectCode:{}, processDefinitionCode:{}, scheduleId:{}.",
projectCode, code, scheduleObj.getId());
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
int updateSchedule = scheduleMapper.updateById(scheduleObj);
if (updateSchedule == 0) {
logger.error(
"Set schedule offline error, projectCode:{}, processDefinitionCode:{}, scheduleId:{}",
projectCode, code, scheduleObj.getId());
putMsg(result, Status.OFFLINE_SCHEDULE_ERROR);
throw new ServiceException(Status.OFFLINE_SCHEDULE_ERROR);
}
schedulerService.deleteSchedule(project.getId(), scheduleObj.getId());
}
break;
default:
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* save other relation
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,078 |
[Bug] [dolphinscheduler-api][3.1.0] workflow import 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
<img width="1130" alt="image" src="https://user-images.githubusercontent.com/31528124/191407912-63cf53a0-76c4-4b0c-8380-b6018c746bec.png">
### What you expected to happen
empty
### How to reproduce
1. create a shell workflow
2. export the workflow
3. import the workflow to another project
### Anything else
_No response_
### Version
branch:3.1.0-prepare
### 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/12078
|
https://github.com/apache/dolphinscheduler/pull/12096
|
cc492c3e13fa8de96706d4360ee6f8d628639200
|
6e03a7e5576de795ae1cb66a7ba0fdb40979c95b
| 2022-09-21T03:31:22Z |
java
| 2022-09-22T04:12:43Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @param loginUser
* @param processDefinition
* @param result
* @param otherParamsJson
*/
@Override
public void saveOtherRelation(User loginUser, ProcessDefinition processDefinition, Map<String, Object> result,
String otherParamsJson) {
}
/**
* get Json String
* @param loginUser
* @param processDefinition
* @return Json String
*/
@Override
public String doOtherOperateProcess(User loginUser, ProcessDefinition processDefinition) {
return null;
}
/**
* delete other relation
* @param project
* @param result
* @param processDefinition
*/
@Override
public void deleteOtherRelation(Project project, Map<String, Object> result, ProcessDefinition processDefinition) {
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,111 |
[Bug] [Pytorch Task Plugin] Python home conflict when create conda env
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
If we set PYTHON_HOME, and then Pytorch task plugin create conda env can not set python home correctly
### What you expected to happen
empty
### How to reproduce
empty
### Anything else
empty
### 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/12111
|
https://github.com/apache/dolphinscheduler/pull/12112
|
e11e129cdaa05b3324f06072ea419a42b6d1cd18
|
6eb1eb722af06b94027994b2ef8955e84fd97d7f
| 2022-09-22T11:07:59Z |
java
| 2022-09-23T01:40:18Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-pytorch/src/main/java/org/apache/dolphinscheduler/plugin/task/pytorch/PythonEnvManager.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.pytorch;
import lombok.Data;
@Data
public class PythonEnvManager {
public static final String ENV_TOOL_VENV = "virtualenv";
public static final String ENV_TOOL_CONDA = "conda";
private static final String PATTERN_ENVIRONMENT_PYTHON = "python[\\d\\.]*$";
private static final String PATTERN_ENVIRONMENT_REQUIREMENT = "\\.txt$";
private static final String CREATE_ENV_NAME = "./venv";
private static final String CONDA_SOURCE = "source activate %s";
private static final String CONDA_BUILD = "conda create -y python=%s -p %s";
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,111 |
[Bug] [Pytorch Task Plugin] Python home conflict when create conda env
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
If we set PYTHON_HOME, and then Pytorch task plugin create conda env can not set python home correctly
### What you expected to happen
empty
### How to reproduce
empty
### Anything else
empty
### 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/12111
|
https://github.com/apache/dolphinscheduler/pull/12112
|
e11e129cdaa05b3324f06072ea419a42b6d1cd18
|
6eb1eb722af06b94027994b2ef8955e84fd97d7f
| 2022-09-22T11:07:59Z |
java
| 2022-09-23T01:40:18Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-pytorch/src/main/java/org/apache/dolphinscheduler/plugin/task/pytorch/PythonEnvManager.java
|
private static final String VIRTUALENV_SOURCE = "source %s/bin/activate";
private static final String VIRTUALENV_BUILD = "virtualenv -p ${PYTHON_HOME} %s";
private static final String INSTALL_COMMAND = "python -m pip install -r %s";
private String pythonEnvTool = ENV_TOOL_VENV;
private String condaPythonVersion = "3.9";
public String getBuildEnvCommand(String requirementPath) {
String buildCommand = "";
String sourceCommand = getSourceEnvCommand(CREATE_ENV_NAME);
if (pythonEnvTool.equals(ENV_TOOL_VENV)) {
buildCommand = String.format(VIRTUALENV_BUILD, CREATE_ENV_NAME);
} else if (pythonEnvTool.equals(ENV_TOOL_CONDA)) {
buildCommand = String.format(CONDA_BUILD, condaPythonVersion, CREATE_ENV_NAME);
}
String installCommand = String.format(INSTALL_COMMAND, requirementPath);
return buildCommand + " && " + sourceCommand + " && " + installCommand;
}
private String getSourceEnvCommand(String envName) {
String command = "";
if (pythonEnvTool.equals(ENV_TOOL_VENV)) {
command = String.format(VIRTUALENV_SOURCE, envName);
} else if (pythonEnvTool.equals(ENV_TOOL_CONDA)) {
command = String.format(CONDA_SOURCE, envName);
}
return command;
}
public String getPythonCommand() {
return String.format("%s/bin/python", CREATE_ENV_NAME);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,111 |
[Bug] [Pytorch Task Plugin] Python home conflict when create conda env
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
If we set PYTHON_HOME, and then Pytorch task plugin create conda env can not set python home correctly
### What you expected to happen
empty
### How to reproduce
empty
### Anything else
empty
### 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/12111
|
https://github.com/apache/dolphinscheduler/pull/12112
|
e11e129cdaa05b3324f06072ea419a42b6d1cd18
|
6eb1eb722af06b94027994b2ef8955e84fd97d7f
| 2022-09-22T11:07:59Z |
java
| 2022-09-23T01:40:18Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-pytorch/src/test/java/org/apache/dolphinscheduler/plugin/task/pytorch/PytorchTaskTest.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.pytorch;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.RWXR_XR_X;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContextCacheManager;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.dolphinscheduler.spi.utils.PropertyUtils;
import org.apache.commons.lang3.SystemUtils;
import java.io.File;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,111 |
[Bug] [Pytorch Task Plugin] Python home conflict when create conda env
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
If we set PYTHON_HOME, and then Pytorch task plugin create conda env can not set python home correctly
### What you expected to happen
empty
### How to reproduce
empty
### Anything else
empty
### 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/12111
|
https://github.com/apache/dolphinscheduler/pull/12112
|
e11e129cdaa05b3324f06072ea419a42b6d1cd18
|
6eb1eb722af06b94027994b2ef8955e84fd97d7f
| 2022-09-22T11:07:59Z |
java
| 2022-09-23T01:40:18Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-pytorch/src/test/java/org/apache/dolphinscheduler/plugin/task/pytorch/PytorchTaskTest.java
|
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.FileAttribute;
import java.nio.file.attribute.PosixFilePermission;
import java.nio.file.attribute.PosixFilePermissions;
import java.util.Date;
import java.util.Set;
import java.util.UUID;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@PrepareForTest({JSONUtils.class, PropertyUtils.class,})
@PowerMockIgnore({"javax.*"})
@SuppressStaticInitializationFor("org.apache.dolphinscheduler.spi.utils.PropertyUtils")
public class PytorchTaskTest {
private final String pythonPath = ".";
private final String requirementPath = "requirements.txt";
@Before
public void before() {
PowerMockito.mockStatic(PropertyUtils.class);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,111 |
[Bug] [Pytorch Task Plugin] Python home conflict when create conda env
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
If we set PYTHON_HOME, and then Pytorch task plugin create conda env can not set python home correctly
### What you expected to happen
empty
### How to reproduce
empty
### Anything else
empty
### 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/12111
|
https://github.com/apache/dolphinscheduler/pull/12112
|
e11e129cdaa05b3324f06072ea419a42b6d1cd18
|
6eb1eb722af06b94027994b2ef8955e84fd97d7f
| 2022-09-22T11:07:59Z |
java
| 2022-09-23T01:40:18Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-pytorch/src/test/java/org/apache/dolphinscheduler/plugin/task/pytorch/PytorchTaskTest.java
|
}
@Test
public void testPythonEnvManager() {
PythonEnvManager envManager = new PythonEnvManager();
envManager.setPythonEnvTool(PythonEnvManager.ENV_TOOL_CONDA);
envManager.setCondaPythonVersion("3.9");
String condaEnvCommand39 = envManager.getBuildEnvCommand(requirementPath);
Assert.assertEquals(condaEnvCommand39, "conda create -y python=3.9 -p ./venv && source activate ./venv && python -m pip install -r " + requirementPath);
envManager.setCondaPythonVersion("3.8");
String condaEnvCommand38 = envManager.getBuildEnvCommand(requirementPath);
Assert.assertEquals(condaEnvCommand38, "conda create -y python=3.8 -p ./venv && source activate ./venv && python -m pip install -r " + requirementPath);
envManager.setPythonEnvTool(PythonEnvManager.ENV_TOOL_VENV);
String venvEnvCommand = envManager.getBuildEnvCommand(requirementPath);
Assert.assertEquals(venvEnvCommand, "virtualenv -p ${PYTHON_HOME} ./venv && source ./venv/bin/activate && python -m pip install -r " + requirementPath);
}
@Test
public void testGitProject() {
assertFalse(GitProjectManager.isGitPath("dolphinscheduler/test"));
assertFalse(GitProjectManager.isGitPath("/dolphinscheduler/test"));
assertTrue(GitProjectManager.isGitPath("https://github.com/apache/dolphinscheduler.git"));
assertTrue(GitProjectManager.isGitPath("[email protected]:apache/dolphinscheduler.git"));
assertTrue(GitProjectManager.isGitPath("[email protected]:apache/dolphinscheduler.git#doc"));
GitProjectManager gpm1 = new GitProjectManager();
gpm1.setPath("[email protected]:apache/dolphinscheduler.git#doc");
Assert.assertEquals("[email protected]:apache/dolphinscheduler.git", gpm1.getGitUrl());
Assert.assertEquals("./GIT_PROJECT/doc", gpm1.getGitLocalPath());
GitProjectManager gpm2 = new GitProjectManager();
gpm2.setPath("[email protected]:apache/dolphinscheduler.git");
Assert.assertEquals("[email protected]:apache/dolphinscheduler.git", gpm2.getGitUrl());
Assert.assertEquals("./GIT_PROJECT", gpm2.getGitLocalPath());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,111 |
[Bug] [Pytorch Task Plugin] Python home conflict when create conda env
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
If we set PYTHON_HOME, and then Pytorch task plugin create conda env can not set python home correctly
### What you expected to happen
empty
### How to reproduce
empty
### Anything else
empty
### 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/12111
|
https://github.com/apache/dolphinscheduler/pull/12112
|
e11e129cdaa05b3324f06072ea419a42b6d1cd18
|
6eb1eb722af06b94027994b2ef8955e84fd97d7f
| 2022-09-22T11:07:59Z |
java
| 2022-09-23T01:40:18Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-pytorch/src/test/java/org/apache/dolphinscheduler/plugin/task/pytorch/PytorchTaskTest.java
|
}
@Test
public void testBuildPythonCommandWithoutCreateEnvironment() throws Exception {
PytorchParameters parameters = new PytorchParameters();
parameters.setScript("main.py");
parameters.setScriptParams("--epochs=1 --dry-run");
PytorchTask task1 = initTask(parameters);
Assert.assertEquals(task1.buildPythonExecuteCommand(),
"export PYTHONPATH=.\n" +
"${PYTHON_HOME} main.py --epochs=1 --dry-run");
parameters.setPythonCommand("");
PytorchTask task2 = initTask(parameters);
Assert.assertEquals(task2.buildPythonExecuteCommand(),
"export PYTHONPATH=.\n" +
"${PYTHON_HOME} main.py --epochs=1 --dry-run");
parameters.setPythonCommand("/usr/bin/python");
PytorchTask task3 = initTask(parameters);
Assert.assertEquals(task3.buildPythonExecuteCommand(),
"export PYTHONPATH=.\n" +
"/usr/bin/python main.py --epochs=1 --dry-run");
}
@Test
public void testBuildPythonCommandWithCreateCondeEnv() throws Exception {
PytorchParameters parameters = new PytorchParameters();
parameters.setPythonPath(pythonPath);
parameters.setIsCreateEnvironment(true);
parameters.setCondaPythonVersion("3.6");
parameters.setPythonEnvTool(PythonEnvManager.ENV_TOOL_CONDA);
parameters.setRequirements("requirements.txt");
parameters.setScript("main.py");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,111 |
[Bug] [Pytorch Task Plugin] Python home conflict when create conda env
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
If we set PYTHON_HOME, and then Pytorch task plugin create conda env can not set python home correctly
### What you expected to happen
empty
### How to reproduce
empty
### Anything else
empty
### 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/12111
|
https://github.com/apache/dolphinscheduler/pull/12112
|
e11e129cdaa05b3324f06072ea419a42b6d1cd18
|
6eb1eb722af06b94027994b2ef8955e84fd97d7f
| 2022-09-22T11:07:59Z |
java
| 2022-09-23T01:40:18Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-pytorch/src/test/java/org/apache/dolphinscheduler/plugin/task/pytorch/PytorchTaskTest.java
|
parameters.setScriptParams("--epochs=1 --dry-run");
PytorchTask task = initTask(parameters);
Assert.assertEquals(task.buildPythonExecuteCommand(),
"export PYTHONPATH=.\n" +
"conda create -y python=3.6 -p ./venv && source activate ./venv && python -m pip install -r requirements.txt\n" +
"./venv/bin/python main.py --epochs=1 --dry-run");
}
@Test
public void testBuildPythonCommandWithCreateVenvEnv() throws Exception {
PytorchParameters parameters = new PytorchParameters();
parameters.setPythonPath(pythonPath);
parameters.setIsCreateEnvironment(true);
parameters.setPythonEnvTool(PythonEnvManager.ENV_TOOL_VENV);
parameters.setRequirements("requirements.txt");
parameters.setScript("main.py");
parameters.setScriptParams("--epochs=1 --dry-run");
PytorchTask task = initTask(parameters);
Assert.assertEquals(task.buildPythonExecuteCommand(),
"export PYTHONPATH=.\n" +
"virtualenv -p ${PYTHON_HOME} ./venv && source ./venv/bin/activate && python -m pip install -r requirements.txt\n" +
"./venv/bin/python main.py --epochs=1 --dry-run");
}
@Test
public void testGetPossiblePath() throws Exception {
String requirements = "requirements.txt";
String script = "train.py";
String pythonPath = Paths.get("/tmp", UUID.randomUUID().toString()).toString();
PytorchParameters parameters = new PytorchParameters();
parameters.setRequirements(requirements);
parameters.setScript(script);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,111 |
[Bug] [Pytorch Task Plugin] Python home conflict when create conda env
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
If we set PYTHON_HOME, and then Pytorch task plugin create conda env can not set python home correctly
### What you expected to happen
empty
### How to reproduce
empty
### Anything else
empty
### 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/12111
|
https://github.com/apache/dolphinscheduler/pull/12112
|
e11e129cdaa05b3324f06072ea419a42b6d1cd18
|
6eb1eb722af06b94027994b2ef8955e84fd97d7f
| 2022-09-22T11:07:59Z |
java
| 2022-09-23T01:40:18Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-pytorch/src/test/java/org/apache/dolphinscheduler/plugin/task/pytorch/PytorchTaskTest.java
|
parameters.setPythonPath(pythonPath);
parameters.setIsCreateEnvironment(true);
parameters.setPythonEnvTool(PythonEnvManager.ENV_TOOL_VENV);
PytorchTask task = initTask(parameters);
String requirementFile = Paths.get(pythonPath, requirements).toString();
String scriptFile = Paths.get(pythonPath, script).toString();
createFile(requirementFile);
createFile(scriptFile);
String expected = "export PYTHONPATH=%s\n" +
"virtualenv -p ${PYTHON_HOME} ./venv && source ./venv/bin/activate && python -m pip install -r %s\n" +
"./venv/bin/python %s";
System.out.println(task.buildPythonExecuteCommand());
Assert.assertEquals(String.format(expected, pythonPath, requirementFile, scriptFile), task.buildPythonExecuteCommand());
}
private PytorchTask initTask(PytorchParameters pytorchParameters) {
TaskExecutionContext taskExecutionContext = createContext(pytorchParameters);
PytorchTask task = new PytorchTask(taskExecutionContext);
task.init();
return task;
}
public TaskExecutionContext createContext(PytorchParameters pytorchParameters) {
String parameters = JSONUtils.toJsonString(pytorchParameters);
TaskExecutionContext taskExecutionContext = Mockito.mock(TaskExecutionContext.class);
Mockito.when(taskExecutionContext.getTaskLogName()).thenReturn("PytorchTest");
String APP_ID = UUID.randomUUID().toString();
String folder = String.format("/tmp/dolphinscheduler_PytorchTest_%s", APP_ID);
Mockito.when(taskExecutionContext.getExecutePath()).thenReturn(folder);
Mockito.when(taskExecutionContext.getTaskAppId()).thenReturn(APP_ID);
Mockito.when(taskExecutionContext.getTenantCode()).thenReturn("root");
Mockito.when(taskExecutionContext.getStartTime()).thenReturn(new Date());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,111 |
[Bug] [Pytorch Task Plugin] Python home conflict when create conda env
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
If we set PYTHON_HOME, and then Pytorch task plugin create conda env can not set python home correctly
### What you expected to happen
empty
### How to reproduce
empty
### Anything else
empty
### 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/12111
|
https://github.com/apache/dolphinscheduler/pull/12112
|
e11e129cdaa05b3324f06072ea419a42b6d1cd18
|
6eb1eb722af06b94027994b2ef8955e84fd97d7f
| 2022-09-22T11:07:59Z |
java
| 2022-09-23T01:40:18Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-pytorch/src/test/java/org/apache/dolphinscheduler/plugin/task/pytorch/PytorchTaskTest.java
|
Mockito.when(taskExecutionContext.getTaskTimeout()).thenReturn(10000);
Mockito.when(taskExecutionContext.getLogPath()).thenReturn(folder + "/log");
Mockito.when(taskExecutionContext.getTaskParams()).thenReturn(parameters);
String envirementConfig = "export PATH=$HOME/anaconda3/bin:$PATH\n" + "export PYTHON_HOME=/bin/python";
Mockito.when(taskExecutionContext.getEnvironmentConfig()).thenReturn(envirementConfig);
String userName = System.getenv().get("USER");
Mockito.when(taskExecutionContext.getTenantCode()).thenReturn(userName);
TaskExecutionContextCacheManager.cacheTaskExecutionContext(taskExecutionContext);
return taskExecutionContext;
}
private void createFile(String fileName) throws Exception {
File file = new File(fileName);
Path path = file.toPath();
Set<PosixFilePermission> perms = PosixFilePermissions.fromString(RWXR_XR_X);
FileAttribute<Set<PosixFilePermission>> attr = PosixFilePermissions.asFileAttribute(perms);
if (SystemUtils.IS_OS_WINDOWS) {
Files.createFile(path);
} else {
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
try {
Files.createFile(path, attr);
} catch (FileAlreadyExistsException ex) {
}
}
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,000 |
[Bug] [Master] Cannot remove the WorkerGroup from the master service.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
cannot delete the WorkerGroup from the Master service.
When try to repreduce #11964 , i create a worker group named `app01`, then config the a shell task, and save it and run it.

Then delete this `app01` worker group. And re-run this process instance. It still can running and no any warn and error.
After i check the source code, i found that the Master service just will keep add the worker group, never remove the deleted worker group. If user update or delete the worker group from the UI, these history records still will keep in the memory and task affect.
`org.apache.dolphinscheduler.server.master.registry.ServerNodeManager`

### What you expected to happen
If cannot match the worker group, this task should not be dispatch and running.
### How to reproduce
Step 1. Add a Worker Group named `app01`
Step 2. Add a shell task, and the config the Worker group to `app01`
Step 3. Run this workflow.
Step 4. Delete the `app01` worker group.
Step 5. Re-run this process instance.
### 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/12000
|
https://github.com/apache/dolphinscheduler/pull/12050
|
064224696fd85a31fc8db1818bb3ae1f29e9dd4b
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
| 2022-09-16T11:57:52Z |
java
| 2022-09-24T10:57:20Z |
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.model.WorkerHeartBeat;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.AlertDao;
import org.apache.dolphinscheduler.dao.entity.WorkerGroup;
import org.apache.dolphinscheduler.dao.mapper.WorkerGroupMapper;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,000 |
[Bug] [Master] Cannot remove the WorkerGroup from the master service.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
cannot delete the WorkerGroup from the Master service.
When try to repreduce #11964 , i create a worker group named `app01`, then config the a shell task, and save it and run it.

Then delete this `app01` worker group. And re-run this process instance. It still can running and no any warn and error.
After i check the source code, i found that the Master service just will keep add the worker group, never remove the deleted worker group. If user update or delete the worker group from the UI, these history records still will keep in the memory and task affect.
`org.apache.dolphinscheduler.server.master.registry.ServerNodeManager`

### What you expected to happen
If cannot match the worker group, this task should not be dispatch and running.
### How to reproduce
Step 1. Add a Worker Group named `app01`
Step 2. Add a shell task, and the config the Worker group to `app01`
Step 3. Run this workflow.
Step 4. Delete the `app01` worker group.
Step 5. Re-run this process instance.
### 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/12000
|
https://github.com/apache/dolphinscheduler/pull/12050
|
064224696fd85a31fc8db1818bb3ae1f29e9dd4b
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
| 2022-09-16T11:57:52Z |
java
| 2022-09-24T10:57:20Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
|
import org.apache.dolphinscheduler.registry.api.Event;
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.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.service.queue.MasterPriorityQueue;
import org.apache.dolphinscheduler.service.registry.RegistryClient;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
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 java.util.concurrent.locks.ReentrantReadWriteLock;
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;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,000 |
[Bug] [Master] Cannot remove the WorkerGroup from the master service.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
cannot delete the WorkerGroup from the Master service.
When try to repreduce #11964 , i create a worker group named `app01`, then config the a shell task, and save it and run it.

Then delete this `app01` worker group. And re-run this process instance. It still can running and no any warn and error.
After i check the source code, i found that the Master service just will keep add the worker group, never remove the deleted worker group. If user update or delete the worker group from the UI, these history records still will keep in the memory and task affect.
`org.apache.dolphinscheduler.server.master.registry.ServerNodeManager`

### What you expected to happen
If cannot match the worker group, this task should not be dispatch and running.
### How to reproduce
Step 1. Add a Worker Group named `app01`
Step 2. Add a shell task, and the config the Worker group to `app01`
Step 3. Run this workflow.
Step 4. Delete the `app01` worker group.
Step 5. Re-run this process instance.
### 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/12000
|
https://github.com/apache/dolphinscheduler/pull/12050
|
064224696fd85a31fc8db1818bb3ae1f29e9dd4b
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
| 2022-09-16T11:57:52Z |
java
| 2022-09-24T10:57:20Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
|
/**
* server node manager
*/
@Service
public class ServerNodeManager implements InitializingBean {
private final Logger logger = LoggerFactory.getLogger(ServerNodeManager.class);
private final Lock masterLock = new ReentrantLock();
private final ReentrantReadWriteLock workerGroupLock = new ReentrantReadWriteLock();
private final ReentrantReadWriteLock.ReadLock workerGroupReadLock = workerGroupLock.readLock();
private final ReentrantReadWriteLock.WriteLock workerGroupWriteLock = workerGroupLock.writeLock();
private final ReentrantReadWriteLock workerNodeInfoLock = new ReentrantReadWriteLock();
private final ReentrantReadWriteLock.ReadLock workerNodeInfoReadLock = workerNodeInfoLock.readLock();
private final ReentrantReadWriteLock.WriteLock workerNodeInfoWriteLock = workerNodeInfoLock.writeLock();
/**
* worker group nodes, workerGroup -> ips
*/
private final ConcurrentHashMap<String, Set<String>> workerGroupNodes = new ConcurrentHashMap<>();
/**
* master nodes
*/
private final Set<String> masterNodes = new HashSet<>();
private final Map<String, WorkerHeartBeat> workerNodeInfo = new HashMap<>();
/**
* executor service
*/
private ScheduledExecutorService executorService;
@Autowired
private RegistryClient registryClient;
/**
* eg : /dolphinscheduler/node/worker/group/127.0.0.1:xxx
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,000 |
[Bug] [Master] Cannot remove the WorkerGroup from the master service.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
cannot delete the WorkerGroup from the Master service.
When try to repreduce #11964 , i create a worker group named `app01`, then config the a shell task, and save it and run it.

Then delete this `app01` worker group. And re-run this process instance. It still can running and no any warn and error.
After i check the source code, i found that the Master service just will keep add the worker group, never remove the deleted worker group. If user update or delete the worker group from the UI, these history records still will keep in the memory and task affect.
`org.apache.dolphinscheduler.server.master.registry.ServerNodeManager`

### What you expected to happen
If cannot match the worker group, this task should not be dispatch and running.
### How to reproduce
Step 1. Add a Worker Group named `app01`
Step 2. Add a shell task, and the config the Worker group to `app01`
Step 3. Run this workflow.
Step 4. Delete the `app01` worker group.
Step 5. Re-run this process instance.
### 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/12000
|
https://github.com/apache/dolphinscheduler/pull/12050
|
064224696fd85a31fc8db1818bb3ae1f29e9dd4b
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
| 2022-09-16T11:57:52Z |
java
| 2022-09-24T10:57:20Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
|
*/
private static final int WORKER_LISTENER_CHECK_LENGTH = 5;
/**
* worker group mapper
*/
@Autowired
private WorkerGroupMapper workerGroupMapper;
private final MasterPriorityQueue masterPriorityQueue = new MasterPriorityQueue();
/**
* alert dao
*/
@Autowired
private AlertDao alertDao;
/**
* master config
*/
@Autowired
private MasterConfig masterConfig;
private List<WorkerInfoChangeListener> workerInfoChangeListeners = new ArrayList<>();
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
*
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,000 |
[Bug] [Master] Cannot remove the WorkerGroup from the master service.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
cannot delete the WorkerGroup from the Master service.
When try to repreduce #11964 , i create a worker group named `app01`, then config the a shell task, and save it and run it.

Then delete this `app01` worker group. And re-run this process instance. It still can running and no any warn and error.
After i check the source code, i found that the Master service just will keep add the worker group, never remove the deleted worker group. If user update or delete the worker group from the UI, these history records still will keep in the memory and task affect.
`org.apache.dolphinscheduler.server.master.registry.ServerNodeManager`

### What you expected to happen
If cannot match the worker group, this task should not be dispatch and running.
### How to reproduce
Step 1. Add a Worker Group named `app01`
Step 2. Add a shell task, and the config the Worker group to `app01`
Step 3. Run this workflow.
Step 4. Delete the `app01` worker group.
Step 5. Re-run this process instance.
### 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/12000
|
https://github.com/apache/dolphinscheduler/pull/12050
|
064224696fd85a31fc8db1818bb3ae1f29e9dd4b
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
| 2022-09-16T11:57:52Z |
java
| 2022-09-24T10:57:20Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
|
* @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"));
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
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,000 |
[Bug] [Master] Cannot remove the WorkerGroup from the master service.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
cannot delete the WorkerGroup from the Master service.
When try to repreduce #11964 , i create a worker group named `app01`, then config the a shell task, and save it and run it.

Then delete this `app01` worker group. And re-run this process instance. It still can running and no any warn and error.
After i check the source code, i found that the Master service just will keep add the worker group, never remove the deleted worker group. If user update or delete the worker group from the UI, these history records still will keep in the memory and task affect.
`org.apache.dolphinscheduler.server.master.registry.ServerNodeManager`

### What you expected to happen
If cannot match the worker group, this task should not be dispatch and running.
### How to reproduce
Step 1. Add a Worker Group named `app01`
Step 2. Add a shell task, and the config the Worker group to `app01`
Step 3. Run this workflow.
Step 4. Delete the `app01` worker group.
Step 5. Re-run this process instance.
### 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/12000
|
https://github.com/apache/dolphinscheduler/pull/12050
|
064224696fd85a31fc8db1818bb3ae1f29e9dd4b
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
| 2022-09-16T11:57:52Z |
java
| 2022-09-24T10:57:20Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
|
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 {
@Override
public void run() {
try {
Map<String, String> registryWorkerNodeMap = registryClient.getServerMaps(NodeType.WORKER, true);
syncAllWorkerNodeInfo(registryWorkerNodeMap);
List<WorkerGroup> workerGroupList = workerGroupMapper.queryAllWorkerGroup();
if (CollectionUtils.isNotEmpty(workerGroupList)) {
for (WorkerGroup wg : workerGroupList) {
String workerGroupName = wg.getName();
Set<String> workerAddress = getWorkerAddressByWorkerGroup(registryWorkerNodeMap, wg);
if (!workerAddress.isEmpty()) {
syncWorkerGroupNodes(workerGroupName, workerAddress);
}
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,000 |
[Bug] [Master] Cannot remove the WorkerGroup from the master service.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
cannot delete the WorkerGroup from the Master service.
When try to repreduce #11964 , i create a worker group named `app01`, then config the a shell task, and save it and run it.

Then delete this `app01` worker group. And re-run this process instance. It still can running and no any warn and error.
After i check the source code, i found that the Master service just will keep add the worker group, never remove the deleted worker group. If user update or delete the worker group from the UI, these history records still will keep in the memory and task affect.
`org.apache.dolphinscheduler.server.master.registry.ServerNodeManager`

### What you expected to happen
If cannot match the worker group, this task should not be dispatch and running.
### How to reproduce
Step 1. Add a Worker Group named `app01`
Step 2. Add a shell task, and the config the Worker group to `app01`
Step 3. Run this workflow.
Step 4. Delete the `app01` worker group.
Step 5. Re-run this process instance.
### 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/12000
|
https://github.com/apache/dolphinscheduler/pull/12050
|
064224696fd85a31fc8db1818bb3ae1f29e9dd4b
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
| 2022-09-16T11:57:52Z |
java
| 2022-09-24T10:57:20Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
|
notifyWorkerInfoChangeListeners();
} catch (Exception e) {
logger.error("WorkerNodeInfoAndGroupDbSyncTask error:", e);
}
}
}
protected Set<String> getWorkerAddressByWorkerGroup(Map<String, String> newWorkerNodeInfo, WorkerGroup wg) {
Set<String> nodes = new HashSet<>();
String[] addrs = wg.getAddrList().split(Constants.COMMA);
for (String addr : addrs) {
if (newWorkerNodeInfo.containsKey(addr)) {
nodes.add(addr);
}
}
return nodes;
}
/**
* worker group node listener
*/
class WorkerDataListener implements SubscribeListener {
@Override
public void notify(Event event) {
final String path = event.path();
final Type type = event.type();
final String data = event.data();
if (registryClient.isWorkerPath(path)) {
try {
String[] parts = path.split("/");
if (parts.length < WORKER_LISTENER_CHECK_LENGTH) {
throw new IllegalArgumentException(
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,000 |
[Bug] [Master] Cannot remove the WorkerGroup from the master service.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
cannot delete the WorkerGroup from the Master service.
When try to repreduce #11964 , i create a worker group named `app01`, then config the a shell task, and save it and run it.

Then delete this `app01` worker group. And re-run this process instance. It still can running and no any warn and error.
After i check the source code, i found that the Master service just will keep add the worker group, never remove the deleted worker group. If user update or delete the worker group from the UI, these history records still will keep in the memory and task affect.
`org.apache.dolphinscheduler.server.master.registry.ServerNodeManager`

### What you expected to happen
If cannot match the worker group, this task should not be dispatch and running.
### How to reproduce
Step 1. Add a Worker Group named `app01`
Step 2. Add a shell task, and the config the Worker group to `app01`
Step 3. Run this workflow.
Step 4. Delete the `app01` worker group.
Step 5. Re-run this process instance.
### 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/12000
|
https://github.com/apache/dolphinscheduler/pull/12050
|
064224696fd85a31fc8db1818bb3ae1f29e9dd4b
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
| 2022-09-16T11:57:52Z |
java
| 2022-09-24T10:57:20Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
|
String.format("worker group path : %s is not valid, ignore", path));
}
final String workerGroupName = parts[parts.length - 2];
final String workerAddress = parts[parts.length - 1];
if (type == Type.ADD) {
logger.info("worker group node : {} added.", path);
Collection<String> currentNodes = registryClient.getWorkerGroupNodesDirectly(workerGroupName);
logger.info("currentNodes : {}", currentNodes);
syncWorkerGroupNodes(workerGroupName, currentNodes);
} else if (type == Type.REMOVE) {
logger.info("worker group node : {} down.", path);
Collection<String> currentNodes = registryClient.getWorkerGroupNodesDirectly(workerGroupName);
syncWorkerGroupNodes(workerGroupName, currentNodes);
alertDao.sendServerStoppedAlert(1, path, "WORKER");
} else if (type == Type.UPDATE) {
logger.debug("worker group node : {} update, data: {}", path, data);
Collection<String> currentNodes = registryClient.getWorkerGroupNodesDirectly(workerGroupName);
syncWorkerGroupNodes(workerGroupName, currentNodes);
syncSingleWorkerNodeInfo(workerAddress, JSONUtils.parseObject(data, WorkerHeartBeat.class));
}
notifyWorkerInfoChangeListeners();
} catch (IllegalArgumentException ex) {
logger.warn(ex.getMessage());
} catch (Exception ex) {
logger.error("WorkerGroupListener capture data change and get data failed", ex);
}
}
}
}
class MasterDataListener implements SubscribeListener {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,000 |
[Bug] [Master] Cannot remove the WorkerGroup from the master service.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
cannot delete the WorkerGroup from the Master service.
When try to repreduce #11964 , i create a worker group named `app01`, then config the a shell task, and save it and run it.

Then delete this `app01` worker group. And re-run this process instance. It still can running and no any warn and error.
After i check the source code, i found that the Master service just will keep add the worker group, never remove the deleted worker group. If user update or delete the worker group from the UI, these history records still will keep in the memory and task affect.
`org.apache.dolphinscheduler.server.master.registry.ServerNodeManager`

### What you expected to happen
If cannot match the worker group, this task should not be dispatch and running.
### How to reproduce
Step 1. Add a Worker Group named `app01`
Step 2. Add a shell task, and the config the Worker group to `app01`
Step 3. Run this workflow.
Step 4. Delete the `app01` worker group.
Step 5. Re-run this process instance.
### 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/12000
|
https://github.com/apache/dolphinscheduler/pull/12050
|
064224696fd85a31fc8db1818bb3ae1f29e9dd4b
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
| 2022-09-16T11:57:52Z |
java
| 2022-09-24T10:57:20Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
|
@Override
public void notify(Event event) {
final String path = event.path();
final Type type = event.type();
if (registryClient.isMasterPath(path)) {
try {
if (type.equals(Type.ADD)) {
logger.info("master node : {} added.", path);
updateMasterNodes();
}
if (type.equals(Type.REMOVE)) {
logger.info("master node : {} down.", path);
updateMasterNodes();
alertDao.sendServerStoppedAlert(1, path, "MASTER");
}
} catch (Exception ex) {
logger.error("MasterNodeListener capture data change and get data failed.", ex);
}
}
}
}
private void updateMasterNodes() {
MASTER_SLOT = 0;
MASTER_SIZE = 0;
this.masterNodes.clear();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,000 |
[Bug] [Master] Cannot remove the WorkerGroup from the master service.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
cannot delete the WorkerGroup from the Master service.
When try to repreduce #11964 , i create a worker group named `app01`, then config the a shell task, and save it and run it.

Then delete this `app01` worker group. And re-run this process instance. It still can running and no any warn and error.
After i check the source code, i found that the Master service just will keep add the worker group, never remove the deleted worker group. If user update or delete the worker group from the UI, these history records still will keep in the memory and task affect.
`org.apache.dolphinscheduler.server.master.registry.ServerNodeManager`

### What you expected to happen
If cannot match the worker group, this task should not be dispatch and running.
### How to reproduce
Step 1. Add a Worker Group named `app01`
Step 2. Add a shell task, and the config the Worker group to `app01`
Step 3. Run this workflow.
Step 4. Delete the `app01` worker group.
Step 5. Re-run this process instance.
### 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/12000
|
https://github.com/apache/dolphinscheduler/pull/12050
|
064224696fd85a31fc8db1818bb3ae1f29e9dd4b
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
| 2022-09-16T11:57:52Z |
java
| 2022-09-24T10:57:20Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
|
String nodeLock = Constants.REGISTRY_DOLPHINSCHEDULER_LOCK_MASTERS;
try {
registryClient.getLock(nodeLock);
Collection<String> currentNodes = registryClient.getMasterNodesDirectly();
List<Server> masterNodes = registryClient.getServerList(NodeType.MASTER);
syncMasterNodes(currentNodes, masterNodes);
} catch (Exception e) {
logger.error("update master nodes error", e);
} finally {
registryClient.releaseLock(nodeLock);
}
}
/**
* sync master nodes
*
* @param nodes master nodes
*/
private void syncMasterNodes(Collection<String> nodes, List<Server> masterNodes) {
masterLock.lock();
try {
this.masterNodes.addAll(nodes);
this.masterPriorityQueue.clear();
this.masterPriorityQueue.putList(masterNodes);
int index = masterPriorityQueue.getIndex(masterConfig.getMasterAddress());
if (index >= 0) {
MASTER_SIZE = nodes.size();
MASTER_SLOT = index;
} else {
logger.warn("current addr:{} is not in active master list", masterConfig.getMasterAddress());
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,000 |
[Bug] [Master] Cannot remove the WorkerGroup from the master service.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
cannot delete the WorkerGroup from the Master service.
When try to repreduce #11964 , i create a worker group named `app01`, then config the a shell task, and save it and run it.

Then delete this `app01` worker group. And re-run this process instance. It still can running and no any warn and error.
After i check the source code, i found that the Master service just will keep add the worker group, never remove the deleted worker group. If user update or delete the worker group from the UI, these history records still will keep in the memory and task affect.
`org.apache.dolphinscheduler.server.master.registry.ServerNodeManager`

### What you expected to happen
If cannot match the worker group, this task should not be dispatch and running.
### How to reproduce
Step 1. Add a Worker Group named `app01`
Step 2. Add a shell task, and the config the Worker group to `app01`
Step 3. Run this workflow.
Step 4. Delete the `app01` worker group.
Step 5. Re-run this process instance.
### 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/12000
|
https://github.com/apache/dolphinscheduler/pull/12050
|
064224696fd85a31fc8db1818bb3ae1f29e9dd4b
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
| 2022-09-16T11:57:52Z |
java
| 2022-09-24T10:57:20Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
|
logger.info("update master nodes, master size: {}, slot: {}, addr: {}", MASTER_SIZE, MASTER_SLOT,
masterConfig.getMasterAddress());
} finally {
masterLock.unlock();
}
}
/**
* sync worker group nodes
*
* @param workerGroup worker group
* @param nodes worker nodes
*/
private void syncWorkerGroupNodes(String workerGroup, Collection<String> nodes) {
workerGroupWriteLock.lock();
try {
Set<String> workerNodes = workerGroupNodes.getOrDefault(workerGroup, new HashSet<>());
workerNodes.clear();
workerNodes.addAll(nodes);
workerGroupNodes.put(workerGroup, workerNodes);
} finally {
workerGroupWriteLock.unlock();
}
}
public Map<String, Set<String>> getWorkerGroupNodes() {
workerGroupReadLock.lock();
try {
return Collections.unmodifiableMap(workerGroupNodes);
} finally {
workerGroupReadLock.unlock();
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,000 |
[Bug] [Master] Cannot remove the WorkerGroup from the master service.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
cannot delete the WorkerGroup from the Master service.
When try to repreduce #11964 , i create a worker group named `app01`, then config the a shell task, and save it and run it.

Then delete this `app01` worker group. And re-run this process instance. It still can running and no any warn and error.
After i check the source code, i found that the Master service just will keep add the worker group, never remove the deleted worker group. If user update or delete the worker group from the UI, these history records still will keep in the memory and task affect.
`org.apache.dolphinscheduler.server.master.registry.ServerNodeManager`

### What you expected to happen
If cannot match the worker group, this task should not be dispatch and running.
### How to reproduce
Step 1. Add a Worker Group named `app01`
Step 2. Add a shell task, and the config the Worker group to `app01`
Step 3. Run this workflow.
Step 4. Delete the `app01` worker group.
Step 5. Re-run this process instance.
### 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/12000
|
https://github.com/apache/dolphinscheduler/pull/12050
|
064224696fd85a31fc8db1818bb3ae1f29e9dd4b
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
| 2022-09-16T11:57:52Z |
java
| 2022-09-24T10:57:20Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
|
}
/**
* get worker group nodes
*
* @param workerGroup workerGroup
* @return worker nodes
*/
public Set<String> getWorkerGroupNodes(String workerGroup) {
workerGroupReadLock.lock();
try {
if (StringUtils.isEmpty(workerGroup)) {
workerGroup = Constants.DEFAULT_WORKER_GROUP;
}
Set<String> nodes = workerGroupNodes.get(workerGroup);
if (CollectionUtils.isNotEmpty(nodes)) {
return Collections.unmodifiableSet(nodes);
}
return nodes;
} finally {
workerGroupReadLock.unlock();
}
}
public Map<String, WorkerHeartBeat> getWorkerNodeInfo() {
return Collections.unmodifiableMap(workerNodeInfo);
}
/**
* get worker node info
*
* @param workerNode worker node
* @return worker node info
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,000 |
[Bug] [Master] Cannot remove the WorkerGroup from the master service.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
cannot delete the WorkerGroup from the Master service.
When try to repreduce #11964 , i create a worker group named `app01`, then config the a shell task, and save it and run it.

Then delete this `app01` worker group. And re-run this process instance. It still can running and no any warn and error.
After i check the source code, i found that the Master service just will keep add the worker group, never remove the deleted worker group. If user update or delete the worker group from the UI, these history records still will keep in the memory and task affect.
`org.apache.dolphinscheduler.server.master.registry.ServerNodeManager`

### What you expected to happen
If cannot match the worker group, this task should not be dispatch and running.
### How to reproduce
Step 1. Add a Worker Group named `app01`
Step 2. Add a shell task, and the config the Worker group to `app01`
Step 3. Run this workflow.
Step 4. Delete the `app01` worker group.
Step 5. Re-run this process instance.
### 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/12000
|
https://github.com/apache/dolphinscheduler/pull/12050
|
064224696fd85a31fc8db1818bb3ae1f29e9dd4b
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
| 2022-09-16T11:57:52Z |
java
| 2022-09-24T10:57:20Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
|
*/
public WorkerHeartBeat getWorkerNodeInfo(String workerNode) {
workerNodeInfoReadLock.lock();
try {
return workerNodeInfo.getOrDefault(workerNode, null);
} finally {
workerNodeInfoReadLock.unlock();
}
}
/**
* sync worker node info
*
* @param newWorkerNodeInfo new worker node info
*/
private void syncAllWorkerNodeInfo(Map<String, String> newWorkerNodeInfo) {
workerNodeInfoWriteLock.lock();
try {
workerNodeInfo.clear();
for (Map.Entry<String, String> entry : newWorkerNodeInfo.entrySet()) {
workerNodeInfo.put(entry.getKey(), JSONUtils.parseObject(entry.getValue(), WorkerHeartBeat.class));
}
} finally {
workerNodeInfoWriteLock.unlock();
}
}
/**
* sync single worker node info
*/
private void syncSingleWorkerNodeInfo(String node, WorkerHeartBeat info) {
workerNodeInfoWriteLock.lock();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,000 |
[Bug] [Master] Cannot remove the WorkerGroup from the master service.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
cannot delete the WorkerGroup from the Master service.
When try to repreduce #11964 , i create a worker group named `app01`, then config the a shell task, and save it and run it.

Then delete this `app01` worker group. And re-run this process instance. It still can running and no any warn and error.
After i check the source code, i found that the Master service just will keep add the worker group, never remove the deleted worker group. If user update or delete the worker group from the UI, these history records still will keep in the memory and task affect.
`org.apache.dolphinscheduler.server.master.registry.ServerNodeManager`

### What you expected to happen
If cannot match the worker group, this task should not be dispatch and running.
### How to reproduce
Step 1. Add a Worker Group named `app01`
Step 2. Add a shell task, and the config the Worker group to `app01`
Step 3. Run this workflow.
Step 4. Delete the `app01` worker group.
Step 5. Re-run this process instance.
### 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/12000
|
https://github.com/apache/dolphinscheduler/pull/12050
|
064224696fd85a31fc8db1818bb3ae1f29e9dd4b
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
| 2022-09-16T11:57:52Z |
java
| 2022-09-24T10:57:20Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java
|
try {
workerNodeInfo.put(node, info);
} finally {
workerNodeInfoWriteLock.unlock();
}
}
/**
* Add the resource change listener, when the resource changed, the listener will be notified.
*
* @param listener will be trigger, when the worker node info changed.
*/
public synchronized void addWorkerInfoChangeListener(WorkerInfoChangeListener listener) {
workerInfoChangeListeners.add(listener);
}
private void notifyWorkerInfoChangeListeners() {
Map<String, Set<String>> workerGroupNodes = getWorkerGroupNodes();
Map<String, WorkerHeartBeat> workerNodeInfo = getWorkerNodeInfo();
for (WorkerInfoChangeListener listener : workerInfoChangeListeners) {
listener.notify(workerGroupNodes, workerNodeInfo);
}
}
/**
* destroy
*/
@PreDestroy
public void destroy() {
executorService.shutdownNow();
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,758 |
[Bug] [Common] IPv4 Pattern is wrong.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
IPv4 Pattern is not correct.


### What you expected to happen
can check invaild IPv4
### How to reproduce
just add some wrong IP to test UT
### 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/11758
|
https://github.com/apache/dolphinscheduler/pull/11762
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
|
289e1ecdc6f46f9b4c0cb851c0f004b18fe2e50d
| 2022-09-02T10:45:08Z |
java
| 2022-09-26T01:10:22Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.utils;
import static java.util.Collections.emptyList;
import org.apache.dolphinscheduler.common.Constants;
import java.io.IOException;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Enumeration;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,758 |
[Bug] [Common] IPv4 Pattern is wrong.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
IPv4 Pattern is not correct.


### What you expected to happen
can check invaild IPv4
### How to reproduce
just add some wrong IP to test UT
### 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/11758
|
https://github.com/apache/dolphinscheduler/pull/11762
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
|
289e1ecdc6f46f9b4c0cb851c0f004b18fe2e50d
| 2022-09-02T10:45:08Z |
java
| 2022-09-26T01:10:22Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java
|
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* NetUtils
*/
public class NetUtils {
private static final Pattern IP_PATTERN = Pattern.compile("\\d{1,3}(\\.\\d{1,3}){3,5}$");
private static final String NETWORK_PRIORITY_DEFAULT = "default";
private static final String NETWORK_PRIORITY_INNER = "inner";
private static final String NETWORK_PRIORITY_OUTER = "outer";
private static final Logger logger = LoggerFactory.getLogger(NetUtils.class);
private static InetAddress LOCAL_ADDRESS = null;
private static volatile String HOST_ADDRESS;
private NetUtils() {
throw new UnsupportedOperationException("Construct NetUtils");
}
/**
* get addr like host:port
* @return addr
*/
public static String getAddr(String host, int port) {
return String.format("%s:%d", host, port);
}
/**
* get addr like host:port
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,758 |
[Bug] [Common] IPv4 Pattern is wrong.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
IPv4 Pattern is not correct.


### What you expected to happen
can check invaild IPv4
### How to reproduce
just add some wrong IP to test UT
### 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/11758
|
https://github.com/apache/dolphinscheduler/pull/11762
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
|
289e1ecdc6f46f9b4c0cb851c0f004b18fe2e50d
| 2022-09-02T10:45:08Z |
java
| 2022-09-26T01:10:22Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java
|
* @return addr
*/
public static String getAddr(int port) {
return getAddr(getHost(), port);
}
/**
* get host
* @return host
*/
public static String getHost(InetAddress inetAddress) {
if (inetAddress != null) {
if (Constants.KUBERNETES_MODE) {
String canonicalHost = inetAddress.getCanonicalHostName();
String[] items = canonicalHost.split("\\.");
if (items.length == 6 && "svc".equals(items[3])) {
return String.format("%s.%s", items[0], items[1]);
}
return canonicalHost;
}
return inetAddress.getHostAddress();
}
return null;
}
public static String getHost() {
if (HOST_ADDRESS != null) {
return HOST_ADDRESS;
}
InetAddress address = getLocalAddress();
if (address != null) {
HOST_ADDRESS = getHost(address);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,758 |
[Bug] [Common] IPv4 Pattern is wrong.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
IPv4 Pattern is not correct.


### What you expected to happen
can check invaild IPv4
### How to reproduce
just add some wrong IP to test UT
### 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/11758
|
https://github.com/apache/dolphinscheduler/pull/11762
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
|
289e1ecdc6f46f9b4c0cb851c0f004b18fe2e50d
| 2022-09-02T10:45:08Z |
java
| 2022-09-26T01:10:22Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java
|
return HOST_ADDRESS;
}
return Constants.KUBERNETES_MODE ? "localhost" : "127.0.0.1";
}
private static InetAddress getLocalAddress() {
if (null != LOCAL_ADDRESS) {
return LOCAL_ADDRESS;
}
return getLocalAddress0();
}
/**
* Find first valid IP from local network card
*
* @return first valid local IP
*/
private static synchronized InetAddress getLocalAddress0() {
if (null != LOCAL_ADDRESS) {
return LOCAL_ADDRESS;
}
InetAddress localAddress = null;
try {
NetworkInterface networkInterface = findNetworkInterface();
if (networkInterface != null) {
Enumeration<InetAddress> addresses = networkInterface.getInetAddresses();
while (addresses.hasMoreElements()) {
Optional<InetAddress> addressOp = toValidAddress(addresses.nextElement());
if (addressOp.isPresent()) {
try {
if (addressOp.get().isReachable(200)) {
LOCAL_ADDRESS = addressOp.get();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,758 |
[Bug] [Common] IPv4 Pattern is wrong.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
IPv4 Pattern is not correct.


### What you expected to happen
can check invaild IPv4
### How to reproduce
just add some wrong IP to test UT
### 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/11758
|
https://github.com/apache/dolphinscheduler/pull/11762
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
|
289e1ecdc6f46f9b4c0cb851c0f004b18fe2e50d
| 2022-09-02T10:45:08Z |
java
| 2022-09-26T01:10:22Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java
|
return LOCAL_ADDRESS;
}
} catch (IOException e) {
logger.warn("test address id reachable io exception", e);
}
}
}
}
localAddress = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
logger.warn("InetAddress get LocalHost exception", e);
}
Optional<InetAddress> addressOp = toValidAddress(localAddress);
if (addressOp.isPresent()) {
LOCAL_ADDRESS = addressOp.get();
}
return LOCAL_ADDRESS;
}
private static Optional<InetAddress> toValidAddress(InetAddress address) {
if (address instanceof Inet6Address) {
Inet6Address v6Address = (Inet6Address) address;
if (isPreferIPV6Address()) {
return Optional.ofNullable(normalizeV6Address(v6Address));
}
}
if (isValidV4Address(address)) {
return Optional.of(address);
}
return Optional.empty();
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,758 |
[Bug] [Common] IPv4 Pattern is wrong.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
IPv4 Pattern is not correct.


### What you expected to happen
can check invaild IPv4
### How to reproduce
just add some wrong IP to test UT
### 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/11758
|
https://github.com/apache/dolphinscheduler/pull/11762
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
|
289e1ecdc6f46f9b4c0cb851c0f004b18fe2e50d
| 2022-09-02T10:45:08Z |
java
| 2022-09-26T01:10:22Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java
|
private static InetAddress normalizeV6Address(Inet6Address address) {
String addr = address.getHostAddress();
int i = addr.lastIndexOf('%');
if (i > 0) {
try {
return InetAddress.getByName(addr.substring(0, i) + '%' + address.getScopeId());
} catch (UnknownHostException e) {
logger.debug("Unknown IPV6 address: ", e);
}
}
return address;
}
public static boolean isValidV4Address(InetAddress address) {
if (address == null || address.isLoopbackAddress()) {
return false;
}
String name = address.getHostAddress();
return (name != null
&& IP_PATTERN.matcher(name).matches()
&& !address.isAnyLocalAddress()
&& !address.isLoopbackAddress());
}
/**
* Check if an ipv6 address
*
* @return true if it is reachable
*/
private static boolean isPreferIPV6Address() {
return Boolean.getBoolean("java.net.preferIPv6Addresses");
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,758 |
[Bug] [Common] IPv4 Pattern is wrong.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
IPv4 Pattern is not correct.


### What you expected to happen
can check invaild IPv4
### How to reproduce
just add some wrong IP to test UT
### 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/11758
|
https://github.com/apache/dolphinscheduler/pull/11762
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
|
289e1ecdc6f46f9b4c0cb851c0f004b18fe2e50d
| 2022-09-02T10:45:08Z |
java
| 2022-09-26T01:10:22Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java
|
/**
* Get the suitable {@link NetworkInterface}
*
* @return If no {@link NetworkInterface} is available , return <code>null</code>
*/
private static NetworkInterface findNetworkInterface() {
List<NetworkInterface> validNetworkInterfaces = emptyList();
try {
validNetworkInterfaces = getValidNetworkInterfaces();
} catch (SocketException e) {
logger.warn("ValidNetworkInterfaces exception", e);
}
NetworkInterface result = null;
for (NetworkInterface networkInterface : validNetworkInterfaces) {
if (isSpecifyNetworkInterface(networkInterface)) {
result = networkInterface;
break;
}
}
if (null != result) {
return result;
}
return findAddress(validNetworkInterfaces);
}
/**
* Get the valid {@link NetworkInterface network interfaces}
*
* @throws SocketException SocketException if an I/O error occurs.
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,758 |
[Bug] [Common] IPv4 Pattern is wrong.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
IPv4 Pattern is not correct.


### What you expected to happen
can check invaild IPv4
### How to reproduce
just add some wrong IP to test UT
### 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/11758
|
https://github.com/apache/dolphinscheduler/pull/11762
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
|
289e1ecdc6f46f9b4c0cb851c0f004b18fe2e50d
| 2022-09-02T10:45:08Z |
java
| 2022-09-26T01:10:22Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java
|
private static List<NetworkInterface> getValidNetworkInterfaces() throws SocketException {
List<NetworkInterface> validNetworkInterfaces = new LinkedList<>();
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
NetworkInterface networkInterface = interfaces.nextElement();
if (ignoreNetworkInterface(networkInterface)) {
continue;
}
validNetworkInterfaces.add(networkInterface);
}
return validNetworkInterfaces;
}
/**
* @param networkInterface {@link NetworkInterface}
* @return if the specified {@link NetworkInterface} should be ignored, return <code>true</code>
* @throws SocketException SocketException if an I/O error occurs.
*/
public static boolean ignoreNetworkInterface(NetworkInterface networkInterface) throws SocketException {
return networkInterface == null
|| networkInterface.isLoopback()
|| networkInterface.isVirtual()
|| !networkInterface.isUp();
}
private static boolean isSpecifyNetworkInterface(NetworkInterface networkInterface) {
String preferredNetworkInterface = PropertyUtils.getString(Constants.DOLPHIN_SCHEDULER_NETWORK_INTERFACE_PREFERRED,
System.getProperty(Constants.DOLPHIN_SCHEDULER_NETWORK_INTERFACE_PREFERRED));
return Objects.equals(networkInterface.getDisplayName(), preferredNetworkInterface);
}
private static NetworkInterface findAddress(List<NetworkInterface> validNetworkInterfaces) {
if (validNetworkInterfaces.isEmpty()) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,758 |
[Bug] [Common] IPv4 Pattern is wrong.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
IPv4 Pattern is not correct.


### What you expected to happen
can check invaild IPv4
### How to reproduce
just add some wrong IP to test UT
### 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/11758
|
https://github.com/apache/dolphinscheduler/pull/11762
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
|
289e1ecdc6f46f9b4c0cb851c0f004b18fe2e50d
| 2022-09-02T10:45:08Z |
java
| 2022-09-26T01:10:22Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java
|
return null;
}
String networkPriority = PropertyUtils.getString(Constants.DOLPHIN_SCHEDULER_NETWORK_PRIORITY_STRATEGY, NETWORK_PRIORITY_DEFAULT);
if (NETWORK_PRIORITY_DEFAULT.equalsIgnoreCase(networkPriority)) {
return findAddressByDefaultPolicy(validNetworkInterfaces);
} else if (NETWORK_PRIORITY_INNER.equalsIgnoreCase(networkPriority)) {
return findInnerAddress(validNetworkInterfaces);
} else if (NETWORK_PRIORITY_OUTER.equalsIgnoreCase(networkPriority)) {
return findOuterAddress(validNetworkInterfaces);
} else {
logger.error("There is no matching network card acquisition policy!");
return null;
}
}
private static NetworkInterface findAddressByDefaultPolicy(List<NetworkInterface> validNetworkInterfaces) {
NetworkInterface networkInterface;
networkInterface = findInnerAddress(validNetworkInterfaces);
if (networkInterface == null) {
networkInterface = findOuterAddress(validNetworkInterfaces);
if (networkInterface == null) {
networkInterface = validNetworkInterfaces.get(0);
}
}
return networkInterface;
}
/**
* Get the Intranet IP
*
* @return If no {@link NetworkInterface} is available , return <code>null</code>
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,758 |
[Bug] [Common] IPv4 Pattern is wrong.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
IPv4 Pattern is not correct.


### What you expected to happen
can check invaild IPv4
### How to reproduce
just add some wrong IP to test UT
### 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/11758
|
https://github.com/apache/dolphinscheduler/pull/11762
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
|
289e1ecdc6f46f9b4c0cb851c0f004b18fe2e50d
| 2022-09-02T10:45:08Z |
java
| 2022-09-26T01:10:22Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java
|
private static NetworkInterface findInnerAddress(List<NetworkInterface> validNetworkInterfaces) {
NetworkInterface networkInterface = null;
for (NetworkInterface ni : validNetworkInterfaces) {
Enumeration<InetAddress> address = ni.getInetAddresses();
while (address.hasMoreElements()) {
InetAddress ip = address.nextElement();
if (ip.isSiteLocalAddress()
&& !ip.isLoopbackAddress()) {
networkInterface = ni;
}
}
}
return networkInterface;
}
private static NetworkInterface findOuterAddress(List<NetworkInterface> validNetworkInterfaces) {
NetworkInterface networkInterface = null;
for (NetworkInterface ni : validNetworkInterfaces) {
Enumeration<InetAddress> address = ni.getInetAddresses();
while (address.hasMoreElements()) {
InetAddress ip = address.nextElement();
if (!ip.isSiteLocalAddress()
&& !ip.isLoopbackAddress()) {
networkInterface = ni;
}
}
}
return networkInterface;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,758 |
[Bug] [Common] IPv4 Pattern is wrong.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
IPv4 Pattern is not correct.


### What you expected to happen
can check invaild IPv4
### How to reproduce
just add some wrong IP to test UT
### 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/11758
|
https://github.com/apache/dolphinscheduler/pull/11762
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
|
289e1ecdc6f46f9b4c0cb851c0f004b18fe2e50d
| 2022-09-02T10:45:08Z |
java
| 2022-09-26T01:10:22Z |
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/NetUtilsTest.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.utils;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.apache.dolphinscheduler.common.Constants;
import java.net.InetAddress;
import org.junit.After;
import org.junit.Test;
import org.powermock.reflect.Whitebox;
public class NetUtilsTest {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,758 |
[Bug] [Common] IPv4 Pattern is wrong.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
IPv4 Pattern is not correct.


### What you expected to happen
can check invaild IPv4
### How to reproduce
just add some wrong IP to test UT
### 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/11758
|
https://github.com/apache/dolphinscheduler/pull/11762
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
|
289e1ecdc6f46f9b4c0cb851c0f004b18fe2e50d
| 2022-09-02T10:45:08Z |
java
| 2022-09-26T01:10:22Z |
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/NetUtilsTest.java
|
@After
public void reset() {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,758 |
[Bug] [Common] IPv4 Pattern is wrong.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
IPv4 Pattern is not correct.


### What you expected to happen
can check invaild IPv4
### How to reproduce
just add some wrong IP to test UT
### 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/11758
|
https://github.com/apache/dolphinscheduler/pull/11762
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
|
289e1ecdc6f46f9b4c0cb851c0f004b18fe2e50d
| 2022-09-02T10:45:08Z |
java
| 2022-09-26T01:10:22Z |
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/NetUtilsTest.java
|
Whitebox.setInternalState(Constants.class, "KUBERNETES_MODE", false);
}
@Test
public void testGetAddr() {
assertEquals(NetUtils.getHost() + ":5678", NetUtils.getAddr(5678));
assertEquals("127.0.0.1:5678", NetUtils.getAddr("127.0.0.1", 5678));
assertEquals("localhost:1234", NetUtils.getAddr("localhost", 1234));
}
@Test
public void testGetHost() {
InetAddress address = mock(InetAddress.class);
when(address.getCanonicalHostName()).thenReturn("dolphinscheduler-worker-0.dolphinscheduler-worker-headless.default.svc.cluster.local");
when(address.getHostName()).thenReturn("dolphinscheduler-worker-0");
when(address.getHostAddress()).thenReturn("172.17.0.15");
assertEquals("172.17.0.15", NetUtils.getHost(address));
Whitebox.setInternalState(Constants.class, "KUBERNETES_MODE", true);
assertEquals("dolphinscheduler-worker-0.dolphinscheduler-worker-headless", NetUtils.getHost(address));
address = mock(InetAddress.class);
when(address.getCanonicalHostName()).thenReturn("busybox-1.default-subdomain.my-namespace.svc.cluster-domain.example");
when(address.getHostName()).thenReturn("busybox-1");
Whitebox.setInternalState(Constants.class, "KUBERNETES_MODE", true);
assertEquals("busybox-1.default-subdomain", NetUtils.getHost(address));
address = mock(InetAddress.class);
when(address.getCanonicalHostName()).thenReturn("dolphinscheduler.cluster-domain.example");
when(address.getHostName()).thenReturn("dolphinscheduler");
Whitebox.setInternalState(Constants.class, "KUBERNETES_MODE", true);
assertEquals("dolphinscheduler.cluster-domain.example", NetUtils.getHost(address));
address = mock(InetAddress.class);
when(address.getCanonicalHostName()).thenReturn("dolphinscheduler-worker-0");
when(address.getHostName()).thenReturn("dolphinscheduler-worker-0");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,758 |
[Bug] [Common] IPv4 Pattern is wrong.
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
IPv4 Pattern is not correct.


### What you expected to happen
can check invaild IPv4
### How to reproduce
just add some wrong IP to test UT
### 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/11758
|
https://github.com/apache/dolphinscheduler/pull/11762
|
ada7cf71d5c70174c7d7c6608f4f60896db5d6b9
|
289e1ecdc6f46f9b4c0cb851c0f004b18fe2e50d
| 2022-09-02T10:45:08Z |
java
| 2022-09-26T01:10:22Z |
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/NetUtilsTest.java
|
Whitebox.setInternalState(Constants.class, "KUBERNETES_MODE", true);
assertEquals("dolphinscheduler-worker-0", NetUtils.getHost(address));
}
@Test
public void testGetLocalHost() {
assertNotNull(NetUtils.getHost());
}
@Test
public void testIsValidAddress() {
assertFalse(NetUtils.isValidV4Address(null));
InetAddress address = mock(InetAddress.class);
when(address.isLoopbackAddress()).thenReturn(true);
assertFalse(NetUtils.isValidV4Address(address));
address = mock(InetAddress.class);
when(address.getHostAddress()).thenReturn("localhost");
assertFalse(NetUtils.isValidV4Address(address));
address = mock(InetAddress.class);
when(address.getHostAddress()).thenReturn("0.0.0.0");
when(address.isAnyLocalAddress()).thenReturn(true);
assertFalse(NetUtils.isValidV4Address(address));
address = mock(InetAddress.class);
when(address.getHostAddress()).thenReturn("127.0.0.1");
when(address.isLoopbackAddress()).thenReturn(true);
assertFalse(NetUtils.isValidV4Address(address));
address = mock(InetAddress.class);
when(address.getHostAddress()).thenReturn("1.2.3.4");
assertTrue(NetUtils.isValidV4Address(address));
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.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 java.time.Duration;
import java.util.Arrays;
import java.util.List;
public class TaskConstants {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java
|
private TaskConstants() {
throw new IllegalStateException("Utility class");
}
public static final String YARN_APPLICATION_REGEX = "application_\\d+_\\d+";
public static final String FLINK_APPLICATION_REGEX = "JobID \\w+";
public static final String SETVALUE_REGEX = "[\\$#]\\{setValue\\(([^)]*)\\)}";
/**
* string false
*/
public static final String STRING_FALSE = "false";
/**
* exit code kill
*/
public static final int EXIT_CODE_KILL = 137;
public static final String PID = "pid";
/**
* QUESTION ?
*/
public static final String QUESTION = "?";
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java
|
/**
* comma ,
*/
public static final String COMMA = ",";
/**
* slash /
*/
public static final String SLASH = "/";
/**
* COLON :
*/
public static final String COLON = ":";
/**
* SPACE " "
*/
public static final String SPACE = " ";
/**
* SINGLE_SLASH /
*/
public static final String SINGLE_SLASH = "/";
/**
* DOUBLE_SLASH //
*/
public static final String DOUBLE_SLASH = "//";
/**
* SINGLE_QUOTES "'"
*/
public static final String SINGLE_QUOTES = "'";
/**
* DOUBLE_QUOTES "\""
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java
|
*/
public static final String DOUBLE_QUOTES = "\"";
/**
* SEMICOLON ;
*/
public static final String SEMICOLON = ";";
/**
* EQUAL SIGN
*/
public static final String EQUAL_SIGN = "=";
/**
* AT SIGN
*/
public static final String AT_SIGN = "@";
/**
* UNDERLINE
*/
public static final String UNDERLINE = "_";
/**
* sleep time
*/
public static final int SLEEP_TIME_MILLIS = 1000;
/**
* exit code failure
*/
public static final int EXIT_CODE_FAILURE = -1;
/**
* exit code success
*/
public static final int EXIT_CODE_SUCCESS = 0;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java
|
/**
* running code
*/
public static final int RUNNING_CODE = 1;
public static final String SH = "sh";
/**
* default log cache rows num,output when reach the number
*/
public static final int DEFAULT_LOG_ROWS_NUM = 4 * 16;
/**
* log flush interval?output when reach the interval
*/
public static final int DEFAULT_LOG_FLUSH_INTERVAL = 1000;
/**
* pstree, get pud and sub pid
*/
public static final String PSTREE = "pstree";
public static final String RWXR_XR_X = "rwxr-xr-x";
/**
* task log info format
*/
public static final String TASK_LOG_LOGGER_NAME = "TaskLogLogger";
/**
* task log logger name format
*/
public static final String TASK_LOG_LOGGER_NAME_FORMAT = TASK_LOG_LOGGER_NAME + "-%s";
/**
* Task Logger's prefix
*/
public static final String TASK_LOGGER_INFO_PREFIX = "TASK";
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java
|
/**
* Task Logger Thread's name
*/
public static final String TASK_APPID_LOG_FORMAT = "taskAppId";
/**
* get output log service
*/
public static final String GET_OUTPUT_LOG_SERVICE = "-getOutputLogService";
/**
* date format of yyyyMMdd
*/
public static final String PARAMETER_FORMAT_DATE = "yyyyMMdd";
/**
* date format of yyyyMMddHHmmss
*/
public static final String PARAMETER_FORMAT_TIME = "yyyyMMddHHmmss";
/**
* new
* schedule time
*/
public static final String PARAMETER_SHECDULE_TIME = "schedule.time";
/**
* system date(yyyyMMddHHmmss)
*/
public static final String PARAMETER_DATETIME = "system.datetime";
/**
* system date(yyyymmdd) today
*/
public static final String PARAMETER_CURRENT_DATE = "system.biz.curdate";
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java
|
* system date(yyyymmdd) yesterday
*/
public static final String PARAMETER_BUSINESS_DATE = "system.biz.date";
/**
* the absolute path of current executing task
*/
public static final String PARAMETER_TASK_EXECUTE_PATH = "system.task.execute.path";
/**
* the instance id of current task
*/
public static final String PARAMETER_TASK_INSTANCE_ID = "system.task.instance.id";
/**
* month_begin
*/
public static final String MONTH_BEGIN = "month_begin";
/**
* add_months
*/
public static final String ADD_MONTHS = "add_months";
/**
* month_end
*/
public static final String MONTH_END = "month_end";
/**
* week_begin
*/
public static final String WEEK_BEGIN = "week_begin";
/**
* week_end
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java
|
public static final String WEEK_END = "week_end";
/**
* timestamp
*/
public static final String TIMESTAMP = "timestamp";
public static final char SUBTRACT_CHAR = '-';
public static final char ADD_CHAR = '+';
public static final char MULTIPLY_CHAR = '*';
public static final char DIVISION_CHAR = '/';
public static final char LEFT_BRACE_CHAR = '(';
public static final char RIGHT_BRACE_CHAR = ')';
public static final String ADD_STRING = "+";
public static final String MULTIPLY_STRING = "*";
public static final String DIVISION_STRING = "/";
public static final String LEFT_BRACE_STRING = "(";
public static final char P = 'P';
public static final char N = 'N';
public static final String SUBTRACT_STRING = "-";
public static final String GLOBAL_PARAMS = "globalParams";
public static final String LOCAL_PARAMS = "localParams";
public static final String LOCAL_PARAMS_LIST = "localParamsList";
public static final String SUBPROCESS_INSTANCE_ID = "subProcessInstanceId";
public static final String PROCESS_INSTANCE_STATE = "processInstanceState";
public static final String PARENT_WORKFLOW_INSTANCE = "parentWorkflowInstance";
public static final String CONDITION_RESULT = "conditionResult";
public static final String SWITCH_RESULT = "switchResult";
public static final String DEPENDENCE = "dependence";
public static final String TASK_TYPE = "taskType";
public static final String TASK_LIST = "taskList";
public static final String QUEUE = "queue";
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java
|
public static final String QUEUE_NAME = "queueName";
public static final int LOG_QUERY_SKIP_LINE_NUMBER = 0;
public static final int LOG_QUERY_LIMIT = 4096;
/**
* default display rows
*/
public static final int DEFAULT_DISPLAY_ROWS = 10;
/**
* jar
*/
public static final String JAR = "jar";
/**
* hadoop
*/
public static final String HADOOP = "hadoop";
/**
* -D <property>=<value>
*/
public static final String D = "-D";
/**
* jdbc url
*/
public static final String JDBC_MYSQL = "jdbc:mysql://";
public static final String JDBC_POSTGRESQL = "jdbc:postgresql://";
public static final String JDBC_HIVE_2 = "jdbc:hive2://";
public static final String JDBC_CLICKHOUSE = "jdbc:clickhouse://";
public static final String JDBC_ORACLE_SID = "jdbc:oracle:thin:@";
public static final String JDBC_ORACLE_SERVICE_NAME = "jdbc:oracle:thin:@//";
public static final String JDBC_SQLSERVER = "jdbc:sqlserver://";
public static final String JDBC_DB2 = "jdbc:db2://";
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java
|
public static final String JDBC_PRESTO = "jdbc:presto://";
/**
* driver
*/
public static final String ORG_POSTGRESQL_DRIVER = "org.postgresql.Driver";
public static final String COM_MYSQL_CJ_JDBC_DRIVER = "com.mysql.cj.jdbc.Driver";
public static final String ORG_APACHE_HIVE_JDBC_HIVE_DRIVER = "org.apache.hive.jdbc.HiveDriver";
public static final String COM_CLICKHOUSE_JDBC_DRIVER = "ru.yandex.clickhouse.ClickHouseDriver";
public static final String COM_ORACLE_JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver";
public static final String COM_SQLSERVER_JDBC_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
public static final String COM_DB2_JDBC_DRIVER = "com.ibm.db2.jcc.DB2Driver";
public static final String COM_PRESTO_JDBC_DRIVER = "com.facebook.presto.jdbc.PrestoDriver";
/**
* datasource encryption salt
*/
public static final String DATASOURCE_ENCRYPTION_SALT_DEFAULT = "!@#$%^&*";
public static final String DATASOURCE_ENCRYPTION_ENABLE = "datasource.encryption.enable";
public static final String DATASOURCE_ENCRYPTION_SALT = "datasource.encryption.salt";
/**
* resource storage type
*/
/**
* kerberos
*/
public static final String KERBEROS = "kerberos";
/**
* kerberos expire time
*/
public static final String KERBEROS_EXPIRE_TIME = "kerberos.expire.time";
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java
|
/**
* java.security.krb5.conf
*/
public static final String JAVA_SECURITY_KRB5_CONF = "java.security.krb5.conf";
/**
* java.security.krb5.conf.path
*/
public static final String JAVA_SECURITY_KRB5_CONF_PATH = "java.security.krb5.conf.path";
/**
* loginUserFromKeytab user
*/
public static final String LOGIN_USER_KEY_TAB_USERNAME = "login.user.keytab.username";
/**
* loginUserFromKeytab path
*/
public static final String LOGIN_USER_KEY_TAB_PATH = "login.user.keytab.path";
/**
* hadoop.security.authentication
*/
public static final String HADOOP_SECURITY_AUTHENTICATION = "hadoop.security.authentication";
/**
* hadoop.security.authentication
*/
public static final String HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE =
"hadoop.security.authentication.startup.state";
/**
* Task Logger Thread's name
*/
public static final String TASK_LOGGER_THREAD_NAME = "TaskLogInfo";
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java
|
* hdfs/s3 configuration
* resource.storage.upload.base.path
*/
public static final String RESOURCE_UPLOAD_PATH = "resource.storage.upload.base.path";
/**
* data.quality.jar.name
*/
public static final String DATA_QUALITY_JAR_NAME = "data-quality.jar.name";
/**
* data.quality.error.output.path
*/
public static final String DATA_QUALITY_ERROR_OUTPUT_PATH = "data-quality.error.output.path";
public static final String TASK_TYPE_CONDITIONS = "CONDITIONS";
public static final String TASK_TYPE_SWITCH = "SWITCH";
public static final String TASK_TYPE_SUB_PROCESS = "SUB_PROCESS";
public static final String TASK_TYPE_DEPENDENT = "DEPENDENT";
public static final String TASK_TYPE_SQL = "SQL";
public static final String TASK_TYPE_DATA_QUALITY = "DATA_QUALITY";
public static final String TASK_TYPE_K8S = "K8S";
public static final String TASK_TYPE_BLOCKING = "BLOCKING";
public static final String TASK_TYPE_STREAM = "STREAM";
public static final List<String> COMPLEX_TASK_TYPES = Arrays
.asList(new String[]{TASK_TYPE_CONDITIONS, TASK_TYPE_SWITCH, TASK_TYPE_SUB_PROCESS, TASK_TYPE_DEPENDENT});
/**
* aws config
*/
public static final String AWS_ACCESS_KEY_ID = "resource.aws.access.key.id";
public static final String AWS_SECRET_ACCESS_KEY = "resource.aws.secret.access.key";
public static final String AWS_REGION = "resource.aws.region";
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/TaskConstants.java
|
* alibaba cloud config
*/
public static final String ALIBABA_CLOUD_ACCESS_KEY_ID = "resource.alibaba.cloud.access.key.id";
public static final String ALIBABA_CLOUD_ACCESS_KEY_SECRET = "resource.alibaba.cloud.access.key.secret";
public static final String ALIBABA_CLOUD_REGION = "resource.alibaba.cloud.region";
/**
* use for k8s task
*/
public static final String API_VERSION = "batch/v1";
public static final String IMAGE_PULL_POLICY = "Always";
public static final String RESTART_POLICY = "Never";
public static final String MEMORY = "memory";
public static final String CPU = "cpu";
public static final String LAYER_LABEL = "k8s.cn/layer";
public static final String LAYER_LABEL_VALUE = "batch";
public static final String NAME_LABEL = "k8s.cn/name";
public static final String TASK_INSTANCE_ID = "taskInstanceId";
public static final String MI = "Mi";
public static final int JOB_TTL_SECONDS = 300;
public static final int LOG_LINES = 500;
public static final String NAMESPACE_NAME = "name";
public static final String CLUSTER = "cluster";
/**
* conda config used by jupyter task plugin
*/
public static final String CONDA_PATH = "conda.path";
public static final Duration DEFAULT_LOOP_STATUS_INTERVAL = Duration.ofSeconds(5L);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.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.parser;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.ADD_CHAR;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.ADD_MONTHS;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.ADD_STRING;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.COMMA;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.DIVISION_CHAR;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.DIVISION_STRING;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.LEFT_BRACE_CHAR;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.LEFT_BRACE_STRING;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.MONTH_BEGIN;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.MONTH_END;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.MULTIPLY_CHAR;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.MULTIPLY_STRING;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.N;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.P;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.PARAMETER_FORMAT_TIME;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.RIGHT_BRACE_CHAR;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.SUBTRACT_CHAR;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.SUBTRACT_STRING;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TIMESTAMP;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.WEEK_BEGIN;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.WEEK_END;
import static org.apache.dolphinscheduler.spi.utils.DateUtils.addDays;
import static org.apache.dolphinscheduler.spi.utils.DateUtils.addMinutes;
import static org.apache.dolphinscheduler.spi.utils.DateUtils.addMonths;
import org.apache.dolphinscheduler.spi.utils.DateUtils;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* time place holder utils
*/
public class TimePlaceholderUtils {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
private static final Logger logger = LoggerFactory.getLogger(TimePlaceholderUtils.class);
/**
* Prefix of the position to be replaced
*/
public static final String PLACEHOLDER_PREFIX = "$[";
/**
* The suffix of the position to be replaced
*/
public static final String PLACEHOLDER_SUFFIX = "]";
/**
* Replaces all placeholders of format {@code ${name}} with the value returned
* from the supplied {@link PropertyPlaceholderHelper.PlaceholderResolver}.
*
* @param value the value containing the placeholders to be replaced
* @param date custom date
* @param ignoreUnresolvablePlaceholders ignore unresolvable placeholders
* @return the supplied value with placeholders replaced inline
*/
public static String replacePlaceholders(String value, Date date, boolean ignoreUnresolvablePlaceholders) {
PropertyPlaceholderHelper strictHelper = getPropertyPlaceholderHelper(false);
PropertyPlaceholderHelper nonStrictHelper = getPropertyPlaceholderHelper(true);
PropertyPlaceholderHelper helper = (ignoreUnresolvablePlaceholders ? nonStrictHelper : strictHelper);
return helper.replacePlaceholders(value, new TimePlaceholderResolver(value, date));
}
/**
* Creates a new {@code PropertyPlaceholderHelper} that uses the supplied prefix and suffix.
*
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
* @param ignoreUnresolvablePlaceholders indicates whether unresolvable placeholders should
* be ignored ({@code true}) or cause an exception ({@code false})
*/
private static PropertyPlaceholderHelper getPropertyPlaceholderHelper(boolean ignoreUnresolvablePlaceholders) {
return new PropertyPlaceholderHelper(PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, null, ignoreUnresolvablePlaceholders);
}
/**
* calculate expression's value
*
* @param expression expression
* @return expression's value
*/
public static Integer calculate(String expression) {
expression = StringUtils.trim(expression);
expression = convert(expression);
List<String> result = string2List(expression);
result = convert2SuffixList(result);
return calculate(result);
}
/**
* Change the sign in the expression to P (positive) N (negative)
*
* @param expression
* @return eg. "-3+-6*(+8)-(-5) -> S3+S6*(P8)-(S5)"
*/
private static String convert(String expression) {
char[] arr = expression.toCharArray();
for (int i = 0; i < arr.length; i++) {
if (arr[i] == SUBTRACT_CHAR) {
if (i == 0) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
arr[i] = N;
} else {
char c = arr[i - 1];
if (c == ADD_CHAR || c == SUBTRACT_CHAR || c == MULTIPLY_CHAR || c == DIVISION_CHAR || c == LEFT_BRACE_CHAR) {
arr[i] = N;
}
}
} else if (arr[i] == ADD_CHAR) {
if (i == 0) {
arr[i] = P;
} else {
char c = arr[i - 1];
if (c == ADD_CHAR || c == SUBTRACT_CHAR || c == MULTIPLY_CHAR || c == DIVISION_CHAR || c == LEFT_BRACE_CHAR) {
arr[i] = P;
}
}
}
}
return new String(arr);
}
/**
* to suffix expression
*
* @param srcList
* @return
*/
private static List<String> convert2SuffixList(List<String> srcList) {
List<String> result = new ArrayList<>();
Stack<String> stack = new Stack<>();
for (int i = 0; i < srcList.size(); i++) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
if (Character.isDigit(srcList.get(i).charAt(0))) {
result.add(srcList.get(i));
} else {
switch (srcList.get(i).charAt(0)) {
case LEFT_BRACE_CHAR:
stack.push(srcList.get(i));
break;
case RIGHT_BRACE_CHAR:
while (!LEFT_BRACE_STRING.equals(stack.peek())) {
result.add(stack.pop());
}
stack.pop();
break;
default:
while (!stack.isEmpty() && compare(stack.peek(), srcList.get(i))) {
result.add(stack.pop());
}
stack.push(srcList.get(i));
break;
}
}
}
while (!stack.isEmpty()) {
result.add(stack.pop());
}
return result;
}
/**
* Calculate the suffix expression
*
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
* @param result
* @return
*/
private static Integer calculate(List<String> result) {
Stack<Integer> stack = new Stack<>();
for (int i = 0; i < result.size(); i++) {
if (Character.isDigit(result.get(i).charAt(0))) {
stack.push(Integer.parseInt(result.get(i)));
} else {
Integer backInt = stack.pop();
Integer frontInt = 0;
char op = result.get(i).charAt(0);
if (!(op == P || op == N)) {
frontInt = stack.pop();
}
Integer res = 0;
switch (result.get(i).charAt(0)) {
case P:
res = frontInt + backInt;
break;
case N:
res = frontInt - backInt;
break;
case ADD_CHAR:
res = frontInt + backInt;
break;
case SUBTRACT_CHAR:
res = frontInt - backInt;
break;
case MULTIPLY_CHAR:
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
res = frontInt * backInt;
break;
case DIVISION_CHAR:
res = frontInt / backInt;
break;
default:
break;
}
stack.push(res);
}
}
return stack.pop();
}
/**
* string to list
*
* @param expression
* @return list
*/
private static List<String> string2List(String expression) {
List<String> result = new ArrayList<>();
String num = "";
for (int i = 0; i < expression.length(); i++) {
if (Character.isDigit(expression.charAt(i))) {
num = num + expression.charAt(i);
} else {
if (!num.isEmpty()) {
result.add(num);
}
result.add(expression.charAt(i) + "");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
num = "";
}
}
if (!num.isEmpty()) {
result.add(num);
}
return result;
}
/**
* compare loginUser level
*
* @param peek
* @param cur
* @return true or false
*/
private static boolean compare(String peek, String cur) {
if (MULTIPLY_STRING.equals(peek) && (DIVISION_STRING.equals(cur) || MULTIPLY_STRING.equals(cur) || ADD_STRING.equals(cur) || SUBTRACT_STRING.equals(cur))) {
return true;
} else if (DIVISION_STRING.equals(peek) && (DIVISION_STRING.equals(cur) || MULTIPLY_STRING.equals(cur) || ADD_STRING.equals(cur) || SUBTRACT_STRING.equals(cur))) {
return true;
} else if (ADD_STRING.equals(peek) && (ADD_STRING.equals(cur) || SUBTRACT_STRING.equals(cur))) {
return true;
} else {
return SUBTRACT_STRING.equals(peek) && (ADD_STRING.equals(cur) || SUBTRACT_STRING.equals(cur));
}
}
/**
* Placeholder replacement resolver
*/
private static class TimePlaceholderResolver implements
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
PropertyPlaceholderHelper.PlaceholderResolver {
private final String value;
private final Date date;
public TimePlaceholderResolver(String value, Date date) {
this.value = value;
this.date = date;
}
@Override
public String resolvePlaceholder(String placeholderName) {
try {
return calculateTime(placeholderName, date);
} catch (Exception ex) {
logger.error("resolve placeholder '{}' in [ {} ]", placeholderName, value, ex);
return null;
}
}
}
/**
* return the formatted date according to the corresponding date format
*
* @param expression date expression
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
* @param date date
* @return reformat date
*/
public static String getPlaceHolderTime(String expression, Date date) {
if (StringUtils.isBlank(expression)) {
return null;
}
if (null == date) {
return null;
}
return calculateTime(expression, date);
}
/**
* calculate time
*
* @param date date
* @return calculate time
*/
private static String calculateTime(String expression, Date date) {
String value;
try {
if (expression.startsWith(TIMESTAMP)) {
String timeExpression = expression.substring(TIMESTAMP.length() + 1, expression.length() - 1);
Map.Entry<Date, String> entry = calcTimeExpression(timeExpression, date);
String dateStr = DateUtils.format(entry.getKey(), entry.getValue());
Date timestamp = DateUtils.parse(dateStr, PARAMETER_FORMAT_TIME);
value = String.valueOf(timestamp.getTime() / 1000);
} else {
Map.Entry<Date, String> entry = calcTimeExpression(expression, date);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
value = DateUtils.format(entry.getKey(), entry.getValue());
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw e;
}
return value;
}
/**
* calculate time expresstion
*
* @param expression expresstion
* @param date date
* @return map with date, date format
*/
public static Map.Entry<Date, String> calcTimeExpression(String expression, Date date) {
Map.Entry<Date, String> resultEntry;
if (expression.startsWith(ADD_MONTHS)) {
resultEntry = calcMonths(expression, date);
} else if (expression.startsWith(MONTH_BEGIN)) {
resultEntry = calcMonthBegin(expression, date);
} else if (expression.startsWith(MONTH_END)) {
resultEntry = calcMonthEnd(expression, date);
} else if (expression.startsWith(WEEK_BEGIN)) {
resultEntry = calcWeekStart(expression, date);
} else if (expression.startsWith(WEEK_END)) {
resultEntry = calcWeekEnd(expression, date);
} else {
resultEntry = calcMinutes(expression, date);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
return resultEntry;
}
/**
* get first day of month
*
* @param expression expresstion
* @param date date
* @return first day of month
*/
public static Map.Entry<Date, String> calcMonthBegin(String expression, Date date) {
String addMonthExpr = expression.substring(MONTH_BEGIN.length() + 1, expression.length() - 1);
String[] params = addMonthExpr.split(COMMA);
if (params.length == 2) {
String dateFormat = params[0];
String dayExpr = params[1];
Integer day = calculate(dayExpr);
Date targetDate = DateUtils.getFirstDayOfMonth(date);
targetDate = addDays(targetDate, day);
return new AbstractMap.SimpleImmutableEntry<>(targetDate, dateFormat);
}
throw new RuntimeException("expression not valid");
}
/**
* get last day of month
*
* @param expression expresstion
* @param date date
* @return last day of month
*/
public static Map.Entry<Date, String> calcMonthEnd(String expression, Date date) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
String addMonthExpr = expression.substring(MONTH_END.length() + 1, expression.length() - 1);
String[] params = addMonthExpr.split(COMMA);
if (params.length == 2) {
String dateFormat = params[0];
String dayExpr = params[1];
Integer day = calculate(dayExpr);
Date targetDate = DateUtils.getLastDayOfMonth(date);
targetDate = addDays(targetDate, day);
return new AbstractMap.SimpleImmutableEntry<>(targetDate, dateFormat);
}
throw new RuntimeException("expression not valid");
}
/**
* get first day of week
*
* @param expression expresstion
* @param date date
* @return monday
*/
public static Map.Entry<Date, String> calcWeekStart(String expression, Date date) {
String addMonthExpr = expression.substring(WEEK_BEGIN.length() + 1, expression.length() - 1);
String[] params = addMonthExpr.split(COMMA);
if (params.length == 2) {
String dateFormat = params[0];
String dayExpr = params[1];
Integer day = calculate(dayExpr);
Date targetDate = DateUtils.getMonday(date);
targetDate = addDays(targetDate, day);
return new AbstractMap.SimpleImmutableEntry<>(targetDate, dateFormat);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
throw new RuntimeException("expression not valid");
}
/**
* get last day of week
*
* @param expression expresstion
* @param date date
* @return last day of week
*/
public static Map.Entry<Date, String> calcWeekEnd(String expression, Date date) {
String addMonthExpr = expression.substring(WEEK_END.length() + 1, expression.length() - 1);
String[] params = addMonthExpr.split(COMMA);
if (params.length == 2) {
String dateFormat = params[0];
String dayExpr = params[1];
Integer day = calculate(dayExpr);
Date targetDate = DateUtils.getSunday(date);
targetDate = addDays(targetDate, day);
return new AbstractMap.SimpleImmutableEntry<>(targetDate, dateFormat);
}
throw new RuntimeException("Expression not valid");
}
/**
* calc months expression
*
* @param expression expresstion
* @param date date
* @return calc months
*/
public static Map.Entry<Date, String> calcMonths(String expression, Date date) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
String addMonthExpr = expression.substring(ADD_MONTHS.length() + 1, expression.length() - 1);
String[] params = addMonthExpr.split(COMMA);
if (params.length == 2) {
String dateFormat = params[0];
String monthExpr = params[1];
Integer addMonth = calculate(monthExpr);
Date targetDate = addMonths(date, addMonth);
return new AbstractMap.SimpleImmutableEntry<>(targetDate, dateFormat);
}
throw new RuntimeException("expression not valid");
}
/**
* calculate time expression
*
* @param expression expresstion
* @param date date
* @return calculate time expression with date,format
*/
public static Map.Entry<Date, String> calcMinutes(String expression, Date date) {
if (expression.contains("+")) {
int index = expression.lastIndexOf('+');
if (Character.isDigit(expression.charAt(index + 1))) {
String addMinuteExpr = expression.substring(index + 1);
Date targetDate = addMinutes(date, calcMinutes(addMinuteExpr));
String dateFormat = expression.substring(0, index);
return new AbstractMap.SimpleImmutableEntry<>(targetDate, dateFormat);
}
} else if (expression.contains("-")) {
int index = expression.lastIndexOf('-');
if (Character.isDigit(expression.charAt(index + 1))) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,608 |
[Improvement][task-plugin] New time variables are added to facilitate business development
|
### 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
In the process of data development, the original time variable provided by the dolphin scheduler needs to do many secondary calculations to obtain the available business time. I want to provide more convenient time variables for business development. for example:
**First day of the month**: $[month_first_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_first_day(yyyy-MM-dd,-1)]
**Last day of the month**: $[month_last_day(yyyy-MM-dd,offset)] offset = month ,such as $[month_last_day(yyyy-MM-dd,-1)]
**First day of the week**: $[week_first_day(yyyy-MM-dd, offset)] offset = week, such as $[week_first_day(yyyy-MM-dd,-1)]
**Last day of the week**: $[week_last_day(yyyy-MM-dd, offset)] offset = week, such as $[week_last_day(yyyy-MM-dd,-1)]
I will also provide more time variables with business attributes
### 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/11608
|
https://github.com/apache/dolphinscheduler/pull/11667
|
151c2d2c70c652a72b864d9007b239c22706b94d
|
779a0b9c75f648a02d86756f06ff7856b8a74873
| 2022-08-23T03:04:25Z |
java
| 2022-09-26T08:01:32Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TimePlaceholderUtils.java
|
String addMinuteExpr = expression.substring(index + 1);
Date targetDate = addMinutes(date, 0 - calcMinutes(addMinuteExpr));
String dateFormat = expression.substring(0, index);
return new AbstractMap.SimpleImmutableEntry<>(targetDate, dateFormat);
}
return new AbstractMap.SimpleImmutableEntry<>(date, expression);
}
return new AbstractMap.SimpleImmutableEntry<>(date, expression);
}
/**
* calculate need minutes
*
* @param minuteExpression minute expression
* @return calculate need minutes
*/
public static Integer calcMinutes(String minuteExpression) {
int index = minuteExpression.indexOf('/');
String calcExpression;
if (index == -1) {
calcExpression = String.format("60*24*(%s)", minuteExpression);
} else {
calcExpression = String.format("60*24*(%s)%s", minuteExpression.substring(0, index),
minuteExpression.substring(index));
}
return calculate(calcExpression);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/SubProcessTaskTest.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.master;
import org.apache.dolphinscheduler.common.enums.TimeoutFlag;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/SubProcessTaskTest.java
|
import org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager;
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.AlertDao;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.plugin.task.api.enums.Direct;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.master.runner.task.SubTaskProcessor;
import org.apache.dolphinscheduler.server.master.runner.task.TaskAction;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.springframework.context.ApplicationContext;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
@RunWith(PowerMockRunner.class)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/SubProcessTaskTest.java
|
@PrepareForTest({ServerLifeCycleManager.class})
public class SubProcessTaskTest {
/**
* TaskNode.runFlag : task can be run normally
*/
public static final String FLOWNODE_RUN_FLAG_NORMAL = "NORMAL";
private ProcessService processService;
private ProcessInstance processInstance;
@Before
public void before() {
ApplicationContext applicationContext = Mockito.mock(ApplicationContext.class);
SpringApplicationContext springApplicationContext = new SpringApplicationContext();
springApplicationContext.setApplicationContext(applicationContext);
MasterConfig config = new MasterConfig();
Mockito.when(applicationContext.getBean(MasterConfig.class)).thenReturn(config);
config.setTaskCommitRetryTimes(3);
config.setTaskCommitInterval(Duration.ofSeconds(1));
PowerMockito.mockStatic(ServerLifeCycleManager.class);
PowerMockito.when(ServerLifeCycleManager.isStopped()).thenReturn(false);
processService = Mockito.mock(ProcessService.class);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/SubProcessTaskTest.java
|
Mockito.when(applicationContext.getBean(ProcessService.class)).thenReturn(processService);
AlertDao alertDao = Mockito.mock(AlertDao.class);
Mockito.when(applicationContext.getBean(AlertDao.class)).thenReturn(alertDao);
processInstance = getProcessInstance();
TaskInstance taskInstance = getTaskInstance();
Mockito.when(processService
.findProcessInstanceById(processInstance.getId()))
.thenReturn(processInstance);
Mockito.when(processService
.updateTaskInstance(Mockito.any()))
.thenReturn(true);
Mockito.when(processService
.submitTask(processInstance, taskInstance))
.thenAnswer(t -> t.getArgument(0));
TaskDefinition taskDefinition = new TaskDefinition();
taskDefinition.setTimeoutFlag(TimeoutFlag.OPEN);
taskDefinition.setTimeoutNotifyStrategy(TaskTimeoutStrategy.WARN);
taskDefinition.setTimeout(0);
Mockito.when(processService.findTaskDefinition(1L, 1))
.thenReturn(taskDefinition);
}
private TaskInstance testBasicInit(WorkflowExecutionStatus expectResult) {
TaskInstance taskInstance = getTaskInstance(getTaskNode(), processInstance);
ProcessInstance subProcessInstance = getSubProcessInstance(expectResult);
subProcessInstance.setVarPool(getProperty());
Mockito.when(processService
.findProcessInstanceById(subProcessInstance.getId()))
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/SubProcessTaskTest.java
|
.thenReturn(subProcessInstance);
Mockito.when(processService
.findSubProcessInstance(processInstance.getId(), taskInstance.getId()))
.thenReturn(subProcessInstance);
return taskInstance;
}
@Test
public void testBasicSuccess() {
TaskInstance taskInstance = testBasicInit(WorkflowExecutionStatus.SUCCESS);
}
@Test
public void testFinish() {
TaskInstance taskInstance = testBasicInit(WorkflowExecutionStatus.SUCCESS);
taskInstance.setVarPool(getProperty());
taskInstance.setTaskParams("{\"processDefinitionCode\":110," +
"\"dependence\":{},\"localParams\":[{\"prop\":\"key\"," +
"\"direct\":\"out\",\"type\":\"VARCHAR\",\"value\":\"\"}," +
"{\"prop\":\"database_name\",\"direct\":\"OUT\"," +
"\"type\":\"VARCHAR\",\"value\":\"\"}]," +
"\"conditionResult\":{\"successNode\":[],\"failedNode\":[]}," +
"\"waitStartTimeout\":{},\"switchResult\":{}}");
SubTaskProcessor subTaskProcessor = new SubTaskProcessor();
subTaskProcessor.init(taskInstance, processInstance);
subTaskProcessor.action(TaskAction.RUN);
TaskExecutionStatus status = taskInstance.getState();
Assert.assertEquals(TaskExecutionStatus.SUCCESS, status);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/SubProcessTaskTest.java
|
private String getProperty() {
List<Property> varPools = new ArrayList<>();
Property property = new Property();
property.setProp("key");
property.setValue("1");
property.setDirect(Direct.OUT);
varPools.add(property);
return JSONUtils.toJsonString(varPools);
}
@Test
public void testBasicFailure() {
TaskInstance taskInstance = testBasicInit(WorkflowExecutionStatus.FAILURE);
}
private TaskNode getTaskNode() {
TaskNode taskNode = new TaskNode();
taskNode.setId("tasks-10");
taskNode.setName("S");
taskNode.setCode(1L);
taskNode.setVersion(1);
taskNode.setType("SUB_PROCESS");
taskNode.setRunFlag(FLOWNODE_RUN_FLAG_NORMAL);
return taskNode;
}
private ProcessInstance getProcessInstance() {
ProcessInstance processInstance = new ProcessInstance();
processInstance.setId(100);
processInstance.setState(WorkflowExecutionStatus.RUNNING_EXECUTION);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/SubProcessTaskTest.java
|
processInstance.setWarningGroupId(0);
processInstance.setName("S");
return processInstance;
}
private TaskInstance getTaskInstance() {
TaskInstance taskInstance = new TaskInstance();
taskInstance.setId(1000);
return taskInstance;
}
private ProcessInstance getSubProcessInstance(WorkflowExecutionStatus executionStatus) {
ProcessInstance processInstance = new ProcessInstance();
processInstance.setId(102);
processInstance.setState(executionStatus);
return processInstance;
}
private TaskInstance getTaskInstance(TaskNode taskNode, ProcessInstance processInstance) {
TaskInstance taskInstance = new TaskInstance();
taskInstance.setId(1000);
taskInstance.setName("S");
taskInstance.setTaskType("SUB_PROCESS");
taskInstance.setName(taskNode.getName());
taskInstance.setTaskCode(taskNode.getCode());
taskInstance.setTaskDefinitionVersion(taskNode.getVersion());
taskInstance.setTaskType(taskNode.getType().toUpperCase());
taskInstance.setProcessInstanceId(processInstance.getId());
taskInstance.setState(TaskExecutionStatus.SUBMITTED_SUCCESS);
return taskInstance;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/CacheProcessorTest.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.processor;
import org.apache.dolphinscheduler.common.enums.CacheType;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.remote.command.CacheExpireCommand;
import org.apache.dolphinscheduler.remote.command.Command;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.powermock.modules.junit4.PowerMockRunner;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/CacheProcessorTest.java
|
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import io.netty.channel.Channel;
/**
* task ack processor test
*/
@RunWith(PowerMockRunner.class)
public class CacheProcessorTest {
@InjectMocks
private CacheProcessor cacheProcessor = new CacheProcessor();
@Mock
private Channel channel;
@Mock
private CacheManager cacheManager;
@Mock
private Cache cache;
@Before
public void before() {
Mockito.when(cacheManager.getCache(CacheType.TENANT.getCacheName())).thenReturn(cache);
}
@Test
public void testProcess() {
Tenant tenant = new Tenant();
tenant.setId(1);
CacheExpireCommand cacheExpireCommand = new CacheExpireCommand(CacheType.TENANT, "1");
Command command = cacheExpireCommand.convert2Command();
cacheProcessor.process(channel, command);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/TaskAckProcessorTest.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.processor;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus;
import org.apache.dolphinscheduler.remote.command.TaskExecuteRunningCommand;
import org.apache.dolphinscheduler.server.master.processor.queue.TaskEvent;
import org.apache.dolphinscheduler.server.master.processor.queue.TaskEventService;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/TaskAckProcessorTest.java
|
import org.apache.dolphinscheduler.service.process.ProcessService;
import java.util.Date;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import io.netty.channel.Channel;
/**
* task ack processor test
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({SpringApplicationContext.class, TaskEvent.class})
public class TaskAckProcessorTest {
private TaskExecuteRunningProcessor taskExecuteRunningProcessor;
private TaskEventService taskEventService;
private ProcessService processService;
private TaskExecuteRunningCommand taskExecuteRunningMessage;
private TaskEvent taskResponseEvent;
private Channel channel;
@Before
public void before() {
PowerMockito.mockStatic(SpringApplicationContext.class);
taskEventService = PowerMockito.mock(TaskEventService.class);
PowerMockito.when(SpringApplicationContext.getBean(TaskEventService.class)).thenReturn(taskEventService);
processService = PowerMockito.mock(ProcessService.class);
PowerMockito.when(SpringApplicationContext.getBean(ProcessService.class)).thenReturn(processService);
taskExecuteRunningProcessor = new TaskExecuteRunningProcessor();
channel = PowerMockito.mock(Channel.class);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/TaskAckProcessorTest.java
|
taskResponseEvent = PowerMockito.mock(TaskEvent.class);
taskExecuteRunningMessage = new TaskExecuteRunningCommand("127.0.0.1:5678",
" 127.0.0.1:1234",
System.currentTimeMillis());
taskExecuteRunningMessage.setStatus(TaskExecutionStatus.RUNNING_EXECUTION);
taskExecuteRunningMessage.setExecutePath("/dolphinscheduler/worker");
taskExecuteRunningMessage.setHost("localhost");
taskExecuteRunningMessage.setLogPath("/temp/worker.log");
taskExecuteRunningMessage.setStartTime(new Date());
taskExecuteRunningMessage.setTaskInstanceId(1);
taskExecuteRunningMessage.setProcessInstanceId(1);
}
@Test
public void testProcess() {
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/TaskKillResponseProcessorTest.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.processor;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus;
import org.apache.dolphinscheduler.remote.command.Command;
import org.apache.dolphinscheduler.remote.command.CommandType;
import org.apache.dolphinscheduler.remote.command.TaskKillResponseCommand;
import java.util.ArrayList;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.powermock.api.mockito.PowerMockito;
import io.netty.channel.Channel;
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/TaskKillResponseProcessorTest.java
|
* task response processor test
*/
public class TaskKillResponseProcessorTest {
private TaskKillResponseProcessor taskKillResponseProcessor;
private TaskKillResponseCommand taskKillResponseCommand;
private Channel channel;
@Before
public void before() {
taskKillResponseProcessor = new TaskKillResponseProcessor();
channel = PowerMockito.mock(Channel.class);
taskKillResponseCommand = new TaskKillResponseCommand();
taskKillResponseCommand.setAppIds(
new ArrayList<String>() {
{
add("task_1");
}
});
taskKillResponseCommand.setHost("localhost");
taskKillResponseCommand.setProcessId(1);
taskKillResponseCommand.setStatus(TaskExecutionStatus.RUNNING_EXECUTION);
taskKillResponseCommand.setTaskInstanceId(1);
}
@Test
public void testProcess() {
Command command = taskKillResponseCommand.convert2Command();
Assert.assertEquals(CommandType.TASK_KILL_RESPONSE, command.getType());
taskKillResponseProcessor.process(channel, command);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClientTest.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClientTest.java
|
*/
package org.apache.dolphinscheduler.server.master.registry;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.doNothing;
import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.NodeType;
import org.apache.dolphinscheduler.common.model.Server;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.master.task.MasterHeartBeatTask;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.registry.RegistryClient;
import java.util.Arrays;
import java.util.Date;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.springframework.test.util.ReflectionTestUtils;
/**
* MasterRegistryClientTest
*/
@RunWith(PowerMockRunner.class)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClientTest.java
|
@PrepareForTest({RegistryClient.class})
@PowerMockIgnore({"javax.management.*"})
public class MasterRegistryClientTest {
@InjectMocks
private MasterRegistryClient masterRegistryClient;
@Mock
private RegistryClient registryClient;
@Mock
private ProcessService processService;
@Mock
private MasterHeartBeatTask masterHeartBeatTask;
@Mock
private MasterConfig masterConfig;
@Before
public void before() throws Exception {
given(registryClient.getLock(Mockito.anyString())).willReturn(true);
given(registryClient.releaseLock(Mockito.anyString())).willReturn(true);
given(registryClient.getHostByEventDataPath(Mockito.anyString())).willReturn("127.0.0.1:8080");
given(registryClient.getStoppable()).willReturn(cause -> {
});
ReflectionTestUtils.setField(masterRegistryClient, "registryClient", registryClient);
ReflectionTestUtils.setField(masterRegistryClient, "masterHeartBeatTask", masterHeartBeatTask);
ProcessInstance processInstance = new ProcessInstance();
processInstance.setId(1);
processInstance.setHost("127.0.0.1:8080");
processInstance.setRestartTime(new Date());
processInstance.setHistoryCmd("xxx");
processInstance.setCommandType(CommandType.STOP);
given(processService.queryNeedFailoverProcessInstances(Mockito.anyString()))
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClientTest.java
|
.willReturn(Arrays.asList(processInstance));
doNothing().when(processService).processNeedFailoverProcessInstances(Mockito.any(ProcessInstance.class));
TaskInstance taskInstance = new TaskInstance();
taskInstance.setId(1);
taskInstance.setStartTime(new Date());
taskInstance.setHost("127.0.0.1:8080");
given(processService.queryNeedFailoverTaskInstances(Mockito.anyString()))
.willReturn(Arrays.asList(taskInstance));
given(processService.findProcessInstanceDetailById(Mockito.anyInt())).willReturn(Optional.of(processInstance));
given(registryClient.checkNodeExists(Mockito.anyString(), Mockito.any())).willReturn(true);
Server server = new Server();
server.setHost("127.0.0.1");
server.setPort(8080);
server.setCreateTime(new Date());
given(registryClient.getServerList(NodeType.WORKER)).willReturn(Arrays.asList(server));
given(registryClient.getServerList(NodeType.MASTER)).willReturn(Arrays.asList(server));
}
@Test
public void registryTest() {
masterRegistryClient.registry();
}
@Test
public void removeNodePathTest() {
masterRegistryClient.removeMasterNodePath("/path", NodeType.MASTER, false);
masterRegistryClient.removeMasterNodePath("/path", NodeType.MASTER, true);
masterRegistryClient.removeWorkerNodePath("/path", NodeType.WORKER, true);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/MasterTaskExecThreadTest.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.master.runner;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.common.enums.TimeoutFlag;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.apache.dolphinscheduler.service.process.ProcessService;
import java.util.HashSet;
import java.util.Set;
import org.junit.Before;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/MasterTaskExecThreadTest.java
|
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.powermock.api.mockito.PowerMockito;
import org.springframework.context.ApplicationContext;
@RunWith(MockitoJUnitRunner.Silent.class)
@Ignore
public class MasterTaskExecThreadTest {
private SpringApplicationContext springApplicationContext;
@Before
public void setUp() {
ApplicationContext applicationContext = PowerMockito.mock(ApplicationContext.class);
this.springApplicationContext = new SpringApplicationContext();
springApplicationContext.setApplicationContext(applicationContext);
ProcessService processService = Mockito.mock(ProcessService.class);
Mockito.when(SpringApplicationContext.getBean(ProcessService.class))
.thenReturn(processService);
TaskDefinition taskDefinition = new TaskDefinition();
taskDefinition.setTimeoutFlag(TimeoutFlag.OPEN);
taskDefinition.setTimeoutNotifyStrategy(TaskTimeoutStrategy.WARN);
taskDefinition.setTimeout(0);
Mockito.when(processService.findTaskDefinition(1L, 1))
.thenReturn(taskDefinition);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/MasterTaskExecThreadTest.java
|
@Test
public void testExistsValidWorkerGroup1() {
/*
* Mockito.when(registryCenter.getWorkerGroupDirectly()).thenReturn(Sets.newHashSet()); boolean b =
* masterTaskExecThread.existsValidWorkerGroup("default"); Assert.assertFalse(b);
*/
}
@Test
public void testExistsValidWorkerGroup2() {
Set<String> workerGroups = new HashSet<>();
workerGroups.add("test1");
workerGroups.add("test2");
/*
* Mockito.when(registryCenter.getWorkerGroupDirectly()).thenReturn(workerGroups); boolean b =
* masterTaskExecThread.existsValidWorkerGroup("default"); Assert.assertFalse(b);
*/
}
@Test
public void testExistsValidWorkerGroup3() {
Set<String> workerGroups = new HashSet<>();
workerGroups.add("test1");
/*
* Mockito.when(registryCenter.getWorkerGroupDirectly()).thenReturn(workerGroups);
* Mockito.when(registryCenter.getWorkerGroupNodesDirectly("test1")).thenReturn(workerGroups); boolean b =
* masterTaskExecThread.existsValidWorkerGroup("test1"); Assert.assertTrue(b);
*/
}
@Test
public void testPauseTask() {
ProcessService processService = Mockito.mock(ProcessService.class);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/MasterTaskExecThreadTest.java
|
Mockito.when(SpringApplicationContext.getBean(ProcessService.class))
.thenReturn(processService);
TaskInstance taskInstance = getTaskInstance();
Mockito.when(processService.findTaskInstanceById(252612))
.thenReturn(taskInstance);
Mockito.when(processService.updateTaskInstance(taskInstance))
.thenReturn(true);
TaskDefinition taskDefinition = new TaskDefinition();
taskDefinition.setTimeoutFlag(TimeoutFlag.OPEN);
taskDefinition.setTimeoutNotifyStrategy(TaskTimeoutStrategy.WARN);
taskDefinition.setTimeout(0);
Mockito.when(processService.findTaskDefinition(1L, 1))
.thenReturn(taskDefinition);
}
private TaskInstance getTaskInstance() {
TaskInstance taskInstance = new TaskInstance();
taskInstance.setTaskType("SHELL");
taskInstance.setId(252612);
taskInstance.setName("C");
taskInstance.setProcessInstanceId(10111);
taskInstance.setState(TaskExecutionStatus.SUBMITTED_SUCCESS);
taskInstance.setTaskCode(1L);
taskInstance.setTaskDefinitionVersion(1);
return taskInstance;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnableTest.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
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnableTest.java
|
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.master.runner;
import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE;
import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_RECOVERY_START_NODE_STRING;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_START_NODES;
import static org.powermock.api.mockito.PowerMockito.mock;
import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum;
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus;
import org.apache.dolphinscheduler.common.graph.DAG;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.Schedule;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.repository.ProcessInstanceDao;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.master.dispatch.executor.NettyExecutorManager;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnableTest.java
|
import org.apache.dolphinscheduler.service.alert.ProcessAlertManager;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.apache.dolphinscheduler.service.expand.CuringParamsService;
import org.apache.dolphinscheduler.service.process.ProcessService;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.springframework.context.ApplicationContext;
/**
* test for WorkflowExecuteThread
*/
@RunWith(PowerMockRunner.class)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnableTest.java
|
@PrepareForTest({WorkflowExecuteRunnable.class})
public class WorkflowExecuteRunnableTest {
private WorkflowExecuteRunnable workflowExecuteThread;
private ProcessInstance processInstance;
private ProcessService processService;
private ProcessInstanceDao processInstanceDao;
private MasterConfig config;
private ApplicationContext applicationContext;
private StateWheelExecuteThread stateWheelExecuteThread;
private CuringParamsService curingGlobalParamsService;
@Before
public void init() throws Exception {
applicationContext = mock(ApplicationContext.class);
SpringApplicationContext springApplicationContext = new SpringApplicationContext();
springApplicationContext.setApplicationContext(applicationContext);
config = new MasterConfig();
Mockito.when(applicationContext.getBean(MasterConfig.class)).thenReturn(config);
processService = mock(ProcessService.class);
Mockito.when(applicationContext.getBean(ProcessService.class)).thenReturn(processService);
processInstanceDao = mock(ProcessInstanceDao.class);
processInstance = mock(ProcessInstance.class);
Mockito.when(processInstance.getState()).thenReturn(WorkflowExecutionStatus.SUCCESS);
Mockito.when(processInstance.getHistoryCmd()).thenReturn(CommandType.COMPLEMENT_DATA.toString());
Mockito.when(processInstance.getIsSubProcess()).thenReturn(Flag.NO);
Mockito.when(processInstance.getScheduleTime()).thenReturn(DateUtils.stringToDate("2020-01-01 00:00:00"));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnableTest.java
|
Map<String, String> cmdParam = new HashMap<>();
cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, "2020-01-01 00:00:00");
cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, "2020-01-20 23:00:00");
Mockito.when(processInstance.getCommandParam()).thenReturn(JSONUtils.toJsonString(cmdParam));
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.setGlobalParamMap(Collections.emptyMap());
processDefinition.setGlobalParamList(Collections.emptyList());
Mockito.when(processInstance.getProcessDefinition()).thenReturn(processDefinition);
stateWheelExecuteThread = mock(StateWheelExecuteThread.class);
curingGlobalParamsService = mock(CuringParamsService.class);
NettyExecutorManager nettyExecutorManager = mock(NettyExecutorManager.class);
ProcessAlertManager processAlertManager = mock(ProcessAlertManager.class);
workflowExecuteThread = PowerMockito.spy(
new WorkflowExecuteRunnable(processInstance, processService, processInstanceDao, nettyExecutorManager,
processAlertManager, config, stateWheelExecuteThread, curingGlobalParamsService));
Field dag = WorkflowExecuteRunnable.class.getDeclaredField("dag");
dag.setAccessible(true);
dag.set(workflowExecuteThread, new DAG());
PowerMockito.doNothing().when(workflowExecuteThread, "endProcess");
}
@Test
public void testParseStartNodeName() throws ParseException {
try {
Map<String, String> cmdParam = new HashMap<>();
cmdParam.put(CMD_PARAM_START_NODES, "1,2,3");
Mockito.when(processInstance.getCommandParam()).thenReturn(JSONUtils.toJsonString(cmdParam));
Class<WorkflowExecuteRunnable> masterExecThreadClass = WorkflowExecuteRunnable.class;
Method method = masterExecThreadClass.getDeclaredMethod("parseStartNodeName", String.class);
method.setAccessible(true);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnableTest.java
|
List<String> nodeNames =
(List<String>) method.invoke(workflowExecuteThread, JSONUtils.toJsonString(cmdParam));
Assert.assertEquals(3, nodeNames.size());
} catch (Exception e) {
Assert.fail();
}
}
@Test
public void testGetStartTaskInstanceList() {
try {
TaskInstance taskInstance1 = new TaskInstance();
taskInstance1.setId(1);
TaskInstance taskInstance2 = new TaskInstance();
taskInstance2.setId(2);
TaskInstance taskInstance3 = new TaskInstance();
taskInstance3.setId(3);
TaskInstance taskInstance4 = new TaskInstance();
taskInstance4.setId(4);
Map<String, String> cmdParam = new HashMap<>();
cmdParam.put(CMD_PARAM_RECOVERY_START_NODE_STRING, "1,2,3,4");
Mockito.when(processService.findTaskInstanceByIdList(
Arrays.asList(taskInstance1.getId(), taskInstance2.getId(), taskInstance3.getId(),
taskInstance4.getId())))
.thenReturn(Arrays.asList(taskInstance1, taskInstance2, taskInstance3, taskInstance4));
Class<WorkflowExecuteRunnable> masterExecThreadClass = WorkflowExecuteRunnable.class;
Method method = masterExecThreadClass.getDeclaredMethod("getRecoverTaskInstanceList", String.class);
method.setAccessible(true);
List<TaskInstance> taskInstances =
workflowExecuteThread.getRecoverTaskInstanceList(JSONUtils.toJsonString(cmdParam));
Assert.assertEquals(4, taskInstances.size());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnableTest.java
|
cmdParam.put(CMD_PARAM_RECOVERY_START_NODE_STRING, "1");
List<TaskInstance> taskInstanceEmpty =
(List<TaskInstance>) method.invoke(workflowExecuteThread, JSONUtils.toJsonString(cmdParam));
Assert.assertTrue(taskInstanceEmpty.isEmpty());
} catch (Exception e) {
Assert.fail();
}
}
@Test
public void testGetPreVarPool() {
try {
Set<String> preTaskName = new HashSet<>();
preTaskName.add(Long.toString(1));
preTaskName.add(Long.toString(2));
TaskInstance taskInstance = new TaskInstance();
TaskInstance taskInstance1 = new TaskInstance();
taskInstance1.setId(1);
taskInstance1.setTaskCode(1);
taskInstance1.setVarPool("[{\"direct\":\"OUT\",\"prop\":\"test1\",\"type\":\"VARCHAR\",\"value\":\"1\"}]");
taskInstance1.setEndTime(new Date());
TaskInstance taskInstance2 = new TaskInstance();
taskInstance2.setId(2);
taskInstance2.setTaskCode(2);
taskInstance2.setVarPool("[{\"direct\":\"OUT\",\"prop\":\"test2\",\"type\":\"VARCHAR\",\"value\":\"2\"}]");
taskInstance2.setEndTime(new Date());
Map<Integer, TaskInstance> taskInstanceMap = new ConcurrentHashMap<>();
taskInstanceMap.put(taskInstance1.getId(), taskInstance1);
taskInstanceMap.put(taskInstance2.getId(), taskInstance2);
Map<Long, Integer> completeTaskList = new ConcurrentHashMap<>();
completeTaskList.put(taskInstance1.getTaskCode(), taskInstance1.getId());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnableTest.java
|
completeTaskList.put(taskInstance2.getTaskCode(), taskInstance2.getId());
Class<WorkflowExecuteRunnable> masterExecThreadClass = WorkflowExecuteRunnable.class;
Field completeTaskMapField = masterExecThreadClass.getDeclaredField("completeTaskMap");
completeTaskMapField.setAccessible(true);
completeTaskMapField.set(workflowExecuteThread, completeTaskList);
Field taskInstanceMapField = masterExecThreadClass.getDeclaredField("taskInstanceMap");
taskInstanceMapField.setAccessible(true);
taskInstanceMapField.set(workflowExecuteThread, taskInstanceMap);
workflowExecuteThread.getPreVarPool(taskInstance, preTaskName);
Assert.assertNotNull(taskInstance.getVarPool());
taskInstance2.setVarPool("[{\"direct\":\"OUT\",\"prop\":\"test1\",\"type\":\"VARCHAR\",\"value\":\"2\"}]");
completeTaskList.put(taskInstance2.getTaskCode(), taskInstance2.getId());
completeTaskMapField.setAccessible(true);
completeTaskMapField.set(workflowExecuteThread, completeTaskList);
taskInstanceMapField.setAccessible(true);
taskInstanceMapField.set(workflowExecuteThread, taskInstanceMap);
workflowExecuteThread.getPreVarPool(taskInstance, preTaskName);
Assert.assertNotNull(taskInstance.getVarPool());
} catch (Exception e) {
Assert.fail();
}
}
@Test
public void testCheckSerialProcess() {
try {
ProcessDefinition processDefinition1 = new ProcessDefinition();
processDefinition1.setId(123);
processDefinition1.setName("test");
processDefinition1.setVersion(1);
processDefinition1.setCode(11L);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,124 |
[Improvement][Test] Remove `Powermock` in `dolphinscheduler-master`
|
### 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
- Remove `Powermock` in `dolphinscheduler-master`
- This is a sub-task of #11405
### 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/12124
|
https://github.com/apache/dolphinscheduler/pull/12143
|
4269fa7ea7a83c7f5d7fd7d4db0d4a069eb4e9fc
|
cc82206c33cc60cd71ebfe7b327e8cc4110bd15d
| 2022-09-23T09:10:12Z |
java
| 2022-09-26T09:02:14Z |
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnableTest.java
|
processDefinition1.setExecutionType(ProcessExecutionTypeEnum.SERIAL_WAIT);
Mockito.when(processInstance.getId()).thenReturn(225);
Mockito.when(processService.findProcessInstanceById(225)).thenReturn(processInstance);
workflowExecuteThread.checkSerialProcess(processDefinition1);
Mockito.when(processInstance.getId()).thenReturn(225);
Mockito.when(processInstance.getNextProcessInstanceId()).thenReturn(222);
ProcessInstance processInstance9 = new ProcessInstance();
processInstance9.setId(222);
processInstance9.setProcessDefinitionCode(11L);
processInstance9.setProcessDefinitionVersion(1);
processInstance9.setState(WorkflowExecutionStatus.SERIAL_WAIT);
Mockito.when(processService.findProcessInstanceById(225)).thenReturn(processInstance);
Mockito.when(processService.findProcessInstanceById(222)).thenReturn(processInstance9);
workflowExecuteThread.checkSerialProcess(processDefinition1);
} catch (Exception e) {
Assert.fail();
}
}
private List<Schedule> zeroSchedulerList() {
return Collections.emptyList();
}
private List<Schedule> oneSchedulerList() {
List<Schedule> schedulerList = new LinkedList<>();
Schedule schedule = new Schedule();
schedule.setCrontab("0 0 0 1/2 * ?");
schedulerList.add(schedule);
return schedulerList;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.