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 | 11,034 | [Bug] [Task Plugin] Unable to pass parameters | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
workflow:
<img width="742" alt="image" src="https://user-images.githubusercontent.com/31528124/179495220-3fb6f976-7ae8-4abb-b204-9ef4ebc76acf.png">
out task
<img width="500" alt="image" src="https://user-images.githubusercontent.com/31528124/179495280-8c853bbd-4133-477d-a8c4-26d97563c7f1.png">
in task
<img width="492" alt="image" src="https://user-images.githubusercontent.com/31528124/179495331-7bfbd58d-6389-49df-b122-1568917d91a3.png">
Below is the run log
out task
<img width="343" alt="image" src="https://user-images.githubusercontent.com/31528124/179495439-d1cbddbc-feb4-410c-8810-25f42e308bc4.png">
in task
<img width="249" alt="image" src="https://user-images.githubusercontent.com/31528124/179495492-6e9d5127-bfac-46a3-a24e-c835dfc02784.png">
### What you expected to happen
the message of in task instance should be
```shell
in1
137 /home/lucky/.bashrc
in2
123
in3
```
### How to reproduce
As shown above
### Anything else
Doc : https://dolphinscheduler.apache.org/en-us/docs/latest/user_doc/guide/parameter/local.html
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11034 | https://github.com/apache/dolphinscheduler/pull/11053 | 878cbbc1590de3973b5734bdbe107e252ef14314 | 65d2b8f14e420ef35cc33c6e02cf3c622f969f0b | 2022-07-18T10:47:13Z | java | 2022-07-20T02:14:51Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/expand/CuringGlobalParams.java | }
if (localParams.size() != 0) {
globalParams.putAll(localParams);
}
Iterator<Map.Entry<String, Property>> iter = globalParams.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, Property> en = iter.next();
Property property = en.getValue();
if (StringUtils.isNotEmpty(property.getValue()) && property.getValue().startsWith(Constants.FUNCTION_START_WITH)) {
/**
* local parameter refers to global parameter with the same name
* note: the global parameters of the process instance here are solidified parameters,
* and there are no variables in them.
*/
String val = property.getValue();
if (timeFunctionNeedExpand(val)) {
val = timeFunctionExtension(taskInstance.getProcessInstanceId(), timeZone, val);
} else {
val = convertParameterPlaceholders(val, params);
}
property.setValue(val);
}
}
if (MapUtils.isEmpty(globalParams)) {
globalParams = new HashMap<>();
}
Map<String, Property> paramsMap = preBuildBusinessParams(processInstance);
if (MapUtils.isNotEmpty(paramsMap)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,034 | [Bug] [Task Plugin] Unable to pass parameters | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
workflow:
<img width="742" alt="image" src="https://user-images.githubusercontent.com/31528124/179495220-3fb6f976-7ae8-4abb-b204-9ef4ebc76acf.png">
out task
<img width="500" alt="image" src="https://user-images.githubusercontent.com/31528124/179495280-8c853bbd-4133-477d-a8c4-26d97563c7f1.png">
in task
<img width="492" alt="image" src="https://user-images.githubusercontent.com/31528124/179495331-7bfbd58d-6389-49df-b122-1568917d91a3.png">
Below is the run log
out task
<img width="343" alt="image" src="https://user-images.githubusercontent.com/31528124/179495439-d1cbddbc-feb4-410c-8810-25f42e308bc4.png">
in task
<img width="249" alt="image" src="https://user-images.githubusercontent.com/31528124/179495492-6e9d5127-bfac-46a3-a24e-c835dfc02784.png">
### What you expected to happen
the message of in task instance should be
```shell
in1
137 /home/lucky/.bashrc
in2
123
in3
```
### How to reproduce
As shown above
### Anything else
Doc : https://dolphinscheduler.apache.org/en-us/docs/latest/user_doc/guide/parameter/local.html
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11034 | https://github.com/apache/dolphinscheduler/pull/11053 | 878cbbc1590de3973b5734bdbe107e252ef14314 | 65d2b8f14e420ef35cc33c6e02cf3c622f969f0b | 2022-07-18T10:47:13Z | java | 2022-07-20T02:14:51Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/expand/CuringGlobalParams.java | globalParams.putAll(paramsMap);
}
return globalParams;
}
private Map<String, String> setGlobalParamsMap(ProcessInstance processInstance) {
Map<String, String> globalParamsMap = new HashMap<>(16);
String globalParamsStr = processInstance.getGlobalParams();
if (globalParamsStr != null) {
List<Property> globalParamsList = JSONUtils.toList(globalParamsStr, Property.class);
globalParamsMap.putAll(globalParamsList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue)));
}
return globalParamsMap;
}
@Override
public Map<String, Property> preBuildBusinessParams(ProcessInstance processInstance) {
Map<String, Property> paramsMap = new HashMap<>();
if (processInstance.getScheduleTime() != null) {
Date date = processInstance.getScheduleTime();
String dateTime = DateUtils.format(date, Constants.PARAMETER_FORMAT_TIME, null);
Property p = new Property();
p.setValue(dateTime);
p.setProp(Constants.PARAMETER_DATETIME);
paramsMap.put(Constants.PARAMETER_DATETIME, p);
}
return paramsMap;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,040 | [Improvement][Task Plugin] Refactor JupyterParameters.java with lombok | ### 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
* Refactor [JupyterParameters.java](https://github.com/apache/dolphinscheduler/blob/dev/dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterParameters.java) with `lombok` to keep code neat.
### 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/11040 | https://github.com/apache/dolphinscheduler/pull/11045 | 5e9c7dad232d7cd4d934a157eb51daae5b83fe9e | 2f0d907bcb2ab7f78cbc0bddf4f894041623c26b | 2022-07-19T05:38:52Z | java | 2022-07-20T03:02:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterParameters.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.jupyter;
import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo;
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
import java.util.List;
/**
* jupyter parameters
*/
public class JupyterParameters extends AbstractParameters {
/**
* conda env name
*/
private String condaEnvName; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,040 | [Improvement][Task Plugin] Refactor JupyterParameters.java with lombok | ### 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
* Refactor [JupyterParameters.java](https://github.com/apache/dolphinscheduler/blob/dev/dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterParameters.java) with `lombok` to keep code neat.
### 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/11040 | https://github.com/apache/dolphinscheduler/pull/11045 | 5e9c7dad232d7cd4d934a157eb51daae5b83fe9e | 2f0d907bcb2ab7f78cbc0bddf4f894041623c26b | 2022-07-19T05:38:52Z | java | 2022-07-20T03:02:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterParameters.java | /**
* input note path
*/
private String inputNotePath;
/**
* output note path
*/
private String outputNotePath;
/**
* parameters to pass into jupyter note cells
*/
private String parameters;
/**
* jupyter kernel
*/
private String kernel;
/**
* the execution engine name to use in evaluating the notebook
*/
private String engine;
/**
* time in seconds to wait for each cell before failing execution (default: forever)
*/
private String executionTimeout;
/**
* time in seconds to wait for kernel to start
*/
private String startTimeout;
/**
* other arguments |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,040 | [Improvement][Task Plugin] Refactor JupyterParameters.java with lombok | ### 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
* Refactor [JupyterParameters.java](https://github.com/apache/dolphinscheduler/blob/dev/dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterParameters.java) with `lombok` to keep code neat.
### 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/11040 | https://github.com/apache/dolphinscheduler/pull/11045 | 5e9c7dad232d7cd4d934a157eb51daae5b83fe9e | 2f0d907bcb2ab7f78cbc0bddf4f894041623c26b | 2022-07-19T05:38:52Z | java | 2022-07-20T03:02:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterParameters.java | */
private String others;
/**
* resource list
*/
private List<ResourceInfo> resourceList;
public String getCondaEnvName() {
return condaEnvName;
}
public void setCondaEnvName(String condaEnvName) {
this.condaEnvName = condaEnvName;
}
public String getInputNotePath() {
return inputNotePath;
}
public void setInputNotePath(String inputNotePath) {
this.inputNotePath = inputNotePath;
}
public String getOutputNotePath() {
return outputNotePath;
}
public void setOutputNotePath(String outputNotePath) {
this.outputNotePath = outputNotePath;
}
public String getParameters() {
return parameters;
}
public void setParameters(String parameters) {
this.parameters = parameters;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,040 | [Improvement][Task Plugin] Refactor JupyterParameters.java with lombok | ### 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
* Refactor [JupyterParameters.java](https://github.com/apache/dolphinscheduler/blob/dev/dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterParameters.java) with `lombok` to keep code neat.
### 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/11040 | https://github.com/apache/dolphinscheduler/pull/11045 | 5e9c7dad232d7cd4d934a157eb51daae5b83fe9e | 2f0d907bcb2ab7f78cbc0bddf4f894041623c26b | 2022-07-19T05:38:52Z | java | 2022-07-20T03:02:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterParameters.java | public String getKernel() {
return kernel;
}
public void setKernel(String kernel) {
this.kernel = kernel;
}
public String getEngine() {
return engine;
}
public void setEngine(String engine) {
this.engine = engine;
}
public String getExecutionTimeout() {
return executionTimeout;
}
public void setExecutionTimeout(String executionTimeout) {
this.executionTimeout = executionTimeout;
}
public String getStartTimeout() {
return startTimeout;
}
public void setStartTimeout(String startTimeout) {
this.startTimeout = startTimeout;
}
public String getOthers() {
return others;
}
public void setOthers(String others) {
this.others = others;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,040 | [Improvement][Task Plugin] Refactor JupyterParameters.java with lombok | ### 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
* Refactor [JupyterParameters.java](https://github.com/apache/dolphinscheduler/blob/dev/dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterParameters.java) with `lombok` to keep code neat.
### 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/11040 | https://github.com/apache/dolphinscheduler/pull/11045 | 5e9c7dad232d7cd4d934a157eb51daae5b83fe9e | 2f0d907bcb2ab7f78cbc0bddf4f894041623c26b | 2022-07-19T05:38:52Z | java | 2022-07-20T03:02:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterParameters.java | public List<ResourceInfo> getResourceList() {
return resourceList;
}
public void setResourceList(List<ResourceInfo> resourceList) {
this.resourceList = resourceList;
}
@Override
public List<ResourceInfo> getResourceFilesList() {
return resourceList;
}
@Override
public boolean checkParameters() {
return condaEnvName != null && inputNotePath != null && outputNotePath != null;
}
@Override
public String toString() {
return "JupyterParameters{" +
"condaEnvName='" + condaEnvName + '\'' +
", inputNotePath='" + inputNotePath + '\'' +
", outputNotePath='" + outputNotePath + '\'' +
", parameters='" + parameters + '\'' +
", kernel='" + kernel + '\'' +
", engine='" + engine + '\'' +
", executionTimeout=" + executionTimeout +
", startTimeout=" + startTimeout +
", others='" + others + '\'' +
'}';
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,026 | [Improvement][Task] Improve seatunnel task command log | ### 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
Improve seatunnel task command log
### 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/11026 | https://github.com/apache/dolphinscheduler/pull/11027 | 2f0d907bcb2ab7f78cbc0bddf4f894041623c26b | 35f32cd16eb7d89a900863755506858e84c699dd | 2022-07-18T07:48:39Z | java | 2022-07-20T03:06:10Z | dolphinscheduler-task-plugin/dolphinscheduler-task-seatunnel/src/main/java/org/apache/dolphinscheduler/plugin/task/seatunnel/SeatunnelTask.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. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,026 | [Improvement][Task] Improve seatunnel task command log | ### 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
Improve seatunnel task command log
### 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/11026 | https://github.com/apache/dolphinscheduler/pull/11027 | 2f0d907bcb2ab7f78cbc0bddf4f894041623c26b | 35f32cd16eb7d89a900863755506858e84c699dd | 2022-07-18T07:48:39Z | java | 2022-07-20T03:06:10Z | dolphinscheduler-task-plugin/dolphinscheduler-task-seatunnel/src/main/java/org/apache/dolphinscheduler/plugin/task/seatunnel/SeatunnelTask.java | * See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.seatunnel;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_FAILURE;
import static org.apache.dolphinscheduler.plugin.task.seatunnel.Constants.CONFIG_OPTIONS;
import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor;
import org.apache.dolphinscheduler.plugin.task.api.ShellCommandExecutor;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.dolphinscheduler.plugin.task.api.model.TaskResponse;
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParamUtils;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.BooleanUtils;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* seatunnel task
*/
public class SeatunnelTask extends AbstractTaskExecutor { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,026 | [Improvement][Task] Improve seatunnel task command log | ### 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
Improve seatunnel task command log
### 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/11026 | https://github.com/apache/dolphinscheduler/pull/11027 | 2f0d907bcb2ab7f78cbc0bddf4f894041623c26b | 35f32cd16eb7d89a900863755506858e84c699dd | 2022-07-18T07:48:39Z | java | 2022-07-20T03:06:10Z | dolphinscheduler-task-plugin/dolphinscheduler-task-seatunnel/src/main/java/org/apache/dolphinscheduler/plugin/task/seatunnel/SeatunnelTask.java | /**
* seatunnel parameters
*/
private SeatunnelParameters seatunnelParameters;
/**
* shell command executor
*/
private ShellCommandExecutor shellCommandExecutor;
/**
* taskExecutionContext
*/
protected final TaskExecutionContext taskExecutionContext;
/**
* constructor
*
* @param taskExecutionContext taskExecutionContext
*/
public SeatunnelTask(TaskExecutionContext taskExecutionContext) {
super(taskExecutionContext);
this.taskExecutionContext = taskExecutionContext;
this.shellCommandExecutor = new ShellCommandExecutor(this::logHandle, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,026 | [Improvement][Task] Improve seatunnel task command log | ### 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
Improve seatunnel task command log
### 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/11026 | https://github.com/apache/dolphinscheduler/pull/11027 | 2f0d907bcb2ab7f78cbc0bddf4f894041623c26b | 35f32cd16eb7d89a900863755506858e84c699dd | 2022-07-18T07:48:39Z | java | 2022-07-20T03:06:10Z | dolphinscheduler-task-plugin/dolphinscheduler-task-seatunnel/src/main/java/org/apache/dolphinscheduler/plugin/task/seatunnel/SeatunnelTask.java | taskExecutionContext,
logger);
}
@Override
public void init() {
logger.info("SeaTunnel task params {}", taskExecutionContext.getTaskParams());
if (!seatunnelParameters.checkParameters()) {
throw new RuntimeException("SeaTunnel task params is not valid");
}
}
@Override
public void handle() throws Exception {
try {
String command = buildCommand();
TaskResponse commandExecuteResult = shellCommandExecutor.run(command);
setExitStatusCode(commandExecuteResult.getExitStatusCode());
setAppIds(commandExecuteResult.getAppIds());
setProcessId(commandExecuteResult.getProcessId());
seatunnelParameters.dealOutParam(shellCommandExecutor.getVarPool());
} catch (Exception e) {
logger.error("SeaTunnel task error", e);
setExitStatusCode(EXIT_CODE_FAILURE);
throw e;
}
}
@Override
public void cancelApplication(boolean cancelApplication) throws Exception {
shellCommandExecutor.cancelApplication(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,026 | [Improvement][Task] Improve seatunnel task command log | ### 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
Improve seatunnel task command log
### 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/11026 | https://github.com/apache/dolphinscheduler/pull/11027 | 2f0d907bcb2ab7f78cbc0bddf4f894041623c26b | 35f32cd16eb7d89a900863755506858e84c699dd | 2022-07-18T07:48:39Z | java | 2022-07-20T03:06:10Z | dolphinscheduler-task-plugin/dolphinscheduler-task-seatunnel/src/main/java/org/apache/dolphinscheduler/plugin/task/seatunnel/SeatunnelTask.java | }
private String buildCommand() throws Exception {
List<String> args = new ArrayList<>();
args.add(seatunnelParameters.getEngine().getCommand());
args.addAll(buildOptions());
String command = String.join(" ", args);
logger.info("SeaTunnel Flink task command: {}", command);
return command;
}
protected List<String> buildOptions() throws Exception {
List<String> args = new ArrayList<>();
if (BooleanUtils.isTrue(seatunnelParameters.getUseCustom())) {
args.add(CONFIG_OPTIONS);
args.add(buildCustomConfigCommand());
} else {
seatunnelParameters.getResourceList().forEach(resourceInfo -> {
args.add(CONFIG_OPTIONS);
args.add(resourceInfo.getResourceName().substring(1));
});
}
return args;
}
protected String buildCustomConfigCommand() throws Exception {
String config = buildCustomConfigContent();
String filePath = buildConfigFilePath();
createConfigFileIfNotExists(config, filePath);
return filePath;
}
private String buildCustomConfigContent() { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,026 | [Improvement][Task] Improve seatunnel task command log | ### 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
Improve seatunnel task command log
### 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/11026 | https://github.com/apache/dolphinscheduler/pull/11027 | 2f0d907bcb2ab7f78cbc0bddf4f894041623c26b | 35f32cd16eb7d89a900863755506858e84c699dd | 2022-07-18T07:48:39Z | java | 2022-07-20T03:06:10Z | dolphinscheduler-task-plugin/dolphinscheduler-task-seatunnel/src/main/java/org/apache/dolphinscheduler/plugin/task/seatunnel/SeatunnelTask.java | logger.info("raw custom config content : {}", seatunnelParameters.getRawScript());
String script = seatunnelParameters.getRawScript().replaceAll("\\r\\n", "\n");
script = parseScript(script);
return script;
}
private String buildConfigFilePath() {
return String.format("%s/seatunnel_%s.conf", taskExecutionContext.getExecutePath(), taskExecutionContext.getTaskAppId());
}
private void createConfigFileIfNotExists(String script, String scriptFile) throws IOException {
logger.info("tenantCode :{}, task dir:{}", taskExecutionContext.getTenantCode(), taskExecutionContext.getExecutePath());
if (!Files.exists(Paths.get(scriptFile))) {
logger.info("generate script file:{}", scriptFile);
FileUtils.writeStringToFile(new File(scriptFile), script, StandardCharsets.UTF_8);
}
}
@Override
public AbstractParameters getParameters() {
return seatunnelParameters;
}
private String parseScript(String script) {
Map<String, Property> paramsMap = taskExecutionContext.getPrepareParamsMap();
return ParameterUtils.convertParameterPlaceholders(script, ParamUtils.convert(paramsMap));
}
public void setSeatunnelParameters(SeatunnelParameters seatunnelParameters) {
this.seatunnelParameters = seatunnelParameters;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.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.zeppelin;
import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo;
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import java.util.Collections;
import java.util.List;
public class ZeppelinParameters extends AbstractParameters { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java | /**
* parameters for zeppelin client API
* @see <a href="https://zeppelin.apache.org/docs/0.9.0/usage/zeppelin_sdk/client_api.html">Zeppelin_Client_API_Examples</a>
*/
private String noteId;
private String paragraphId;
private String restEndpoint;
private String parameters;
@Override
public boolean checkParameters() {
return StringUtils.isNotEmpty(this.noteId) && StringUtils.isNotEmpty(this.restEndpoint);
}
@Override
public List<ResourceInfo> getResourceFilesList() {
return Collections.emptyList();
}
public String getNoteId() {
return noteId;
}
public void setNoteId(String noteId) {
this.noteId = noteId; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java | }
public String getParagraphId() {
return paragraphId;
}
public void setParagraphId(String paragraphId) {
this.paragraphId = paragraphId;
}
public String getParameters() {
return parameters;
}
public void setParameters(String parameters) {
this.parameters = parameters;
}
public String getRestEndpoint() {
return restEndpoint;
}
public void setRestEndpoint(String restEndpoint) {
this.restEndpoint = restEndpoint;
}
@Override
public String toString() {
return "ZeppelinParameters{"
+ "noteId='" + noteId + '\''
+ ", paragraphId='" + paragraphId + '\''
+ ", restEndpoint='" + restEndpoint + '\''
+ ", parameters='" + parameters + '\''
+ '}';
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.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.zeppelin;
import com.fasterxml.jackson.databind.ObjectMapper;
import kong.unirest.Unirest;
import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor;
import org.apache.dolphinscheduler.plugin.task.api.TaskConstants;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.zeppelin.client.ClientConfig;
import org.apache.zeppelin.client.NoteResult;
import org.apache.zeppelin.client.ParagraphResult;
import org.apache.zeppelin.client.Status;
import org.apache.zeppelin.client.ZeppelinClient; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java | import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ZeppelinTask extends AbstractTaskExecutor {
/**
* taskExecutionContext
*/
private final TaskExecutionContext taskExecutionContext;
/**
* zeppelin parameters
*/
private ZeppelinParameters zeppelinParameters;
/**
* zeppelin api client
*/
private ZeppelinClient zClient;
/**
* constructor
*
* @param taskExecutionContext taskExecutionContext
*/
protected ZeppelinTask(TaskExecutionContext taskExecutionContext) {
super(taskExecutionContext);
this.taskExecutionContext = taskExecutionContext;
}
@Override
public void init() {
final String taskParams = taskExecutionContext.getTaskParams();
logger.info("zeppelin task params:{}", taskParams);
this.zeppelinParameters = JSONUtils.parseObject(taskParams, ZeppelinParameters.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java | if (this.zeppelinParameters == null || !this.zeppelinParameters.checkParameters()) {
throw new ZeppelinTaskException("zeppelin task params is not valid");
}
this.zClient = getZeppelinClient();
}
@Override
public void handle() throws Exception {
try {
final String noteId = this.zeppelinParameters.getNoteId();
final String paragraphId = this.zeppelinParameters.getParagraphId();
final String parameters = this.zeppelinParameters.getParameters();
Map<String, String> zeppelinParamsMap = new HashMap<>();
if (parameters != null) {
ObjectMapper mapper = new ObjectMapper();
zeppelinParamsMap = mapper.readValue(parameters, Map.class);
}
String resultContent;
Status status = Status.FINISHED;
if (paragraphId == null) {
final NoteResult noteResult = this.zClient.executeNote(noteId, zeppelinParamsMap);
final List<ParagraphResult> paragraphResultList = noteResult.getParagraphResultList();
StringBuilder resultContentBuilder = new StringBuilder();
for (ParagraphResult paragraphResult : paragraphResultList) {
resultContentBuilder.append(
String.format(
"paragraph_id: %s, paragraph_result: %s\n",
paragraphResult.getParagraphId(),
paragraphResult.getResultInText()));
status = paragraphResult.getStatus(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java | if (status != Status.FINISHED) {
break;
}
}
resultContent = resultContentBuilder.toString();
} else {
final ParagraphResult paragraphResult = this.zClient.executeParagraph(noteId, paragraphId, zeppelinParamsMap);
resultContent = paragraphResult.getResultInText();
status = paragraphResult.getStatus();
}
final int exitStatusCode = mapStatusToExitCode(status);
setAppIds(String.format("%s-%s", noteId, paragraphId));
setExitStatusCode(exitStatusCode);
logger.info("zeppelin task finished with results: {}", resultContent);
} catch (Exception e) {
setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE);
logger.error("zeppelin task submit failed with error", e);
}
}
/**
* create zeppelin client from zeppelin config
*
* @return ZeppelinClient
*/
private ZeppelinClient getZeppelinClient() {
final String restEndpoint = zeppelinParameters.getRestEndpoint();
final ClientConfig clientConfig = new ClientConfig(restEndpoint); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java | ZeppelinClient zClient = null;
try {
zClient = new ZeppelinClient(clientConfig);
final String zeppelinVersion = zClient.getVersion();
logger.info("zeppelin version: {}", zeppelinVersion);
} catch (Exception e) {
logger.error("some error");
}
return zClient;
}
/**
* map zeppelin task status to exitStatusCode
*
* @param status zeppelin job status
* @return exitStatusCode
*/
private int mapStatusToExitCode(Status status) {
switch (status) {
case FINISHED:
return TaskConstants.EXIT_CODE_SUCCESS;
case ABORT:
return TaskConstants.EXIT_CODE_KILL;
default:
return TaskConstants.EXIT_CODE_FAILURE;
}
}
@Override
public AbstractParameters getParameters() {
return zeppelinParameters; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java | }
@Override
public void cancelApplication(boolean status) throws Exception {
final String restEndpoint = this.zeppelinParameters.getRestEndpoint();
super.cancelApplication(status);
final String noteId = this.zeppelinParameters.getNoteId();
final String paragraphId = this.zeppelinParameters.getParagraphId();
if (paragraphId == null) {
logger.info("trying terminate zeppelin task, taskId: {}, noteId: {}",
this.taskExecutionContext.getTaskInstanceId(),
noteId);
Unirest.config().defaultBaseUrl(restEndpoint + "/api");
Unirest.delete("/notebook/job/{noteId}").routeParam("noteId", noteId).asJson();
logger.info("zeppelin task terminated, taskId: {}, noteId: {}",
this.taskExecutionContext.getTaskInstanceId(),
noteId);
} else {
logger.info("trying terminate zeppelin task, taskId: {}, noteId: {}, paragraphId: {}",
this.taskExecutionContext.getTaskInstanceId(),
noteId,
paragraphId);
this.zClient.cancelParagraph(noteId, paragraphId);
logger.info("zeppelin task terminated, taskId: {}, noteId: {}, paragraphId: {}",
this.taskExecutionContext.getTaskInstanceId(),
noteId,
paragraphId);
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.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. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java | * See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.zeppelin;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_FAILURE;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_KILL;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_SUCCESS;
import static org.mockito.ArgumentMatchers.any;
import static org.powermock.api.mockito.PowerMockito.doReturn;
import static org.powermock.api.mockito.PowerMockito.mock;
import static org.powermock.api.mockito.PowerMockito.spy;
import static org.powermock.api.mockito.PowerMockito.when;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.zeppelin.client.ParagraphResult;
import org.apache.zeppelin.client.NoteResult;
import org.apache.zeppelin.client.Status;
import org.apache.zeppelin.client.ZeppelinClient;
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.modules.junit4.PowerMockRunner;
import java.util.Map;
@RunWith(PowerMockRunner.class) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java | @PrepareForTest({
ZeppelinTask.class,
ZeppelinClient.class,
ObjectMapper.class,
})
@PowerMockIgnore({"javax.*"})
public class ZeppelinTaskTest {
private static final String MOCK_NOTE_ID = "2GYJR92R7";
private static final String MOCK_PARAGRAPH_ID = "paragraph_1648793472526_1771221396";
private static final String MOCK_PARAMETERS = "{\"key1\": \"value1\", \"key2\": \"value2\"}";
private static final String MOCK_REST_ENDPOINT = "localhost:8080";
private final ObjectMapper mapper = new ObjectMapper();
private ZeppelinClient zClient;
private ZeppelinTask zeppelinTask;
private ParagraphResult paragraphResult;
private NoteResult noteResult;
@Before
public void before() throws Exception {
String zeppelinParameters = buildZeppelinTaskParameters();
TaskExecutionContext taskExecutionContext = PowerMockito.mock(TaskExecutionContext.class);
when(taskExecutionContext.getTaskParams()).thenReturn(zeppelinParameters);
this.zeppelinTask = spy(new ZeppelinTask(taskExecutionContext)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java | this.zClient = mock(ZeppelinClient.class);
this.paragraphResult = mock(ParagraphResult.class);
doReturn(this.zClient).when(this.zeppelinTask, "getZeppelinClient");
when(this.zClient.executeParagraph(any(), any(), any(Map.class))).thenReturn(this.paragraphResult);
when(paragraphResult.getResultInText()).thenReturn("mock-zeppelin-paragraph-execution-result");
this.zeppelinTask.init();
}
@Test
public void testHandleWithParagraphExecutionSuccess() throws Exception {
when(this.paragraphResult.getStatus()).thenReturn(Status.FINISHED);
this.zeppelinTask.handle();
Mockito.verify(this.zClient).executeParagraph(MOCK_NOTE_ID,
MOCK_PARAGRAPH_ID,
(Map<String, String>) mapper.readValue(MOCK_PARAMETERS, Map.class));
Mockito.verify(this.paragraphResult).getResultInText();
Mockito.verify(this.paragraphResult).getStatus();
Assert.assertEquals(EXIT_CODE_SUCCESS, this.zeppelinTask.getExitStatusCode());
}
@Test
public void testHandleWithParagraphExecutionAborted() throws Exception {
when(this.paragraphResult.getStatus()).thenReturn(Status.ABORT);
this.zeppelinTask.handle();
Mockito.verify(this.zClient).executeParagraph(MOCK_NOTE_ID,
MOCK_PARAGRAPH_ID,
(Map<String, String>) mapper.readValue(MOCK_PARAMETERS, Map.class));
Mockito.verify(this.paragraphResult).getResultInText();
Mockito.verify(this.paragraphResult).getStatus();
Assert.assertEquals(EXIT_CODE_KILL, this.zeppelinTask.getExitStatusCode());
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java | @Test
public void testHandleWithParagraphExecutionError() throws Exception {
when(this.paragraphResult.getStatus()).thenReturn(Status.ERROR);
this.zeppelinTask.handle();
Mockito.verify(this.zClient).executeParagraph(MOCK_NOTE_ID,
MOCK_PARAGRAPH_ID,
(Map<String, String>) mapper.readValue(MOCK_PARAMETERS, Map.class));
Mockito.verify(this.paragraphResult).getResultInText();
Mockito.verify(this.paragraphResult).getStatus();
Assert.assertEquals(EXIT_CODE_FAILURE, this.zeppelinTask.getExitStatusCode());
}
@Test
public void testHandleWithParagraphExecutionException() throws Exception {
when(this.zClient.executeParagraph(any(), any(), any(Map.class))).
thenThrow(new Exception("Something wrong happens from zeppelin side"));
this.zeppelinTask.handle();
Mockito.verify(this.zClient).executeParagraph(MOCK_NOTE_ID,
MOCK_PARAGRAPH_ID,
(Map<String, String>) mapper.readValue(MOCK_PARAMETERS, Map.class));
Mockito.verify(this.paragraphResult, Mockito.times(0)).getResultInText();
Mockito.verify(this.paragraphResult, Mockito.times(0)).getStatus();
Assert.assertEquals(EXIT_CODE_FAILURE, this.zeppelinTask.getExitStatusCode());
}
@Test
public void testHandleWithNoteExecutionSuccess() throws Exception {
String zeppelinParametersWithNoParagraphId = buildZeppelinTaskParametersWithNoParagraphId();
TaskExecutionContext taskExecutionContext= PowerMockito.mock(TaskExecutionContext.class);
when(taskExecutionContext.getTaskParams()).thenReturn(zeppelinParametersWithNoParagraphId);
this.zeppelinTask = spy(new ZeppelinTask(taskExecutionContext)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,584 | [Feature][Task Plugin] Zeppelin Task will run a duplicate note instead of the original one | ### 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
* At present, zeppelin task plugin runs the zeppelin notes / paragraphs directly. If users modify the notes / paragraphs during scheduling, it may lead to inconsistent result.
* Zeppelin task plugin should duplicate the target notes / paragraphs and run the duplicates instead of the origins. When done, zeppelin task plugin is supposed to delete the duplicates.
### Use case
* Already described above.
### Related issues
related: #9814
### 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/10584 | https://github.com/apache/dolphinscheduler/pull/11010 | 35f32cd16eb7d89a900863755506858e84c699dd | f689220290a13d5ce3b451e65a475c0444e7a047 | 2022-06-23T23:54:29Z | java | 2022-07-20T06:16:47Z | dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java | this.zClient = mock(ZeppelinClient.class);
this.noteResult = mock(NoteResult.class);
doReturn(this.zClient).when(this.zeppelinTask, "getZeppelinClient");
when(this.zClient.executeNote(any(), any(Map.class))).thenReturn(this.noteResult);
when(paragraphResult.getResultInText()).thenReturn("mock-zeppelin-paragraph-execution-result");
this.zeppelinTask.init();
when(this.paragraphResult.getStatus()).thenReturn(Status.FINISHED);
this.zeppelinTask.handle();
Mockito.verify(this.zClient).executeNote(MOCK_NOTE_ID,
(Map<String, String>) mapper.readValue(MOCK_PARAMETERS, Map.class));
Mockito.verify(this.noteResult).getParagraphResultList();
Assert.assertEquals(EXIT_CODE_SUCCESS, this.zeppelinTask.getExitStatusCode());
}
private String buildZeppelinTaskParameters() {
ZeppelinParameters zeppelinParameters = new ZeppelinParameters();
zeppelinParameters.setNoteId(MOCK_NOTE_ID);
zeppelinParameters.setParagraphId(MOCK_PARAGRAPH_ID);
zeppelinParameters.setRestEndpoint(MOCK_REST_ENDPOINT);
zeppelinParameters.setParameters(MOCK_PARAMETERS);
return JSONUtils.toJsonString(zeppelinParameters);
}
private String buildZeppelinTaskParametersWithNoParagraphId() {
ZeppelinParameters zeppelinParameters = new ZeppelinParameters();
zeppelinParameters.setNoteId(MOCK_NOTE_ID);
zeppelinParameters.setParameters(MOCK_PARAMETERS);
zeppelinParameters.setRestEndpoint(MOCK_REST_ENDPOINT);
return JSONUtils.toJsonString(zeppelinParameters);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,729 | [Bug] The request's url given by the test case looks different from the controller layer | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
The request's url given by the test case which become right
### How to reproduce
### 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/10729 | https://github.com/apache/dolphinscheduler/pull/10734 | f689220290a13d5ce3b451e65a475c0444e7a047 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | 2022-07-01T08:33:55Z | java | 2022-07-20T07:42:45Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.controller;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.plugin.datasource.mysql.param.MySQLDataSourceParamDTO;
import java.util.HashMap;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,729 | [Bug] The request's url given by the test case looks different from the controller layer | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
The request's url given by the test case which become right
### How to reproduce
### 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/10729 | https://github.com/apache/dolphinscheduler/pull/10734 | f689220290a13d5ce3b451e65a475c0444e7a047 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | 2022-07-01T08:33:55Z | java | 2022-07-20T07:42:45Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java | import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
/**
* data source controller test
*/
public class DataSourceControllerTest extends AbstractControllerTest {
private static final Logger logger = LoggerFactory.getLogger(DataSourceControllerTest.class);
@Ignore
@Test
public void testCreateDataSource() throws Exception {
MySQLDataSourceParamDTO mysqlDatasourceParam = new MySQLDataSourceParamDTO();
mysqlDatasourceParam.setName("mysql");
mysqlDatasourceParam.setNote("mysql data source test");
mysqlDatasourceParam.setHost("192.168.xxxx.xx");
mysqlDatasourceParam.setPort(3306);
mysqlDatasourceParam.setDatabase("dolphinscheduler");
mysqlDatasourceParam.setUserName("root");
mysqlDatasourceParam.setPassword("root@123");
mysqlDatasourceParam.setOther(new HashMap<>());
MvcResult mvcResult = mockMvc.perform(post("/datasources/create")
.header("sessionId", sessionId)
.contentType(MediaType.APPLICATION_JSON)
.content(JSONUtils.toJsonString(mysqlDatasourceParam)))
.andExpect(status().isCreated())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,729 | [Bug] The request's url given by the test case looks different from the controller layer | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
The request's url given by the test case which become right
### How to reproduce
### 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/10729 | https://github.com/apache/dolphinscheduler/pull/10734 | f689220290a13d5ce3b451e65a475c0444e7a047 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | 2022-07-01T08:33:55Z | java | 2022-07-20T07:42:45Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java | Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Ignore
@Test
public void testUpdateDataSource() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("id","2");
paramsMap.add("name","mysql");
paramsMap.add("node","mysql data source test");
paramsMap.add("type","MYSQL");
paramsMap.add("host","192.168.xxxx.xx");
paramsMap.add("port","3306");
paramsMap.add("principal","");
paramsMap.add("database","dolphinscheduler");
paramsMap.add("userName","root");
paramsMap.add("password","root@123");
paramsMap.add("other","");
MvcResult mvcResult = mockMvc.perform(post("/datasources/update")
.header("sessionId", sessionId)
.params(paramsMap))
.andExpect(status().isCreated())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Ignore
@Test |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,729 | [Bug] The request's url given by the test case looks different from the controller layer | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
The request's url given by the test case which become right
### How to reproduce
### 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/10729 | https://github.com/apache/dolphinscheduler/pull/10734 | f689220290a13d5ce3b451e65a475c0444e7a047 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | 2022-07-01T08:33:55Z | java | 2022-07-20T07:42:45Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java | public void testQueryDataSource() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("id","2");
MvcResult mvcResult = mockMvc.perform(post("/datasources/update-ui")
.header("sessionId", sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testQueryDataSourceList() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("type","MYSQL");
MvcResult mvcResult = mockMvc.perform(get("/datasources/list")
.header("sessionId", sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testQueryDataSourceListPaging() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,729 | [Bug] The request's url given by the test case looks different from the controller layer | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
The request's url given by the test case which become right
### How to reproduce
### 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/10729 | https://github.com/apache/dolphinscheduler/pull/10734 | f689220290a13d5ce3b451e65a475c0444e7a047 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | 2022-07-01T08:33:55Z | java | 2022-07-20T07:42:45Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java | paramsMap.add("searchVal","mysql");
paramsMap.add("pageNo","1");
paramsMap.add("pageSize","1");
MvcResult mvcResult = mockMvc.perform(get("/datasources")
.header("sessionId", sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Ignore
@Test
public void testConnectDataSource() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("name","hive data source");
paramsMap.add("type","HIVE");
paramsMap.add("host","192.168.xx.xx");
paramsMap.add("port","10000");
paramsMap.add("database","default");
paramsMap.add("userName","hive");
paramsMap.add("password","");
paramsMap.add("other","");
MvcResult mvcResult = mockMvc.perform(post("/datasources/connect")
.header("sessionId", sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,729 | [Bug] The request's url given by the test case looks different from the controller layer | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
The request's url given by the test case which become right
### How to reproduce
### 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/10729 | https://github.com/apache/dolphinscheduler/pull/10734 | f689220290a13d5ce3b451e65a475c0444e7a047 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | 2022-07-01T08:33:55Z | java | 2022-07-20T07:42:45Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java | .andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Ignore
@Test
public void testConnectionTest() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("id","2");
MvcResult mvcResult = mockMvc.perform(get("/datasources/connect-by-id")
.header("sessionId", sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testVerifyDataSourceName() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("name","mysql");
MvcResult mvcResult = mockMvc.perform(get("/datasources/verify-name")
.header("sessionId", sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,729 | [Bug] The request's url given by the test case looks different from the controller layer | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
The request's url given by the test case which become right
### How to reproduce
### 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/10729 | https://github.com/apache/dolphinscheduler/pull/10734 | f689220290a13d5ce3b451e65a475c0444e7a047 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | 2022-07-01T08:33:55Z | java | 2022-07-20T07:42:45Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java | Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testAuthedDatasource() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("userId","2");
MvcResult mvcResult = mockMvc.perform(get("/datasources/authed-datasource")
.header("sessionId", sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testUnauthDatasource() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("userId","2");
MvcResult mvcResult = mockMvc.perform(get("/datasources/unauth-datasource")
.header("sessionId", sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,729 | [Bug] The request's url given by the test case looks different from the controller layer | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened


### What you expected to happen
The request's url given by the test case which become right
### How to reproduce
### 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/10729 | https://github.com/apache/dolphinscheduler/pull/10734 | f689220290a13d5ce3b451e65a475c0444e7a047 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | 2022-07-01T08:33:55Z | java | 2022-07-20T07:42:45Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java | logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testGetKerberosStartupState() throws Exception {
MvcResult mvcResult = mockMvc.perform(get("/datasources/kerberos-startup-state")
.header("sessionId", sessionId))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Ignore
@Test
public void testDelete() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("id","16");
MvcResult mvcResult = mockMvc.perform(get("/datasources/delete")
.header("sessionId", sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service.impl;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.ACCESS_TOKEN_CREATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.ACCESS_TOKEN_DELETE; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.ACCESS_TOKEN_UPDATE;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.AccessTokenService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.EncryptionUtils;
import org.apache.dolphinscheduler.dao.entity.AccessToken;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.AccessTokenMapper;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* access token service impl
*/
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | public class AccessTokenServiceImpl extends BaseServiceImpl implements AccessTokenService {
private static final Logger logger = LoggerFactory.getLogger(AccessTokenServiceImpl.class);
@Autowired
private AccessTokenMapper accessTokenMapper;
/**
* query access token list
*
* @param loginUser login user
* @param searchVal search value
* @param pageNo page number
* @param pageSize page size
* @return token list for page number and page size
*/
@Override
public Result queryAccessTokenList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
Result result = new Result();
PageInfo<AccessToken> pageInfo = new PageInfo<>(pageNo, pageSize);
Set<Integer> ids = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.ACCESS_TOKEN, loginUser.getId(), logger);
if (!ids.isEmpty()) {
Page<AccessToken> page = new Page<>(pageNo, pageSize);
IPage<AccessToken> accessTokenList = accessTokenMapper.selectAccessTokenPage(page, new ArrayList<>(ids), searchVal);
pageInfo.setTotal((int) accessTokenList.getTotal());
pageInfo.setTotalList(accessTokenList.getRecords());
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query access token for specified user
*
* @param loginUser login user
* @param userId user id
* @return token list for specified user
*/
@Override
public Map<String, Object> queryAccessTokenByUser(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, false);
List<AccessToken> accessTokenList = Collections.EMPTY_LIST;
Set<Integer> ids = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.ACCESS_TOKEN, loginUser.getId(), logger);
if (!ids.isEmpty()) {
accessTokenList = this.accessTokenMapper.selectBatchIds(ids);
}
result.put(Constants.DATA_LIST, accessTokenList);
this.putMsg(result, Status.SUCCESS);
return result;
}
/**
* create token
*
* @param loginUser
* @param userId token for user
* @param expireTime token expire time |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | * @param token token string (if it is absent, it will be automatically generated)
* @return create result code
*/
@SuppressWarnings("checkstyle:WhitespaceAround")
@Override
public Result createToken(User loginUser, int userId, String expireTime, String token) {
Result result = new Result();
if (!(canOperatorPermissions(loginUser,null, AuthorizationType.ACCESS_TOKEN,ACCESS_TOKEN_CREATE) || loginUser.getId() == userId)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
if (userId <= 0) {
String errorMsg = "User id should not less than or equals to 0.";
logger.error(errorMsg);
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, errorMsg);
return result;
}
if (StringUtils.isBlank(token)) {
token = EncryptionUtils.getMd5(userId + expireTime + System.currentTimeMillis());
}
AccessToken accessToken = new AccessToken();
accessToken.setUserId(userId);
accessToken.setExpireTime(DateUtils.stringToDate(expireTime));
accessToken.setToken(token);
accessToken.setCreateTime(new Date());
accessToken.setUpdateTime(new Date()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | int insert = accessTokenMapper.insert(accessToken);
if (insert > 0) {
result.setData(accessToken);
putMsg(result, Status.SUCCESS);
resourcePermissionCheckService.postHandle(AuthorizationType.ACCESS_TOKEN, loginUser.getId(), new ArrayList<>(accessToken.getId()), logger);
} else {
putMsg(result, Status.CREATE_ACCESS_TOKEN_ERROR);
}
return result;
}
/**
* generate token
*
* @param loginUser
* @param userId token for user
* @param expireTime token expire time
* @return token string
*/
@Override
public Map<String, Object> generateToken(User loginUser, int userId, String expireTime) {
Map<String, Object> result = new HashMap<>();
String token = EncryptionUtils.getMd5(userId + expireTime + System.currentTimeMillis());
result.put(Constants.DATA_LIST, token);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete access token
*
* @param loginUser login user |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | * @param id token id
* @return delete result code
*/
@Override
public Map<String, Object> delAccessTokenById(User loginUser, int id) {
Map<String, Object> result = new HashMap<>();
if (!canOperatorPermissions(loginUser,new Object[]{id},AuthorizationType.ACCESS_TOKEN,ACCESS_TOKEN_DELETE)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
AccessToken accessToken = accessTokenMapper.selectById(id);
if (accessToken == null) {
logger.error("access token not exist, access token id {}", id);
putMsg(result, Status.ACCESS_TOKEN_NOT_EXIST);
return result;
}
accessTokenMapper.deleteById(id);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* update token by id
*
* @param id token id
* @param userId token for user
* @param expireTime token expire time
* @param token token string (if it is absent, it will be automatically generated)
* @return updated access token entity
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | public Map<String, Object> updateToken(User loginUser, int id, int userId, String expireTime, String token) {
Map<String, Object> result = new HashMap<>();
if (!canOperatorPermissions(loginUser,new Object[]{id},AuthorizationType.ACCESS_TOKEN,ACCESS_TOKEN_UPDATE)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
AccessToken accessToken = accessTokenMapper.selectById(id);
if (accessToken == null) {
logger.error("access token not exist, access token id {}", id);
putMsg(result, Status.ACCESS_TOKEN_NOT_EXIST);
return result;
}
if (StringUtils.isBlank(token)) {
token = EncryptionUtils.getMd5(userId + expireTime + System.currentTimeMillis());
}
accessToken.setUserId(userId);
accessToken.setExpireTime(DateUtils.stringToDate(expireTime));
accessToken.setToken(token);
accessToken.setUpdateTime(new Date());
accessTokenMapper.updateById(accessToken);
result.put(Constants.DATA_LIST, accessToken);
putMsg(result, Status.SUCCESS);
return result;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.ACCESS_TOKEN_DELETE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.ACCESS_TOKEN_UPDATE;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.permission.ResourcePermissionCheckService;
import org.apache.dolphinscheduler.api.service.impl.AccessTokenServiceImpl;
import org.apache.dolphinscheduler.api.service.impl.BaseServiceImpl;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.java | import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.dao.entity.AccessToken;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.AccessTokenMapper;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.assertj.core.util.Lists;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.powermock.api.mockito.PowerMockito;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* access token service test
*/
@RunWith(MockitoJUnitRunner.class) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.java | public class AccessTokenServiceTest {
private static final Logger baseServiceLogger = LoggerFactory.getLogger(BaseServiceImpl.class);
private static final Logger logger = LoggerFactory.getLogger(AccessTokenServiceTest.class);
private static final Logger serviceLogger = LoggerFactory.getLogger(AccessTokenServiceImpl.class);
@InjectMocks
private AccessTokenServiceImpl accessTokenService;
@Mock
private AccessTokenMapper accessTokenMapper;
@Mock
private ResourcePermissionCheckService resourcePermissionCheckService;
@Test
@SuppressWarnings("unchecked")
public void testQueryAccessTokenList() {
IPage<AccessToken> tokenPage = new Page<>();
tokenPage.setRecords(getList());
tokenPage.setTotal(1L);
User user = new User();
user.setId(1);
user.setUserType(UserType.ADMIN_USER);
Set<Integer> tokenIds = new HashSet<>();
tokenIds.add(1);
when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.ACCESS_TOKEN, user.getId(), serviceLogger)).thenReturn(new HashSet());
Result result = accessTokenService.queryAccessTokenList(user, "zhangsan", 1, 10);
PageInfo<AccessToken> pageInfo = (PageInfo<AccessToken>) result.getData();
assertEquals(0, (int) pageInfo.getTotal());
PowerMockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.ACCESS_TOKEN, user.getId(), serviceLogger)).thenReturn(tokenIds);
Mockito.when(accessTokenMapper.selectAccessTokenPage(Mockito.any(Page.class), Mockito.anyList(),Mockito.eq("zhangsan"))).thenReturn(tokenPage);
result = accessTokenService.queryAccessTokenList(user, "zhangsan", 1, 10);
pageInfo = (PageInfo<AccessToken>) result.getData();
logger.info(result.toString()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.java | Assert.assertTrue(pageInfo.getTotal() > 0);
}
@Test
public void testQueryAccessTokenByUser() {
User user = this.getLoginUser();
user.setUserType(UserType.ADMIN_USER);
List<AccessToken> accessTokenList = Lists.newArrayList(this.getEntity());
Set<Integer> tokenIds = new HashSet<>();
tokenIds.add(1);
Mockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.ACCESS_TOKEN, user.getId(), serviceLogger)).thenReturn(tokenIds);
Map<String, Object> result = this.accessTokenService.queryAccessTokenByUser(user, 1);
logger.info(result.toString());
assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
}
@Test
public void testCreateToken() {
when(accessTokenMapper.insert(any(AccessToken.class))).thenReturn(2);
Result result = accessTokenService.createToken(getLoginUser(), 1, getDate(), "AccessTokenServiceTest");
logger.info(result.toString());
assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
result = this.accessTokenService.createToken(getLoginUser(), 1, getDate(), null);
logger.info(result.toString());
assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
}
@Test
public void testGenerateToken() {
User user = new User();
user.setId(1); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.java | user.setUserType(UserType.ADMIN_USER);
Map<String, Object> result = accessTokenService.generateToken(getLoginUser(), Integer.MAX_VALUE,getDate());
logger.info(result.toString());
assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
String token = (String) result.get(Constants.DATA_LIST);
Assert.assertNotNull(token);
}
@Test
public void testDelAccessTokenById() {
when(accessTokenMapper.selectById(1)).thenReturn(getEntity());
User userLogin = new User();
userLogin.setId(1);
userLogin.setUserType(UserType.ADMIN_USER);
Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.ACCESS_TOKEN, 1, ACCESS_TOKEN_DELETE, baseServiceLogger)).thenReturn(true);
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.ACCESS_TOKEN, new Object[]{0}, 0, baseServiceLogger)).thenReturn(true);
Map<String, Object> result = accessTokenService.delAccessTokenById(userLogin, 0);
logger.info(result.toString());
assertEquals(Status.ACCESS_TOKEN_NOT_EXIST, result.get(Constants.STATUS));
result = accessTokenService.delAccessTokenById(userLogin, 1);
logger.info(result.toString());
assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
userLogin.setId(1);
userLogin.setUserType(UserType.ADMIN_USER);
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.ACCESS_TOKEN, new Object[]{1}, 0, baseServiceLogger)).thenReturn(true);
result = accessTokenService.delAccessTokenById(userLogin, 1);
logger.info(result.toString());
assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.java | }
@Test
public void testUpdateToken() {
User user = new User();
user.setId(1);
user.setUserType(UserType.ADMIN_USER);
Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.ACCESS_TOKEN, 1, ACCESS_TOKEN_UPDATE, baseServiceLogger)).thenReturn(true);
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.ACCESS_TOKEN, new Object[]{1}, 0, baseServiceLogger)).thenReturn(true);
when(accessTokenMapper.selectById(1)).thenReturn(getEntity());
Map<String, Object> result = accessTokenService.updateToken(getLoginUser(), 1,Integer.MAX_VALUE,getDate(),"token");
logger.info(result.toString());
assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
Assert.assertNotNull(result.get(Constants.DATA_LIST));
result = accessTokenService.updateToken(getLoginUser(), 1, Integer.MAX_VALUE,getDate(),null);
logger.info(result.toString());
assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
Assert.assertNotNull(result.get(Constants.DATA_LIST));
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.ACCESS_TOKEN, new Object[]{2}, 0, baseServiceLogger)).thenReturn(true);
result = accessTokenService.updateToken(getLoginUser(), 2,Integer.MAX_VALUE,getDate(),"token");
logger.info(result.toString());
assertEquals(Status.ACCESS_TOKEN_NOT_EXIST, result.get(Constants.STATUS));
}
private User getLoginUser() {
User loginUser = new User();
loginUser.setId(1);
loginUser.setUserType(UserType.ADMIN_USER);
return loginUser; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.java | }
/**
* create entity
*/
private AccessToken getEntity() {
AccessToken accessToken = new AccessToken();
accessToken.setId(1);
accessToken.setUserId(1);
accessToken.setToken("AccessTokenServiceTest");
Date date = DateUtils.add(new Date(), Calendar.DAY_OF_MONTH, 30);
accessToken.setExpireTime(date);
return accessToken;
}
/**
* entity list
*/
private List<AccessToken> getList() {
List<AccessToken> list = new ArrayList<>();
list.add(getEntity());
return list;
}
/**
* get dateStr
*/
private String getDate() {
Date date = DateUtils.add(new Date(), Calendar.DAY_OF_MONTH, 30);
return DateUtils.dateToString(date);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapper.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.dao.mapper;
import org.apache.dolphinscheduler.dao.entity.AccessToken;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* accesstoken mapper interface
*/
public interface AccessTokenMapper extends BaseMapper<AccessToken> { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapper.java | /**
* access token page
*
* @param page page
* @param tokenIds tokenIds |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapper.java | * @param userName userName
* @return access token Ipage
*/
IPage<AccessToken> selectAccessTokenPage(Page page,
@Param("ids") List<Integer> tokenIds,
@Param("userName") String userName
);
/**
* Query access token for specified user
*
* @param userId userId
* @return access token for specified user
*/
List<AccessToken> queryAccessTokenByUser(@Param("userId") int userId);
/**
* delete by userId
*
* @param userId userId
* @return delete result
*/
int deleteAccessTokenByUserId(@Param("userId") int userId);
/**
* list authorized Projects
* @param userId
* @param accessTokensIds
* @return access token for specified user
*/
List<AccessToken> listAuthorizedAccessToken(@Param("userId") int userId, @Param("accessTokensIds")List<Integer> accessTokensIds);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.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.dao.mapper;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.greaterThan;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.dao.BaseDaoTest; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | import org.apache.dolphinscheduler.dao.entity.AccessToken;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* AccessToken mapper test
*/
public class AccessTokenMapperTest extends BaseDaoTest {
@Autowired
private AccessTokenMapper accessTokenMapper;
@Autowired
private UserMapper userMapper;
/**
* test insert
*/
@Test
public void testInsert() throws Exception {
Integer userId = 1;
AccessToken accessToken = createAccessToken(userId);
assertThat(accessToken.getId(), greaterThan(0));
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | * test delete AccessToken By UserId
*/
@Test
public void testDeleteAccessTokenByUserId() {
Integer userId = 1;
int insertCount = 0;
for (int i = 0; i < 10; i++) {
try {
createAccessToken(userId);
insertCount++;
} catch (Exception e) {
e.printStackTrace();
}
}
int deleteCount = accessTokenMapper.deleteAccessTokenByUserId(userId);
Assert.assertEquals(insertCount, deleteCount);
}
/**
* test select by id
*
* @throws Exception
*/
@Test
public void testSelectById() throws Exception {
Integer userId = 1;
AccessToken accessToken = createAccessToken(userId);
AccessToken resultAccessToken = accessTokenMapper.selectById(accessToken.getId());
assertEquals(accessToken, resultAccessToken);
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | * test hashCode method
*
* @throws Exception
*/
@Test
public void testHashCodeMethod() throws Exception {
Integer userId = 1;
AccessToken accessToken = createAccessToken(userId);
AccessToken resultAccessToken = accessTokenMapper.selectById(accessToken.getId());
boolean flag = accessToken.equals(resultAccessToken);
assertTrue(flag);
}
/**
* test equals method
*
* @throws Exception
*/
@Test
public void testEqualsMethod() throws Exception {
Integer userId = 1;
AccessToken accessToken = createAccessToken(userId);
int result = accessToken.hashCode();
assertNotNull(result);
}
/**
* test page
*/
@Test
public void testSelectAccessTokenPage() throws Exception {
Integer count = 4; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | String userName = "zhangsan";
Integer offset = 2;
Integer size = 2;
Map<Integer, AccessToken> accessTokenMap = createAccessTokens(count, userName);
Page page = new Page(offset, size);
List<Integer> tokenIds = accessTokenMap.values().stream().map(AccessToken::getId).collect(Collectors.toList());
IPage<AccessToken> accessTokenPage = accessTokenMapper.selectAccessTokenPage(page, tokenIds, userName);
assertEquals(Integer.valueOf(accessTokenPage.getRecords().size()), size);
for (AccessToken accessToken : accessTokenPage.getRecords()) {
AccessToken resultAccessToken = accessTokenMap.get(accessToken.getId());
assertEquals(accessToken, resultAccessToken);
}
}
/**
* test update
*/
@Test
public void testUpdate() throws Exception {
Integer userId = 1;
AccessToken accessToken = createAccessToken(userId);
accessToken.setToken("56789");
accessToken.setExpireTime(DateUtils.getCurrentDate());
accessToken.setUpdateTime(DateUtils.getCurrentDate());
int status = accessTokenMapper.updateById(accessToken);
if (status != 1) {
Assert.fail("update access token fail");
}
AccessToken resultAccessToken = accessTokenMapper.selectById(accessToken.getId());
assertEquals(accessToken, resultAccessToken); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | }
/**
* test delete
*/
@Test
public void testDelete() throws Exception {
Integer userId = 1;
AccessToken accessToken = createAccessToken(userId);
int status = accessTokenMapper.deleteById(accessToken.getId());
if (status != 1) {
Assert.fail("delete access token data fail");
}
AccessToken resultAccessToken =
accessTokenMapper.selectById(accessToken.getId());
assertNull(resultAccessToken);
}
/**
* create accessTokens
*
* @param count create accessToken count
* @param userName username
* @return accessToken map
* @throws Exception
*/
private Map<Integer, AccessToken> createAccessTokens(
Integer count, String userName) throws Exception {
User user = createUser(userName);
Map<Integer, AccessToken> accessTokenMap = new HashMap<>();
for (int i = 1; i <= count; i++) {
AccessToken accessToken = createAccessToken(user.getId(), userName); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | accessTokenMap.put(accessToken.getId(), accessToken);
}
return accessTokenMap;
}
/**
* create user
*
* @param userName userName
* @return user
*/
private User createUser(String userName) {
User user = new User();
user.setUserName(userName);
user.setUserPassword("123");
user.setUserType(UserType.GENERAL_USER);
user.setEmail("[email protected]");
user.setPhone("13102557272");
user.setTenantId(1);
user.setCreateTime(DateUtils.getCurrentDate());
user.setUpdateTime(DateUtils.getCurrentDate());
user.setQueue("default");
int status = userMapper.insert(user);
if (status != 1) {
Assert.fail("insert user data error");
}
return user;
}
/**
* create access token
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,031 | [Feature][AccessToken] AccessToken can only be used by the creator. | ### 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
AccessToken can only be used by the creator.
### Use case
use access token request.
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11031 | https://github.com/apache/dolphinscheduler/pull/11032 | 1a08f3970d2cf85e8d10d66139fed70eb787fb3a | fd59f0bb326899f7298a33b01e271070ceba112c | 2022-07-18T10:19:54Z | java | 2022-07-20T08:32:03Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | * @param userId userId
* @param userName userName
* @return accessToken
*/
private AccessToken createAccessToken(Integer userId, String userName) {
AccessToken accessToken = new AccessToken();
accessToken.setUserName(userName);
accessToken.setUserId(userId);
accessToken.setToken(String.valueOf(ThreadLocalRandom.current().nextLong()));
accessToken.setCreateTime(DateUtils.getCurrentDate());
accessToken.setUpdateTime(DateUtils.getCurrentDate());
accessToken.setExpireTime(DateUtils.getCurrentDate());
int status = accessTokenMapper.insert(accessToken);
if (status != 1) {
Assert.fail("insert data error");
}
return accessToken;
}
/**
* create access token
*
* @param userId userId
* @return accessToken
* @throws Exception
*/
private AccessToken createAccessToken(Integer userId) throws Exception {
return createAccessToken(userId, null);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/SecurityConfig.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.security;
import org.apache.dolphinscheduler.api.security.impl.ldap.LdapAuthenticator;
import org.apache.dolphinscheduler.api.security.impl.pwd.PasswordAuthenticator;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/SecurityConfig.java | public class SecurityConfig {
private static final Logger logger = LoggerFactory.getLogger(SecurityConfig.class);
@Value("${security.authentication.type:PASSWORD}")
private String type;
private AutowireCapableBeanFactory beanFactory;
private AuthenticationType authenticationType;
@Autowired |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/SecurityConfig.java | public SecurityConfig(AutowireCapableBeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
private void setAuthenticationType(String type) {
if (StringUtils.isBlank(type)) {
logger.info("security.authentication.type configuration is empty, the default value 'PASSWORD'");
this.authenticationType = AuthenticationType.PASSWORD;
return;
}
this.authenticationType = AuthenticationType.valueOf(type);
}
@Bean(name = "authenticator")
public Authenticator authenticator() {
setAuthenticationType(type);
Authenticator authenticator;
switch (authenticationType) {
case PASSWORD:
authenticator = new PasswordAuthenticator();
break;
case LDAP:
authenticator = new LdapAuthenticator();
break;
default:
throw new IllegalStateException("Unexpected value: " + authenticationType);
}
beanFactory.autowireBean(authenticator);
return authenticator;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/impl/AbstractAuthenticator.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.security.impl;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.security.Authenticator;
import org.apache.dolphinscheduler.api.service.SessionService;
import org.apache.dolphinscheduler.api.service.UsersService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.dao.entity.Session;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.Collections; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/impl/AbstractAuthenticator.java | import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
public abstract class AbstractAuthenticator implements Authenticator {
private static final Logger logger = LoggerFactory.getLogger(AbstractAuthenticator.class);
@Autowired
private UsersService userService;
@Autowired
private SessionService sessionService;
/**
* user login and return user in db
*
* @param userId user identity field
* @param password user login password
* @param extra extra user login field
* @return user object in databse
*/
public abstract User login(String userId, String password, String extra);
@Override
public Result<Map<String, String>> authenticate(String userId, String password, String extra) {
Result<Map<String, String>> result = new Result<>();
User user = login(userId, password, extra);
if (user == null) {
result.setCode(Status.USER_NAME_PASSWD_ERROR.getCode());
result.setMsg(Status.USER_NAME_PASSWD_ERROR.getMsg());
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/impl/AbstractAuthenticator.java | if (user.getState() == Flag.NO.ordinal()) {
result.setCode(Status.USER_DISABLED.getCode());
result.setMsg(Status.USER_DISABLED.getMsg());
return result;
}
String sessionId = sessionService.createSession(user, extra);
if (sessionId == null) {
result.setCode(Status.LOGIN_SESSION_FAILED.getCode());
result.setMsg(Status.LOGIN_SESSION_FAILED.getMsg());
return result;
}
logger.info("sessionId : {}", sessionId);
result.setData(Collections.singletonMap(Constants.SESSION_ID, sessionId));
result.setCode(Status.SUCCESS.getCode());
result.setMsg(Status.LOGIN_SUCCESS.getMsg());
return result;
}
@Override
public User getAuthUser(HttpServletRequest request) {
Session session = sessionService.getSession(request);
if (session == null) {
logger.info("session info is null ");
return null;
}
return userService.queryUser(session.getUserId());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/LoginControllerTest.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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/LoginControllerTest.java | * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.controller;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
/**
* login controller test
*/
public class LoginControllerTest extends AbstractControllerTest { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/LoginControllerTest.java | private static final Logger logger = LoggerFactory.getLogger(LoginControllerTest.class);
@Test
public void testLogin() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("userName", "admin");
paramsMap.add("userPassword", "dolphinscheduler123");
MvcResult mvcResult = mockMvc.perform(post("/login")
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testSignOut() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
MvcResult mvcResult = mockMvc.perform(post("/signOut")
.header("sessionId", sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.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;
import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import java.time.Duration;
import java.util.regex.Pattern;
/**
* Constants
*/
public final class Constants { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | private Constants() {
throw new UnsupportedOperationException("Construct Constants");
}
/**
* common properties path
*/
public static final String COMMON_PROPERTIES_PATH = "/common.properties";
/**
* registry properties
*/
public static final String REGISTRY_DOLPHINSCHEDULER_MASTERS = "/nodes/master";
public static final String REGISTRY_DOLPHINSCHEDULER_WORKERS = "/nodes/worker";
public static final String REGISTRY_DOLPHINSCHEDULER_DEAD_SERVERS = "/dead-servers";
public static final String REGISTRY_DOLPHINSCHEDULER_NODE = "/nodes";
public static final String REGISTRY_DOLPHINSCHEDULER_LOCK_MASTERS = "/lock/masters";
public static final String REGISTRY_DOLPHINSCHEDULER_LOCK_FAILOVER_MASTERS = "/lock/failover/masters";
public static final String REGISTRY_DOLPHINSCHEDULER_LOCK_FAILOVER_WORKERS = "/lock/failover/workers";
public static final String REGISTRY_DOLPHINSCHEDULER_LOCK_FAILOVER_STARTUP_MASTERS = "/lock/failover/startup-masters";
public static final String FORMAT_SS = "%s%s";
public static final String FORMAT_S_S = "%s/%s";
public static final String FORMAT_S_S_COLON = "%s:%s";
public static final String FOLDER_SEPARATOR = "/";
public static final String RESOURCE_TYPE_FILE = "resources";
public static final String RESOURCE_TYPE_UDF = "udfs";
public static final String STORAGE_S3 = "S3";
public static final String STORAGE_HDFS = "HDFS";
public static final String EMPTY_STRING = ""; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | /**
* resource.hdfs.fs.defaultFS
*/
public static final String FS_DEFAULT_FS = "resource.hdfs.fs.defaultFS";
/**
* hadoop configuration
*/
public static final String HADOOP_RM_STATE_ACTIVE = "ACTIVE";
public static final String HADOOP_RESOURCE_MANAGER_HTTPADDRESS_PORT = "resource.manager.httpaddress.port";
/**
* yarn.resourcemanager.ha.rm.ids
*/
public static final String YARN_RESOURCEMANAGER_HA_RM_IDS = "yarn.resourcemanager.ha.rm.ids";
/**
* yarn.application.status.address
*/
public static final String YARN_APPLICATION_STATUS_ADDRESS = "yarn.application.status.address";
/**
* yarn.job.history.status.address
*/
public static final String YARN_JOB_HISTORY_STATUS_ADDRESS = "yarn.job.history.status.address";
/**
* hdfs configuration
* resource.hdfs.root.user
*/
public static final String HDFS_ROOT_USER = "resource.hdfs.root.user";
/**
* hdfs/s3 configuration
* resource.storage.upload.base.path
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String RESOURCE_UPLOAD_PATH = "resource.storage.upload.base.path";
/**
* data basedir path
*/
public static final String DATA_BASEDIR_PATH = "data.basedir.path";
/**
* dolphinscheduler.env.path
*/
public static final String DOLPHINSCHEDULER_ENV_PATH = "dolphinscheduler.env.path";
/**
* environment properties default path
*/
public static final String ENV_PATH = "dolphinscheduler_env.sh";
/**
* resource.view.suffixs
*/
public static final String RESOURCE_VIEW_SUFFIXES = "resource.view.suffixs";
public static final String RESOURCE_VIEW_SUFFIXES_DEFAULT_VALUE = "txt,log,sh,bat,conf,cfg,py,java,sql,xml,hql,properties,json,yml,yaml,ini,js";
/**
* development.state
*/
public static final String DEVELOPMENT_STATE = "development.state";
/**
* sudo enable
*/
public static final String SUDO_ENABLE = "sudo.enable";
/**
* string true
*/
public static final String STRING_TRUE = "true"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | /**
* resource storage type
*/
public static final String RESOURCE_STORAGE_TYPE = "resource.storage.type";
public static final String AWS_S3_BUCKET_NAME = "resource.aws.s3.bucket.name";
public static final String AWS_END_POINT = "resource.aws.s3.endpoint";
/**
* comma ,
*/
public static final String COMMA = ",";
/**
* COLON :
*/
public static final String COLON = ":";
/**
* period .
*/
public static final String PERIOD = ".";
/**
* QUESTION ?
*/
public static final String QUESTION = "?";
/**
* SPACE " "
*/
public static final String SPACE = " ";
/**
* SINGLE_SLASH /
*/
public static final String SINGLE_SLASH = "/"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | /**
* DOUBLE_SLASH //
*/
public static final String DOUBLE_SLASH = "//";
/**
* EQUAL SIGN
*/
public static final String EQUAL_SIGN = "=";
/**
* AT SIGN
*/
public static final String AT_SIGN = "@";
/**
* date format of yyyy-MM-dd HH:mm:ss
*/
public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
/**
* date format of yyyyMMdd
*/
public static final String YYYYMMDD = "yyyyMMdd";
/**
* date format of yyyyMMddHHmmss
*/
public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
/**
* date format of yyyyMMddHHmmssSSS
*/
public static final String YYYYMMDDHHMMSSSSS = "yyyyMMddHHmmssSSS";
/**
* http connect time out |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | */
public static final int HTTP_CONNECT_TIMEOUT = 60 * 1000;
/**
* http connect request time out
*/
public static final int HTTP_CONNECTION_REQUEST_TIMEOUT = 60 * 1000;
/**
* httpclient soceket time out
*/
public static final int SOCKET_TIMEOUT = 60 * 1000;
/**
* registry session timeout
*/
public static final int REGISTRY_SESSION_TIMEOUT = 10 * 1000;
/**
* http header
*/
public static final String HTTP_HEADER_UNKNOWN = "unKnown";
/**
* http X-Forwarded-For
*/
public static final String HTTP_X_FORWARDED_FOR = "X-Forwarded-For";
/**
* http X-Real-IP
*/
public static final String HTTP_X_REAL_IP = "X-Real-IP";
/**
* UTF-8
*/
public static final String UTF_8 = "UTF-8"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | /**
* user name regex
*/
public static final Pattern REGEX_USER_NAME = Pattern.compile("^[a-zA-Z0-9._-]{3,39}$");
/**
* read permission
*/
public static final int READ_PERMISSION = 2;
/**
* write permission
*/
public static final int WRITE_PERMISSION = 2 * 2;
/**
* execute permission
*/
public static final int EXECUTE_PERMISSION = 1;
/**
* default admin permission
*/
public static final int DEFAULT_ADMIN_PERMISSION = 7;
/**
* default hash map size
*/
public static final int DEFAULT_HASH_MAP_SIZE = 16;
/**
* all permissions
*/
public static final int ALL_PERMISSIONS = READ_PERMISSION | WRITE_PERMISSION | EXECUTE_PERMISSION;
/**
* max task timeout |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | */
public static final int MAX_TASK_TIMEOUT = 24 * 3600;
/**
* worker host weight
*/
public static final int DEFAULT_WORKER_HOST_WEIGHT = 100;
/**
* time unit secong to minutes
*/
public static final int SEC_2_MINUTES_TIME_UNIT = 60;
/***
*
* rpc port
*/
public static final String RPC_PORT = "rpc.port";
/**
* forbid running task
*/
public static final String FLOWNODE_RUN_FLAG_FORBIDDEN = "FORBIDDEN";
/**
* normal running task
*/
public static final String FLOWNODE_RUN_FLAG_NORMAL = "NORMAL";
public static final String COMMON_TASK_TYPE = "common";
public static final String DEFAULT = "default";
public static final String PASSWORD = "password";
public static final String XXXXXX = "******";
public static final String NULL = "NULL";
public static final String THREAD_NAME_MASTER_SERVER = "Master-Server";
public static final String THREAD_NAME_WORKER_SERVER = "Worker-Server"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String THREAD_NAME_ALERT_SERVER = "Alert-Server";
/**
* command parameter keys
*/
public static final String CMD_PARAM_RECOVER_PROCESS_ID_STRING = "ProcessInstanceId";
public static final String CMD_PARAM_RECOVERY_START_NODE_STRING = "StartNodeIdList";
public static final String CMD_PARAM_RECOVERY_WAITING_THREAD = "WaitingThreadInstanceId";
public static final String CMD_PARAM_SUB_PROCESS = "processInstanceId";
public static final String CMD_PARAM_EMPTY_SUB_PROCESS = "0";
public static final String CMD_PARAM_SUB_PROCESS_PARENT_INSTANCE_ID = "parentProcessInstanceId";
public static final String CMD_PARAM_SUB_PROCESS_DEFINE_CODE = "processDefinitionCode";
public static final String CMD_PARAM_START_NODES = "StartNodeList";
public static final String CMD_PARAM_START_PARAMS = "StartParams";
public static final String CMD_PARAM_FATHER_PARAMS = "fatherParams";
/**
* complement data start date
*/
public static final String CMDPARAM_COMPLEMENT_DATA_START_DATE = "complementStartDate";
/**
* complement data end date
*/
public static final String CMDPARAM_COMPLEMENT_DATA_END_DATE = "complementEndDate";
/**
* complement data Schedule date
*/
public static final String CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST = "complementScheduleDateList";
/**
* complement date default cron string
*/
public static final String DEFAULT_CRON_STRING = "0 0 0 * * ? *"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | /**
* sleep 1000ms
*/
public static final long SLEEP_TIME_MILLIS = 1_000L;
/**
* short sleep 100ms
*/
public static final long SLEEP_TIME_MILLIS_SHORT = 100L;
public static final Duration SERVER_CLOSE_WAIT_TIME = Duration.ofSeconds(3);
/**
* one second mils
*/
public static final long SECOND_TIME_MILLIS = 1_000L;
/**
* master task instance cache-database refresh interval
*/
public static final long CACHE_REFRESH_TIME_MILLIS = 20 * 1_000L;
/**
* heartbeat for zk info length
*/
public static final int HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH = 14;
/**
* jar
*/
public static final String JAR = "jar";
/**
* hadoop
*/
public static final String HADOOP = "hadoop";
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | * -D <property>=<value>
*/
public static final String D = "-D";
/**
* exit code success
*/
public static final int EXIT_CODE_SUCCESS = 0;
/**
* exit code failure
*/
public static final int EXIT_CODE_FAILURE = -1;
/**
* process or task definition failure
*/
public static final int DEFINITION_FAILURE = -1;
public static final int OPPOSITE_VALUE = -1;
/**
* process or task definition first version
*/
public static final int VERSION_FIRST = 1;
/**
* date format of yyyyMMdd
*/
public static final String PARAMETER_FORMAT_DATE = "yyyyMMdd";
/**
* date format of yyyyMMddHHmmss
*/
public static final String PARAMETER_FORMAT_TIME = "yyyyMMddHHmmss";
/**
* system date(yyyyMMddHHmmss) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | */
public static final String PARAMETER_DATETIME = "system.datetime";
/**
* system date(yyyymmdd) today
*/
public static final String PARAMETER_CURRENT_DATE = "system.biz.curdate";
/**
* system date(yyyymmdd) yesterday
*/
public static final String PARAMETER_BUSINESS_DATE = "system.biz.date";
/**
* ACCEPTED
*/
public static final String ACCEPTED = "ACCEPTED";
/**
* SUCCEEDED
*/
public static final String SUCCEEDED = "SUCCEEDED";
/**
* ENDED
*/
public static final String ENDED = "ENDED";
/**
* NEW
*/
public static final String NEW = "NEW";
/**
* NEW_SAVING
*/
public static final String NEW_SAVING = "NEW_SAVING"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | /**
* SUBMITTED
*/
public static final String SUBMITTED = "SUBMITTED";
/**
* FAILED
*/
public static final String FAILED = "FAILED";
/**
* KILLED
*/
public static final String KILLED = "KILLED";
/**
* RUNNING
*/
public static final String RUNNING = "RUNNING";
/**
* underline "_"
*/
public static final String UNDERLINE = "_";
/**
* application regex
*/
public static final String APPLICATION_REGEX = "application_\\d+_\\d+";
public static final String PID = SystemUtils.IS_OS_WINDOWS ? "handle" : "pid";
/**
* month_begin
*/
public static final String MONTH_BEGIN = "month_begin";
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | * 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
*/
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 STAR = "*";
public static final String DIVISION_STRING = "/";
public static final String LEFT_BRACE_STRING = "(";
public static final char P = 'P'; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | 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 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 WAIT_START_TIMEOUT = "waitStartTimeout";
public static final String DEPENDENCE = "dependence";
public static final String TASK_LIST = "taskList";
public static final String QUEUE = "queue";
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;
public static final String BLOCKING_CONDITION = "blockingCondition";
public static final String ALERT_WHEN_BLOCKING = "alertWhenBlocking";
/**
* master/worker server use for zk
*/
public static final String MASTER_TYPE = "master";
public static final String WORKER_TYPE = "worker";
public static final String DELETE_OP = "delete";
public static final String ADD_OP = "add";
public static final String ALIAS = "alias";
public static final String CONTENT = "content";
public static final String DEPENDENT_SPLIT = ":||";
public static final long DEPENDENT_ALL_TASK_CODE = 0;
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | * preview schedule execute count
*/
public static final int PREVIEW_SCHEDULE_EXECUTE_COUNT = 5;
/**
* kerberos
*/
public static final String KERBEROS = "kerberos";
/**
* kerberos expire time
*/
public static final String KERBEROS_EXPIRE_TIME = "kerberos.expire.time";
/**
* 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";
/**
* 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";
/**
* com.amazonaws.services.s3.enableV4
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String AWS_S3_V4 = "com.amazonaws.services.s3.enableV4";
/**
* 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";
public static final String WORKFLOW_INSTANCE_ID_MDC_KEY = "workflowInstanceId";
public static final String TASK_INSTANCE_ID_MDC_KEY = "taskInstanceId";
/**
* task log info format
*/
public static final String TASK_LOG_INFO_FORMAT = "TaskLogInfo-%s";
public static final int[] NOT_TERMINATED_STATES = new int[] {
ExecutionStatus.SUBMITTED_SUCCESS.ordinal(),
ExecutionStatus.DISPATCH.ordinal(),
ExecutionStatus.RUNNING_EXECUTION.ordinal(),
ExecutionStatus.DELAY_EXECUTION.ordinal(),
ExecutionStatus.READY_PAUSE.ordinal(),
ExecutionStatus.READY_STOP.ordinal(),
ExecutionStatus.NEED_FAULT_TOLERANCE.ordinal(),
ExecutionStatus.WAITING_THREAD.ordinal(),
ExecutionStatus.WAITING_DEPEND.ordinal()
};
public static final int[] RUNNING_PROCESS_STATE = new int[] {
ExecutionStatus.RUNNING_EXECUTION.ordinal(),
ExecutionStatus.SUBMITTED_SUCCESS.ordinal(),
ExecutionStatus.DISPATCH.ordinal(), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | ExecutionStatus.SERIAL_WAIT.ordinal()
};
/**
* status
*/
public static final String STATUS = "status";
/**
* message
*/
public static final String MSG = "msg";
/**
* data total
*/
public static final String COUNT = "count";
/**
* page size
*/
public static final String PAGE_SIZE = "pageSize";
/**
* current page no
*/
public static final String PAGE_NUMBER = "pageNo";
/**
*
*/
public static final String DATA_LIST = "data";
public static final String TOTAL_LIST = "totalList";
public static final String CURRENT_PAGE = "currentPage";
public static final String TOTAL_PAGE = "totalPage";
public static final String TOTAL = "total"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | /**
* workflow
*/
public static final String WORKFLOW_LIST = "workFlowList";
public static final String WORKFLOW_RELATION_LIST = "workFlowRelationList";
/**
* session user
*/
public static final String SESSION_USER = "session.user";
public static final String SESSION_ID = "sessionId";
/**
* locale
*/
public static final String LOCALE_LANGUAGE = "language";
/**
* database type
*/
public static final String MYSQL = "MYSQL";
public static final String HIVE = "HIVE";
public static final String ADDRESS = "address";
public static final String DATABASE = "database";
public static final String OTHER = "other";
public static final String USER = "user";
public static final String JDBC_URL = "jdbcUrl";
/**
* session timeout
*/
public static final int SESSION_TIME_OUT = 7200;
public static final int MAX_FILE_SIZE = 1024 * 1024 * 1024;
public static final String UDF = "UDF"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String CLASS = "class";
/**
* dataSource sensitive param
*/
public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))";
/**
* default worker group
*/
public static final String DEFAULT_WORKER_GROUP = "default";
/**
* authorize writable perm
*/
public static final int AUTHORIZE_WRITABLE_PERM = 7;
/**
* authorize readable perm
*/
public static final int AUTHORIZE_READABLE_PERM = 4;
public static final int NORMAL_NODE_STATUS = 0;
public static final int ABNORMAL_NODE_STATUS = 1;
public static final int BUSY_NODE_STATUE = 2;
public static final String START_TIME = "start time";
public static final String END_TIME = "end time";
public static final String START_END_DATE = "startDate,endDate";
/**
* system line separator
*/
public static final String SYSTEM_LINE_SEPARATOR = System.getProperty("line.separator");
/**
* datasource encryption salt
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | 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";
/**
* network interface preferred
*/
public static final String DOLPHIN_SCHEDULER_NETWORK_INTERFACE_PREFERRED = "dolphin.scheduler.network.interface.preferred";
/**
* network IP gets priority, default inner outer
*/
public static final String DOLPHIN_SCHEDULER_NETWORK_PRIORITY_STRATEGY = "dolphin.scheduler.network.priority.strategy";
/**
* exec shell scripts
*/
public static final String SH = "sh";
/**
* pstree, get pud and sub pid
*/
public static final String PSTREE = "pstree";
public static final boolean KUBERNETES_MODE = !StringUtils.isEmpty(System.getenv("KUBERNETES_SERVICE_HOST")) && !StringUtils.isEmpty(System.getenv("KUBERNETES_SERVICE_PORT"));
/**
* dry run flag
*/
public static final int DRY_RUN_FLAG_NO = 0;
public static final int DRY_RUN_FLAG_YES = 1;
/**
* data.quality.error.output.path
*/
public static final String DATA_QUALITY_ERROR_OUTPUT_PATH = "data-quality.error.output.path";
public static final String CACHE_KEY_VALUE_ALL = "'all'"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,507 | [Improvement][LDAP] Hide Change Pwd Page When Login With LDAP | ### 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
Hi, guys. Recently, We have tried to enable LDAP on DS and found some questions that can improve.
When you log in with LDAP. And there are still change password pages. But LDAP users have no password config. I think hiding this page when you log in with LDAP is better.
I have finished the back-end part. When login will return `securityConfigType`, and now need front part support.
### Use case
When login and return `securityConfigType` at `dolphinscheduler/login` api
```
{
"code": 0,
"msg": "login success",
"data": {
"sessionId": "f4d710b7-bbae-4078-a574-de6358969615",
"securityConfigType": "PASSWORD"
},
"success": true,
"failed": false
}
```
Hide this btn when `securityConfigType` is `LDAP`
<img width="389" alt="WeChatf7516bac11afebca0372e516cda659d8" src="https://user-images.githubusercontent.com/20885366/174530891-2109011a-7fcf-4adb-9938-deb2c2e60d64.png">
### Related issues
back-end part is #10502
front-end part is #11029
part of #10425
### Are you willing to submit a 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/10507 | https://github.com/apache/dolphinscheduler/pull/11041 | fd59f0bb326899f7298a33b01e271070ceba112c | 28b40da1b134fb54296ef9d1a8b13268f289fbf0 | 2022-06-20T05:29:37Z | java | 2022-07-20T10:48:16Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | /**
* use for k8s
*/
public static final String NAMESPACE = "namespace";
public static final String CLUSTER = "cluster";
public static final String LIMITS_CPU = "limitsCpu";
public static final String LIMITS_MEMORY = "limitsMemory";
public static final Long K8S_LOCAL_TEST_CLUSTER_CODE = 0L;
/**
* schedule timezone
*/
public static final String SCHEDULE_TIMEZONE = "schedule_timezone";
public static final int RESOURCE_FULL_NAME_MAX_LENGTH = 128;
/**
* tenant
*/
public static final int TENANT_FULL_NAME_MAX_LENGTH = 30;
/**
* schedule time the amount of date data is too large, affecting the memory, so set 100
*/
public static final int SCHEDULE_TIME_MAX_LENGTH = 100;
/**
* password max and min LENGTH
*/
public static final int USER_PASSWORD_MAX_LENGTH = 20;
public static final int USER_PASSWORD_MIN_LENGTH = 2;
public static final String FUNCTION_START_WITH = "$";
public static final Integer DEFAULT_QUEUE_ID = 1;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,918 | [Bug] [DataSource] MySQL Connection number increasing | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in dolphin worker-server, mysql connection number increasing always, which lead mysql server cannot work.

while the mysql connection like below:

### What you expected to happen
mysql connection number keep in normal number,
### How to reproduce
use MySQL DataSource to perform frequent operations, such as query and create table/delete table/update table.
### Anything else
_No response_
### Version
3.0.0-beta-2
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10918 | https://github.com/apache/dolphinscheduler/pull/11120 | 952aee80e78246dd6ea67ebbc6a7d3ade2ae2f62 | 71cf7e1baa7b813ac381c37c0345e837d2c07557 | 2022-07-13T00:49:08Z | java | 2022-07-23T12:43:37Z | dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClient.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
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,918 | [Bug] [DataSource] MySQL Connection number increasing | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in dolphin worker-server, mysql connection number increasing always, which lead mysql server cannot work.

while the mysql connection like below:

### What you expected to happen
mysql connection number keep in normal number,
### How to reproduce
use MySQL DataSource to perform frequent operations, such as query and create table/delete table/update table.
### Anything else
_No response_
### Version
3.0.0-beta-2
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10918 | https://github.com/apache/dolphinscheduler/pull/11120 | 952aee80e78246dd6ea67ebbc6a7d3ade2ae2f62 | 71cf7e1baa7b813ac381c37c0345e837d2c07557 | 2022-07-13T00:49:08Z | java | 2022-07-23T12:43:37Z | dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClient.java | * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.datasource.api.client;
import org.apache.dolphinscheduler.plugin.datasource.api.provider.JDBCDataSourceProvider;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.datasource.DataSourceClient;
import org.apache.dolphinscheduler.spi.enums.DbType;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.concurrent.TimeUnit;
import javax.sql.DataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.JdbcTemplate;
import com.google.common.base.Stopwatch;
public class CommonDataSourceClient implements DataSourceClient {
private static final Logger logger = LoggerFactory.getLogger(CommonDataSourceClient.class);
public static final String COMMON_USER = "root";
public static final String COMMON_VALIDATION_QUERY = "select 1";
protected final BaseConnectionParam baseConnectionParam;
protected DataSource dataSource;
protected JdbcTemplate jdbcTemplate;
public CommonDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
this.baseConnectionParam = baseConnectionParam;
preInit(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,918 | [Bug] [DataSource] MySQL Connection number increasing | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in dolphin worker-server, mysql connection number increasing always, which lead mysql server cannot work.

while the mysql connection like below:

### What you expected to happen
mysql connection number keep in normal number,
### How to reproduce
use MySQL DataSource to perform frequent operations, such as query and create table/delete table/update table.
### Anything else
_No response_
### Version
3.0.0-beta-2
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10918 | https://github.com/apache/dolphinscheduler/pull/11120 | 952aee80e78246dd6ea67ebbc6a7d3ade2ae2f62 | 71cf7e1baa7b813ac381c37c0345e837d2c07557 | 2022-07-13T00:49:08Z | java | 2022-07-23T12:43:37Z | dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClient.java | checkEnv(baseConnectionParam);
initClient(baseConnectionParam, dbType);
checkClient();
}
protected void preInit() {
logger.info("preInit in CommonDataSourceClient");
}
protected void checkEnv(BaseConnectionParam baseConnectionParam) {
checkValidationQuery(baseConnectionParam);
checkUser(baseConnectionParam);
}
protected void initClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
this.dataSource = JDBCDataSourceProvider.createJdbcDataSource(baseConnectionParam, dbType);
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
protected void checkUser(BaseConnectionParam baseConnectionParam) {
if (StringUtils.isBlank(baseConnectionParam.getUser())) {
setDefaultUsername(baseConnectionParam);
}
}
protected void setDefaultUsername(BaseConnectionParam baseConnectionParam) {
baseConnectionParam.setUser(COMMON_USER);
}
protected void checkValidationQuery(BaseConnectionParam baseConnectionParam) {
if (StringUtils.isBlank(baseConnectionParam.getValidationQuery())) {
setDefaultValidationQuery(baseConnectionParam);
}
}
protected void setDefaultValidationQuery(BaseConnectionParam baseConnectionParam) {
baseConnectionParam.setValidationQuery(COMMON_VALIDATION_QUERY); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,918 | [Bug] [DataSource] MySQL Connection number increasing | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in dolphin worker-server, mysql connection number increasing always, which lead mysql server cannot work.

while the mysql connection like below:

### What you expected to happen
mysql connection number keep in normal number,
### How to reproduce
use MySQL DataSource to perform frequent operations, such as query and create table/delete table/update table.
### Anything else
_No response_
### Version
3.0.0-beta-2
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10918 | https://github.com/apache/dolphinscheduler/pull/11120 | 952aee80e78246dd6ea67ebbc6a7d3ade2ae2f62 | 71cf7e1baa7b813ac381c37c0345e837d2c07557 | 2022-07-13T00:49:08Z | java | 2022-07-23T12:43:37Z | dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClient.java | }
@Override
public void checkClient() {
Stopwatch stopwatch = Stopwatch.createStarted();
try {
this.jdbcTemplate.execute(this.baseConnectionParam.getValidationQuery());
} catch (Exception e) {
throw new RuntimeException("JDBC connect failed", e);
} finally {
logger.info("Time to execute check jdbc client with sql {} for {} ms ", this.baseConnectionParam.getValidationQuery(), stopwatch.elapsed(TimeUnit.MILLISECONDS));
}
}
@Override
public Connection getConnection() {
try {
return this.dataSource.getConnection();
} catch (SQLException e) {
logger.error("get druidDataSource Connection fail SQLException: {}", e.getMessage(), e);
return null;
}
}
@Override
public void close() {
logger.info("do close dataSource.");
this.dataSource = null;
this.jdbcTemplate = null;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,918 | [Bug] [DataSource] MySQL Connection number increasing | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in dolphin worker-server, mysql connection number increasing always, which lead mysql server cannot work.

while the mysql connection like below:

### What you expected to happen
mysql connection number keep in normal number,
### How to reproduce
use MySQL DataSource to perform frequent operations, such as query and create table/delete table/update table.
### Anything else
_No response_
### Version
3.0.0-beta-2
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10918 | https://github.com/apache/dolphinscheduler/pull/11120 | 952aee80e78246dd6ea67ebbc6a7d3ade2ae2f62 | 71cf7e1baa7b813ac381c37c0345e837d2c07557 | 2022-07-13T00:49:08Z | java | 2022-07-23T12:43:37Z | dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/plugin/DataSourceClientProvider.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 | 10,918 | [Bug] [DataSource] MySQL Connection number increasing | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in dolphin worker-server, mysql connection number increasing always, which lead mysql server cannot work.

while the mysql connection like below:

### What you expected to happen
mysql connection number keep in normal number,
### How to reproduce
use MySQL DataSource to perform frequent operations, such as query and create table/delete table/update table.
### Anything else
_No response_
### Version
3.0.0-beta-2
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10918 | https://github.com/apache/dolphinscheduler/pull/11120 | 952aee80e78246dd6ea67ebbc6a7d3ade2ae2f62 | 71cf7e1baa7b813ac381c37c0345e837d2c07557 | 2022-07-13T00:49:08Z | java | 2022-07-23T12:43:37Z | dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/plugin/DataSourceClientProvider.java | */
package org.apache.dolphinscheduler.plugin.datasource.api.plugin;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils;
import org.apache.dolphinscheduler.plugin.task.api.TaskConstants;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.datasource.ConnectionParam;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceClient;
import org.apache.dolphinscheduler.spi.enums.DbType;
import org.apache.dolphinscheduler.spi.utils.PropertyUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
public class DataSourceClientProvider {
private static final Logger logger = LoggerFactory.getLogger(DataSourceClientProvider.class);
private static long duration = PropertyUtils.getLong(TaskConstants.KERBEROS_EXPIRE_TIME, 24);
private static final Cache<String, DataSourceClient> uniqueId2dataSourceClientCache = CacheBuilder.newBuilder()
.expireAfterWrite(duration, TimeUnit.HOURS)
.maximumSize(100)
.build();
private DataSourcePluginManager dataSourcePluginManager;
private DataSourceClientProvider() {
initDataSourcePlugin();
}
private static class DataSourceClientProviderHolder { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.