status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
timestamp[us, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/LoggerServiceImpl.java
|
int lineNum = log.split("\\r\\n").length;
result.setData(new ResponseTaskLog(lineNum, log));
return result;
}
/**
* get log size
*
* @param taskInstId task instance id
* @return log byte array
*/
@Override
public byte[] getLogBytes(int taskInstId) {
TaskInstance taskInstance = taskInstanceDao.findTaskInstanceById(taskInstId);
if (taskInstance == null || StringUtils.isBlank(taskInstance.getHost())) {
throw new ServiceException("task instance is null or host is null");
}
return getLogBytes(taskInstance);
}
/**
* query log
*
* @param loginUser login user
* @param projectCode project code
* @param taskInstId task instance id
* @param skipLineNum skip line number
* @param limit limit
* @return log string data
*/
@Override
@SuppressWarnings("unchecked")
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/LoggerServiceImpl.java
|
public Map<String, Object> queryLog(User loginUser, long projectCode, int taskInstId, int skipLineNum, int limit) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, VIEW_LOG);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
TaskInstance task = taskInstanceDao.findTaskInstanceById(taskInstId);
if (task == null || StringUtils.isBlank(task.getHost())) {
putMsg(result, Status.TASK_INSTANCE_NOT_FOUND);
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(task.getTaskCode());
if (taskDefinition != null && projectCode != taskDefinition.getProjectCode()) {
putMsg(result, Status.TASK_INSTANCE_NOT_FOUND, taskInstId);
return result;
}
String log = queryLog(task, skipLineNum, limit);
result.put(Constants.DATA_LIST, log);
return result;
}
/**
* get log bytes
*
* @param loginUser login user
* @param projectCode project code
* @param taskInstId task instance id
* @return log byte array
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/LoggerServiceImpl.java
|
@Override
public byte[] getLogBytes(User loginUser, long projectCode, int taskInstId) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, DOWNLOAD_LOG);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
throw new ServiceException("user has no permission");
}
TaskInstance task = taskInstanceDao.findTaskInstanceById(taskInstId);
if (task == null || StringUtils.isBlank(task.getHost())) {
throw new ServiceException("task instance is null or host is null");
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(task.getTaskCode());
if (taskDefinition != null && projectCode != taskDefinition.getProjectCode()) {
throw new ServiceException("task instance does not exist in project");
}
return getLogBytes(task);
}
/**
* query log
*
* @param taskInstance task instance
* @param skipLineNum skip line number
* @param limit limit
* @return log string data
*/
private String queryLog(TaskInstance taskInstance, int skipLineNum, int limit) {
Host host = Host.of(taskInstance.getHost());
logger.info("Query task instance log, taskInstanceId:{}, taskInstanceName:{}, host:{}, logPath:{}, port:{}",
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/LoggerServiceImpl.java
|
taskInstance.getId(), taskInstance.getName(), host.getIp(), taskInstance.getLogPath(), host.getPort());
StringBuilder log = new StringBuilder();
if (skipLineNum == 0) {
String head = String.format(LOG_HEAD_FORMAT,
taskInstance.getLogPath(),
host,
Constants.SYSTEM_LINE_SEPARATOR);
log.append(head);
}
log.append(logClient
.rollViewLog(host.getIp(), host.getPort(), taskInstance.getLogPath(), skipLineNum, limit));
return log.toString();
}
/**
* get log bytes
*
* @param taskInstance task instance
* @return log byte array
*/
private byte[] getLogBytes(TaskInstance taskInstance) {
Host host = Host.of(taskInstance.getHost());
byte[] head = String.format(LOG_HEAD_FORMAT,
taskInstance.getLogPath(),
host,
Constants.SYSTEM_LINE_SEPARATOR).getBytes(StandardCharsets.UTF_8);
return Bytes.concat(head,
logClient.getLogBytes(host.getIp(), host.getPort(), taskInstance.getLogPath()));
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.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.INSTANCE_DELETE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.INSTANCE_UPDATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_INSTANCE;
import static org.apache.dolphinscheduler.api.enums.Status.PROCESS_INSTANCE_NOT_EXIST;
import static org.apache.dolphinscheduler.api.enums.Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR;
import static org.apache.dolphinscheduler.common.constants.Constants.DATA_LIST;
import static org.apache.dolphinscheduler.common.constants.Constants.DEPENDENT_SPLIT;
import static org.apache.dolphinscheduler.common.constants.Constants.GLOBAL_PARAMS;
import static org.apache.dolphinscheduler.common.constants.Constants.LOCAL_PARAMS;
import static org.apache.dolphinscheduler.common.constants.Constants.PROCESS_INSTANCE_STATE;
import static org.apache.dolphinscheduler.common.constants.Constants.TASK_LIST;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_DEPENDENT;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_SUB_PROCESS;
import org.apache.dolphinscheduler.api.dto.gantt.GanttDto;
import org.apache.dolphinscheduler.api.dto.gantt.Task;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.ExecutorService;
import org.apache.dolphinscheduler.api.service.LoggerService;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
import org.apache.dolphinscheduler.api.service.ProcessInstanceService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.service.UsersService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus;
import org.apache.dolphinscheduler.common.graph.DAG;
import org.apache.dolphinscheduler.common.model.TaskNodeRelation;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.placeholder.BusinessTimeUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.ResponseTaskLog;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.Tenant;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
import org.apache.dolphinscheduler.dao.repository.ProcessInstanceDao;
import org.apache.dolphinscheduler.dao.repository.TaskInstanceDao;
import org.apache.dolphinscheduler.dao.utils.WorkflowUtils;
import org.apache.dolphinscheduler.plugin.task.api.enums.DependResult;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.dolphinscheduler.plugin.task.api.parameters.ParametersNode;
import org.apache.dolphinscheduler.plugin.task.api.utils.ParameterUtils;
import org.apache.dolphinscheduler.service.expand.CuringParamsService;
import org.apache.dolphinscheduler.service.model.TaskNode;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.task.TaskPluginManager;
import org.apache.commons.lang3.StringUtils;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* process instance service impl
*/
@Service
public class ProcessInstanceServiceImpl extends BaseServiceImpl implements ProcessInstanceService {
private static final Logger logger = LoggerFactory.getLogger(ProcessInstanceServiceImpl.class);
public static final String TASK_TYPE = "taskType";
public static final String LOCAL_PARAMS_LIST = "localParamsList";
@Autowired
ProjectMapper projectMapper;
@Autowired
ProjectService projectService;
@Autowired
ProcessService processService;
@Autowired
TaskInstanceDao taskInstanceDao;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
@Autowired
ProcessInstanceMapper processInstanceMapper;
@Autowired
ProcessInstanceDao processInstanceDao;
@Autowired
ProcessDefinitionMapper processDefineMapper;
@Autowired
ProcessDefinitionService processDefinitionService;
@Autowired
ExecutorService execService;
@Autowired
TaskInstanceMapper taskInstanceMapper;
@Autowired
LoggerService loggerService;
@Autowired
ProcessDefinitionLogMapper processDefinitionLogMapper;
@Autowired
TaskDefinitionLogMapper taskDefinitionLogMapper;
@Autowired
UsersService usersService;
@Autowired
private TenantMapper tenantMapper;
@Autowired
TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private TaskPluginManager taskPluginManager;
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
private CuringParamsService curingGlobalParamsService;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
/**
* return top n SUCCESS process instance order by running time which started between startTime and endTime
*/
@Override
public Map<String, Object> queryTopNLongestRunningProcessInstance(User loginUser, long projectCode, int size,
String startTime, String endTime) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (0 > size) {
putMsg(result, Status.NEGTIVE_SIZE_NUMBER_ERROR, size);
return result;
}
if (Objects.isNull(startTime)) {
putMsg(result, Status.DATA_IS_NULL, Constants.START_TIME);
return result;
}
Date start = DateUtils.stringToDate(startTime);
if (Objects.isNull(endTime)) {
putMsg(result, Status.DATA_IS_NULL, Constants.END_TIME);
return result;
}
Date end = DateUtils.stringToDate(endTime);
if (start == null || end == null) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.START_END_DATE);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
}
if (start.getTime() > end.getTime()) {
putMsg(result, Status.START_TIME_BIGGER_THAN_END_TIME_ERROR, startTime, endTime);
return result;
}
List<ProcessInstance> processInstances = processInstanceMapper.queryTopNProcessInstance(size, start, end,
WorkflowExecutionStatus.SUCCESS, projectCode);
result.put(DATA_LIST, processInstances);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process instance by id
*
* @param loginUser login user
* @param projectCode project code
* @param processId process instance id
* @return process instance detail
*/
@Override
public Map<String, Object> queryProcessInstanceById(User loginUser, long projectCode, Integer processId) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processId)
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processId));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
ProcessDefinition processDefinition =
processService.findProcessDefinition(processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion());
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, projectCode:{}.", projectCode);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId);
} else {
Tenant tenant = tenantMapper.queryById(processDefinition.getTenantId());
if (tenant != null) {
processDefinition.setTenantCode(tenant.getTenantCode());
}
processInstance.setLocations(processDefinition.getLocations());
processInstance.setDagData(processService.genDagData(processDefinition));
result.put(DATA_LIST, processInstance);
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* paging query process instance list, filtering according to project, process definition, time range, keyword, process status
*
* @param loginUser login user
* @param projectCode project code
* @param processDefineCode process definition code
* @param pageNo page number
* @param pageSize page size
* @param searchVal search value
* @param stateType state type
* @param host host
* @param startDate start time
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
* @param endDate end time
* @param otherParamsJson otherParamsJson handle other params
* @return process instance list
*/
@Override
public Result queryProcessInstanceList(User loginUser, long projectCode, long processDefineCode, String startDate,
String endDate, String searchVal, String executorName,
WorkflowExecutionStatus stateType, String host, String otherParamsJson,
Integer pageNo, Integer pageSize) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
Status resultEnum = (Status) checkResult.get(Constants.STATUS);
if (resultEnum != Status.SUCCESS) {
putMsg(result, resultEnum);
return result;
}
int[] statusArray = null;
if (stateType != null) {
statusArray = new int[]{stateType.getCode()};
}
Map<String, Object> checkAndParseDateResult = checkAndParseDateParameters(startDate, endDate);
resultEnum = (Status) checkAndParseDateResult.get(Constants.STATUS);
if (resultEnum != Status.SUCCESS) {
putMsg(result, resultEnum);
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
Date start = (Date) checkAndParseDateResult.get(Constants.START_TIME);
Date end = (Date) checkAndParseDateResult.get(Constants.END_TIME);
Page<ProcessInstance> page = new Page<>(pageNo, pageSize);
PageInfo<ProcessInstance> pageInfo = new PageInfo<>(pageNo, pageSize);
int executorId = usersService.getUserIdByName(executorName);
IPage<ProcessInstance> processInstanceList = processInstanceMapper.queryProcessInstanceListPaging(page,
project.getCode(), processDefineCode, searchVal, executorId, statusArray, host, start, end);
List<ProcessInstance> processInstances = processInstanceList.getRecords();
List<Integer> userIds = Collections.emptyList();
if (CollectionUtils.isNotEmpty(processInstances)) {
userIds = processInstances.stream().map(ProcessInstance::getExecutorId).collect(Collectors.toList());
}
List<User> users = usersService.queryUser(userIds);
Map<Integer, User> idToUserMap = Collections.emptyMap();
if (CollectionUtils.isNotEmpty(users)) {
idToUserMap = users.stream().collect(Collectors.toMap(User::getId, Function.identity()));
}
for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(WorkflowUtils.getWorkflowInstanceDuration(processInstance));
User executor = idToUserMap.get(processInstance.getExecutorId());
if (null != executor) {
processInstance.setExecutorName(executor.getUserName());
}
}
pageInfo.setTotal((int) processInstanceList.getTotal());
pageInfo.setTotalList(processInstances);
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
/**
* query task list by process instance id
*
* @param loginUser login user
* @param projectCode project code
* @param processId process instance id
* @return task list for the process instance
* @throws IOException io exception
*/
@Override
public Map<String, Object> queryTaskListByProcessId(User loginUser, long projectCode,
Integer processId) throws IOException {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processId)
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processId));
ProcessDefinition processDefinition =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition != null && projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, projectCode:{}, processDefinitionId:{}.", projectCode,
processId);
putMsg(result, PROCESS_INSTANCE_NOT_EXIST, processId);
return result;
}
List<TaskInstance> taskInstanceList =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
taskInstanceDao.findValidTaskListByProcessId(processId, processInstance.getTestFlag());
addDependResultForTaskList(taskInstanceList);
Map<String, Object> resultMap = new HashMap<>();
resultMap.put(PROCESS_INSTANCE_STATE, processInstance.getState().toString());
resultMap.put(TASK_LIST, taskInstanceList);
result.put(DATA_LIST, resultMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* add dependent result for dependent task
*/
private void addDependResultForTaskList(List<TaskInstance> taskInstanceList) throws IOException {
for (TaskInstance taskInstance : taskInstanceList) {
if (TASK_TYPE_DEPENDENT.equalsIgnoreCase(taskInstance.getTaskType())) {
logger.info("DEPENDENT type task instance need to set dependent result, taskCode:{}, taskInstanceId:{}",
taskInstance.getTaskCode(), taskInstance.getId());
Result<ResponseTaskLog> logResult = loggerService.queryLog(
taskInstance.getId(), Constants.LOG_QUERY_SKIP_LINE_NUMBER, Constants.LOG_QUERY_LIMIT);
if (logResult.getCode() == Status.SUCCESS.ordinal()) {
String log = logResult.getData().getMessage();
Map<String, DependResult> resultMap = parseLogForDependentResult(log);
taskInstance.setDependentResult(JSONUtils.toJsonString(resultMap));
}
}
}
}
@Override
public Map<String, DependResult> parseLogForDependentResult(String log) throws IOException {
Map<String, DependResult> resultMap = new HashMap<>();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
if (StringUtils.isEmpty(log)) {
logger.warn("Log content is empty.");
return resultMap;
}
BufferedReader br = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(log.getBytes(
StandardCharsets.UTF_8)), StandardCharsets.UTF_8));
String line;
while ((line = br.readLine()) != null) {
if (line.contains(DEPENDENT_SPLIT)) {
String[] tmpStringArray = line.split(":\\|\\|");
if (tmpStringArray.length != 2) {
continue;
}
String dependResultString = tmpStringArray[1];
String[] dependStringArray = dependResultString.split(",");
if (dependStringArray.length != 2) {
continue;
}
String key = dependStringArray[0].trim();
DependResult dependResult = DependResult.valueOf(dependStringArray[1].trim());
resultMap.put(key, dependResult);
}
}
return resultMap;
}
/**
* query sub process instance detail info by task id
*
* @param loginUser login user
* @param projectCode project code
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
* @param taskId task id
* @return sub process instance detail
*/
@Override
public Map<String, Object> querySubProcessInstanceByTaskId(User loginUser, long projectCode, Integer taskId) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
TaskInstance taskInstance = taskInstanceDao.findTaskInstanceById(taskId);
if (taskInstance == null) {
logger.error("Task instance does not exist, projectCode:{}, taskInstanceId{}.", projectCode, taskId);
putMsg(result, Status.TASK_INSTANCE_NOT_EXISTS, taskId);
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskInstance.getTaskCode());
if (taskDefinition != null && projectCode != taskDefinition.getProjectCode()) {
logger.error("Task definition does not exist, projectCode:{}, taskDefinitionCode:{}.", projectCode,
taskInstance.getTaskCode());
putMsg(result, Status.TASK_INSTANCE_NOT_EXISTS, taskId);
return result;
}
if (!taskInstance.isSubProcess()) {
logger.warn("Task instance is not {} type instance, projectCode:{}, taskInstanceId:{}.",
TASK_TYPE_SUB_PROCESS, projectCode, taskId);
putMsg(result, Status.TASK_INSTANCE_NOT_SUB_WORKFLOW_INSTANCE, taskInstance.getName());
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
}
ProcessInstance subWorkflowInstance = processService.findSubProcessInstance(
taskInstance.getProcessInstanceId(), taskInstance.getId());
if (subWorkflowInstance == null) {
logger.error("SubProcess instance does not exist, projectCode:{}, taskInstanceId:{}.", projectCode,
taskInstance.getId());
putMsg(result, Status.SUB_PROCESS_INSTANCE_NOT_EXIST, taskId);
return result;
}
Map<String, Object> dataMap = new HashMap<>();
dataMap.put(Constants.SUBPROCESS_INSTANCE_ID, subWorkflowInstance.getId());
result.put(DATA_LIST, dataMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* update process instance
*
* @param loginUser login user
* @param projectCode project code
* @param taskRelationJson process task relation json
* @param taskDefinitionJson taskDefinitionJson
* @param processInstanceId process instance id
* @param scheduleTime schedule time
* @param syncDefine sync define
* @param globalParams
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @return update result code
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
*/
@Transactional
@Override
public Map<String, Object> updateProcessInstance(User loginUser, long projectCode, Integer processInstanceId,
String taskRelationJson,
String taskDefinitionJson, String scheduleTime, Boolean syncDefine,
String globalParams,
String locations, int timeout, String tenantCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_UPDATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId)
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processInstanceId));
ProcessDefinition processDefinition0 =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition0 != null && projectCode != processDefinition0.getProjectCode()) {
logger.error("Process definition does not exist, projectCode:{}, processDefinitionCode:{}.", projectCode,
processInstance.getProcessDefinitionCode());
putMsg(result, PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
return result;
}
if (!processInstance.getState().isFinished()) {
logger.warn("Process Instance state is {} so can not update process instance, processInstanceId:{}.",
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
processInstance.getState().getDesc(), processInstanceId);
putMsg(result, PROCESS_INSTANCE_STATE_OPERATION_ERROR,
processInstance.getName(), processInstance.getState().toString(), "update");
return result;
}
Map<String, String> commandParamMap = JSONUtils.toMap(processInstance.getCommandParam());
String timezoneId = null;
if (commandParamMap == null || StringUtils.isBlank(commandParamMap.get(Constants.SCHEDULE_TIMEZONE))) {
timezoneId = loginUser.getTimeZone();
} else {
timezoneId = commandParamMap.get(Constants.SCHEDULE_TIMEZONE);
}
setProcessInstance(processInstance, tenantCode, scheduleTime, globalParams, timeout, timezoneId);
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
if (taskDefinitionLogs.isEmpty()) {
logger.warn("Parameter taskDefinitionJson is empty");
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson);
return result;
}
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (!taskPluginManager.checkTaskParameters(ParametersNode.builder()
.taskType(taskDefinitionLog.getTaskType())
.taskParams(taskDefinitionLog.getTaskParams())
.dependence(taskDefinitionLog.getDependence())
.build())) {
logger.error("Task parameters are invalid, taskDefinitionName:{}.", taskDefinitionLog.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName());
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
}
int saveTaskResult = processService.saveTaskDefine(loginUser, projectCode, taskDefinitionLogs, syncDefine);
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
logger.error("Update task definition error, projectCode:{}, processInstanceId:{}", projectCode,
processInstanceId);
putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR);
}
ProcessDefinition processDefinition =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
List<ProcessTaskRelationLog> taskRelationList =
JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class);
result = processDefinitionService.checkProcessNodeList(taskRelationJson, taskDefinitionLogs);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
logger.error("Tenant does not exist.");
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
processDefinition.set(projectCode, processDefinition.getName(), processDefinition.getDescription(),
globalParams, locations, timeout, tenantId);
processDefinition.setUpdateTime(new Date());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, syncDefine, Boolean.FALSE);
if (insertVersion == 0) {
logger.error("Update process definition error, projectCode:{}, processDefinitionName:{}.", projectCode,
processDefinition.getName());
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
} else
logger.info("Update process definition complete, projectCode:{}, processDefinitionName:{}.", projectCode,
processDefinition.getName());
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(),
processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs, syncDefine);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
logger.info(
"Update task relations complete, projectCode:{}, processDefinitionCode:{}, processDefinitionVersion:{}.",
projectCode, processDefinition.getCode(), insertVersion);
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
logger.info(
"Update task relations error, projectCode:{}, processDefinitionCode:{}, processDefinitionVersion:{}.",
projectCode, processDefinition.getCode(), insertVersion);
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
processInstance.setProcessDefinitionVersion(insertVersion);
int update = processInstanceDao.updateProcessInstance(processInstance);
if (update == 0) {
logger.error(
"Update process instance version error, projectCode:{}, processDefinitionCode:{}, processDefinitionVersion:{}",
projectCode, processDefinition.getCode(), insertVersion);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
putMsg(result, Status.UPDATE_PROCESS_INSTANCE_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_INSTANCE_ERROR);
}
logger.info(
"Update process instance complete, projectCode:{}, processDefinitionCode:{}, processDefinitionVersion:{}, processInstanceId:{}",
projectCode, processDefinition.getCode(), insertVersion, processInstanceId);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* update process instance attributes
*/
private void setProcessInstance(ProcessInstance processInstance, String tenantCode, String scheduleTime,
String globalParams, int timeout, String timezone) {
Date schedule = processInstance.getScheduleTime();
if (scheduleTime != null) {
schedule = DateUtils.stringToDate(scheduleTime);
}
processInstance.setScheduleTime(schedule);
List<Property> globalParamList = JSONUtils.toList(globalParams, Property.class);
Map<String, String> globalParamMap =
globalParamList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue));
globalParams = curingGlobalParamsService.curingGlobalParams(processInstance.getId(), globalParamMap,
globalParamList, processInstance.getCmdTypeIfComplement(), schedule, timezone);
processInstance.setTimeout(timeout);
processInstance.setTenantCode(tenantCode);
processInstance.setGlobalParams(globalParams);
}
/**
* query parent process instance detail info by sub process instance id
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
*
* @param loginUser login user
* @param projectCode project code
* @param subId sub process id
* @return parent instance detail
*/
@Override
public Map<String, Object> queryParentInstanceBySubId(User loginUser, long projectCode, Integer subId) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessInstance subInstance = processService.findProcessInstanceDetailById(subId)
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, subId));
if (subInstance.getIsSubProcess() == Flag.NO) {
logger.warn(
"Process instance is not sub process instance type, processInstanceId:{}, processInstanceName:{}.",
subId, subInstance.getName());
putMsg(result, Status.PROCESS_INSTANCE_NOT_SUB_PROCESS_INSTANCE, subInstance.getName());
return result;
}
ProcessInstance parentWorkflowInstance = processService.findParentProcessInstance(subId);
if (parentWorkflowInstance == null) {
logger.error("Parent process instance does not exist, projectCode:{}, subProcessInstanceId:{}.",
projectCode, subId);
putMsg(result, Status.SUB_PROCESS_INSTANCE_NOT_EXIST);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
}
Map<String, Object> dataMap = new HashMap<>();
dataMap.put(Constants.PARENT_WORKFLOW_INSTANCE, parentWorkflowInstance.getId());
result.put(DATA_LIST, dataMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete process instance by id, at the same time,delete task instance and their mapping relation data
*
* @param loginUser login user
* @param projectCode project code
* @param processInstanceId process instance id
* @return delete result code
*/
@Override
@Transactional
public Map<String, Object> deleteProcessInstanceById(User loginUser, long projectCode, Integer processInstanceId) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_DELETE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId)
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processInstanceId));
if (!processInstance.getState().isFinished()) {
logger.warn("Process Instance state is {} so can not delete process instance, processInstanceId:{}.",
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
processInstance.getState().getDesc(), processInstanceId);
throw new ServiceException(PROCESS_INSTANCE_STATE_OPERATION_ERROR, processInstance.getName(),
processInstance.getState(), "delete");
}
ProcessDefinition processDefinition =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition != null && projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, projectCode:{}, ProcessDefinitionCode:{}.",
projectCode, processInstance.getProcessDefinitionCode());
throw new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
}
try {
processService.removeTaskLogFile(processInstanceId);
} catch (Exception ) {
logger.warn(
"Remove task log file exception, projectCode:{}, ProcessDefinitionCode{}, processInstanceId:{}.",
projectCode, processInstance.getProcessDefinitionCode(), processInstanceId);
}
int delete = processService.deleteWorkProcessInstanceById(processInstanceId);
processService.deleteAllSubWorkProcessByParentId(processInstanceId);
processService.deleteWorkProcessMapByParentId(processInstanceId);
processService.deleteWorkTaskInstanceByProcessInstanceId(processInstanceId);
if (delete > 0) {
logger.info(
"Delete process instance complete, projectCode:{}, ProcessDefinitionCode{}, processInstanceId:{}.",
projectCode, processInstance.getProcessDefinitionCode(), processInstanceId);
putMsg(result, Status.SUCCESS);
} else {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
logger.error(
"Delete process instance error, projectCode:{}, ProcessDefinitionCode{}, processInstanceId:{}.",
projectCode, processInstance.getProcessDefinitionCode(), processInstanceId);
putMsg(result, Status.DELETE_PROCESS_INSTANCE_BY_ID_ERROR);
throw new ServiceException(Status.DELETE_PROCESS_INSTANCE_BY_ID_ERROR);
}
return result;
}
/**
* view process instance variables
*
* @param projectCode project code
* @param processInstanceId process instance id
* @return variables data
*/
@Override
public Map<String, Object> viewVariables(long projectCode, Integer processInstanceId) {
Map<String, Object> result = new HashMap<>();
ProcessInstance processInstance = processInstanceMapper.queryDetailById(processInstanceId);
if (processInstance == null) {
logger.error("Process instance does not exist, projectCode:{}, processInstanceId:{}.", projectCode,
processInstanceId);
putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
return result;
}
ProcessDefinition processDefinition =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition != null && projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, projectCode:{}, processDefinitionCode:{}.", projectCode,
processInstance.getProcessDefinitionCode());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
putMsg(result, PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
return result;
}
Map<String, String> commandParam = JSONUtils.toMap(processInstance.getCommandParam());
String timezone = null;
if (commandParam != null) {
timezone = commandParam.get(Constants.SCHEDULE_TIMEZONE);
}
Map<String, String> timeParams = BusinessTimeUtils
.getBusinessTime(processInstance.getCmdTypeIfComplement(),
processInstance.getScheduleTime(), timezone);
String userDefinedParams = processInstance.getGlobalParams();
List<Property> globalParams = new ArrayList<>();
String globalParamStr =
ParameterUtils.convertParameterPlaceholders(JSONUtils.toJsonString(globalParams), timeParams);
globalParams = JSONUtils.toList(globalParamStr, Property.class);
for (Property property : globalParams) {
timeParams.put(property.getProp(), property.getValue());
}
if (userDefinedParams != null && userDefinedParams.length() > 0) {
globalParams = JSONUtils.toList(userDefinedParams, Property.class);
}
Map<String, Map<String, Object>> localUserDefParams = getLocalParams(processInstance, timeParams);
Map<String, Object> resultMap = new HashMap<>();
resultMap.put(GLOBAL_PARAMS, globalParams);
resultMap.put(LOCAL_PARAMS, localUserDefParams);
result.put(DATA_LIST, resultMap);
putMsg(result, Status.SUCCESS);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
return result;
}
/**
* get local params
*/
private Map<String, Map<String, Object>> getLocalParams(ProcessInstance processInstance,
Map<String, String> timeParams) {
Map<String, Map<String, Object>> localUserDefParams = new HashMap<>();
List<TaskInstance> taskInstanceList =
taskInstanceMapper.findValidTaskListByProcessId(processInstance.getId(), Flag.YES,
processInstance.getTestFlag());
for (TaskInstance taskInstance : taskInstanceList) {
TaskDefinitionLog taskDefinitionLog = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(
taskInstance.getTaskCode(), taskInstance.getTaskDefinitionVersion());
String localParams = JSONUtils.getNodeString(taskDefinitionLog.getTaskParams(), LOCAL_PARAMS);
if (!StringUtils.isEmpty(localParams)) {
localParams = ParameterUtils.convertParameterPlaceholders(localParams, timeParams);
List<Property> localParamsList = JSONUtils.toList(localParams, Property.class);
Map<String, Object> localParamsMap = new HashMap<>();
localParamsMap.put(TASK_TYPE, taskDefinitionLog.getTaskType());
localParamsMap.put(LOCAL_PARAMS_LIST, localParamsList);
if (CollectionUtils.isNotEmpty(localParamsList)) {
localUserDefParams.put(taskDefinitionLog.getName(), localParamsMap);
}
}
}
return localUserDefParams;
}
/**
* encapsulation gantt structure
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
*
* @param projectCode project code
* @param processInstanceId process instance id
* @return gantt tree data
* @throws Exception exception when json parse
*/
@Override
public Map<String, Object> viewGantt(long projectCode, Integer processInstanceId) throws Exception {
Map<String, Object> result = new HashMap<>();
ProcessInstance processInstance = processInstanceMapper.queryDetailById(processInstanceId);
if (processInstance == null) {
logger.error("Process instance does not exist, projectCode:{}, processInstanceId:{}.", projectCode,
processInstanceId);
putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
return result;
}
ProcessDefinition processDefinition = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(
processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion());
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, projectCode:{}, processDefinitionCode:{}.", projectCode,
processInstance.getProcessDefinitionCode());
putMsg(result, PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
return result;
}
GanttDto ganttDto = new GanttDto();
DAG<String, TaskNode, TaskNodeRelation> dag = processService.genDagGraph(processDefinition);
List<String> nodeList = dag.topologicalSort();
ganttDto.setTaskNames(nodeList);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
List<Task> taskList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(nodeList)) {
List<Long> taskCodes = nodeList.stream().map(Long::parseLong).collect(Collectors.toList());
List<TaskInstance> taskInstances = taskInstanceMapper.queryByProcessInstanceIdsAndTaskCodes(
Collections.singletonList(processInstanceId), taskCodes);
for (String node : nodeList) {
TaskInstance taskInstance = null;
for (TaskInstance instance : taskInstances) {
if (instance.getProcessInstanceId() == processInstanceId
&& instance.getTaskCode() == Long.parseLong(node)) {
taskInstance = instance;
break;
}
}
if (taskInstance == null) {
continue;
}
Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime();
Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime();
Task task = new Task();
task.setTaskName(taskInstance.getName());
task.getStartDate().add(startTime.getTime());
task.getEndDate().add(endTime.getTime());
task.setIsoStart(startTime);
task.setIsoEnd(endTime);
task.setStatus(taskInstance.getState().getDesc().toUpperCase());
task.setExecutionDate(taskInstance.getStartTime());
task.setDuration(DateUtils.format2Readable(endTime.getTime() - startTime.getTime()));
taskList.add(task);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
}
ganttDto.setTasks(taskList);
result.put(DATA_LIST, ganttDto);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process instance by processDefinitionCode and stateArray
*
* @param processDefinitionCode processDefinitionCode
* @param states states array
* @return process instance list
*/
@Override
public List<ProcessInstance> queryByProcessDefineCodeAndStatus(Long processDefinitionCode, int[] states) {
return processInstanceMapper.queryByProcessDefineCodeAndStatus(processDefinitionCode, states);
}
/**
* query process instance by processDefinitionCode
*
* @param processDefinitionCode processDefinitionCode
* @param size size
* @return process instance list
*/
@Override
public List<ProcessInstance> queryByProcessDefineCode(Long processDefinitionCode, int size) {
return processInstanceMapper.queryByProcessDefineCode(processDefinitionCode, size);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/LoggerServiceTest.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.DOWNLOAD_LOG;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.VIEW_LOG;
import org.apache.dolphinscheduler.api.enums.Status;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/LoggerServiceTest.java
|
import org.apache.dolphinscheduler.api.service.impl.LoggerServiceImpl;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.dao.repository.TaskInstanceDao;
import org.apache.dolphinscheduler.service.log.LogClient;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* logger service test
*/
@ExtendWith(MockitoExtension.class)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/LoggerServiceTest.java
|
@MockitoSettings(strictness = Strictness.LENIENT)
public class LoggerServiceTest {
private static final Logger logger = LoggerFactory.getLogger(LoggerServiceTest.class);
@InjectMocks
private LoggerServiceImpl loggerService;
@Mock
private TaskInstanceDao taskInstanceDao;
@Mock
private ProjectMapper projectMapper;
@Mock
private ProjectService projectService;
@Mock
private TaskDefinitionMapper taskDefinitionMapper;
@Mock
private LogClient logClient;
@Test
public void testQueryDataSourceList() {
TaskInstance taskInstance = new TaskInstance();
Mockito.when(taskInstanceDao.findTaskInstanceById(1)).thenReturn(taskInstance);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/LoggerServiceTest.java
|
Result result = loggerService.queryLog(2, 1, 1);
Assertions.assertEquals(Status.TASK_INSTANCE_NOT_FOUND.getCode(), result.getCode().intValue());
try {
result = loggerService.queryLog(1, 1, 1);
} catch (RuntimeException e) {
Assertions.assertTrue(true);
logger.error("testQueryDataSourceList error {}", e.getMessage());
}
Assertions.assertEquals(Status.TASK_INSTANCE_HOST_IS_NULL.getCode(), result.getCode().intValue());
taskInstance.setHost("127.0.0.1:8080");
taskInstance.setLogPath("/temp/log");
Mockito.when(taskInstanceDao.findTaskInstanceById(1)).thenReturn(taskInstance);
result = loggerService.queryLog(1, 1, 1);
Assertions.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
}
@Test
public void testGetLogBytes() {
TaskInstance taskInstance = new TaskInstance();
Mockito.when(taskInstanceDao.findTaskInstanceById(1)).thenReturn(taskInstance);
try {
loggerService.getLogBytes(2);
} catch (RuntimeException e) {
Assertions.assertTrue(true);
logger.error("testGetLogBytes error: {}", "task instance is null");
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/LoggerServiceTest.java
|
try {
loggerService.getLogBytes(1);
} catch (RuntimeException e) {
Assertions.assertTrue(true);
logger.error("testGetLogBytes error: {}", "task instance host is null");
}
taskInstance.setHost("127.0.0.1:8080");
taskInstance.setLogPath("/temp/log");
Mockito.when(logClient.getLogBytes(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString()))
.thenReturn(new byte[0]);
loggerService.getLogBytes(1);
}
@Test
public void testQueryLogInSpecifiedProject() {
long projectCode = 1L;
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, projectCode);
TaskInstance taskInstance = new TaskInstance();
Mockito.when(taskInstanceDao.findTaskInstanceById(1)).thenReturn(taskInstance);
TaskDefinition taskDefinition = new TaskDefinition();
taskDefinition.setProjectCode(projectCode);
taskDefinition.setCode(1L);
taskInstance.setTaskCode(1L);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/LoggerServiceTest.java
|
taskInstance.setId(1);
taskInstance.setHost("127.0.0.1:8080");
taskInstance.setLogPath("/temp/log");
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, VIEW_LOG)).thenReturn(result);
Mockito.when(taskInstanceDao.findTaskInstanceById(1)).thenReturn(taskInstance);
Mockito.when(taskDefinitionMapper.queryByCode(taskInstance.getTaskCode())).thenReturn(taskDefinition);
result = loggerService.queryLog(loginUser, projectCode, 1, 1, 1);
Assertions.assertEquals(Status.SUCCESS.getCode(), ((Status) result.get(Constants.STATUS)).getCode());
}
@Test
public void testGetLogBytesInSpecifiedProject() {
long projectCode = 1L;
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, projectCode);
TaskInstance taskInstance = new TaskInstance();
TaskDefinition taskDefinition = new TaskDefinition();
taskDefinition.setProjectCode(projectCode);
taskDefinition.setCode(1L);
taskInstance.setTaskCode(1L);
taskInstance.setId(1);
taskInstance.setHost("127.0.0.1:8080");
taskInstance.setLogPath("/temp/log");
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, DOWNLOAD_LOG))
.thenReturn(result);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/LoggerServiceTest.java
|
Mockito.when(taskInstanceDao.findTaskInstanceById(1)).thenReturn(taskInstance);
Mockito.when(taskDefinitionMapper.queryByCode(taskInstance.getTaskCode())).thenReturn(taskDefinition);
Mockito.when(logClient.getLogBytes(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString()))
.thenReturn(new byte[0]);
loggerService.getLogBytes(loginUser, projectCode, 1);
}
/**
* get mock Project
*
* @param projectCode projectCode
* @return Project
*/
private Project getProject(long projectCode) {
Project project = new Project();
project.setCode(projectCode);
project.setId(1);
project.setName("test");
project.setUserId(1);
return project;
}
private void putMsg(Map<String, Object> result, Status status, Object... statusParams) {
result.put(Constants.STATUS, status);
if (statusParams != null && statusParams.length > 0) {
result.put(Constants.MSG, MessageFormat.format(status.getMsg(), statusParams));
} else {
result.put(Constants.MSG, status.getMsg());
}
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.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.INSTANCE_DELETE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.INSTANCE_UPDATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_INSTANCE;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.impl.LoggerServiceImpl;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
import org.apache.dolphinscheduler.api.service.impl.ProcessInstanceServiceImpl;
import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus;
import org.apache.dolphinscheduler.common.graph.DAG;
import org.apache.dolphinscheduler.common.model.TaskNodeRelation;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.entity.WorkerGroup;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
import org.apache.dolphinscheduler.dao.repository.ProcessInstanceDao;
import org.apache.dolphinscheduler.dao.repository.TaskInstanceDao;
import org.apache.dolphinscheduler.plugin.task.api.enums.DependResult;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus;
import org.apache.dolphinscheduler.service.expand.CuringParamsService;
import org.apache.dolphinscheduler.service.model.TaskNode;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.task.TaskPluginManager;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* process instance service test
*/
@ExtendWith(MockitoExtension.class)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
@MockitoSettings(strictness = Strictness.LENIENT)
public class ProcessInstanceServiceTest {
@InjectMocks
ProcessInstanceServiceImpl processInstanceService;
@Mock
ProjectMapper projectMapper;
@Mock
ProjectServiceImpl projectService;
@Mock
ProcessService processService;
@Mock
TaskInstanceDao taskInstanceDao;
@Mock
ProcessInstanceDao processInstanceDao;
@Mock
ProcessInstanceMapper processInstanceMapper;
@Mock
ProcessDefinitionLogMapper processDefinitionLogMapper;
@Mock
ProcessDefinitionMapper processDefineMapper;
@Mock
ProcessDefinitionService processDefinitionService;
@Mock
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
TaskInstanceMapper taskInstanceMapper;
@Mock
LoggerServiceImpl loggerService;
@Mock
UsersService usersService;
@Mock
TenantMapper tenantMapper;
@Mock
TaskDefinitionMapper taskDefinitionMapper;
@Mock
TaskPluginManager taskPluginManager;
@Mock
ScheduleMapper scheduleMapper;
@Mock
CuringParamsService curingGlobalParamsService;
private String shellJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":123456789,"
+ "\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":\"{}\"},{\"name\":\"\",\"preTaskCode\":123456789,"
+ "\"preTaskVersion\":1,\"postTaskCode\":123451234,\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":\"{}\"}]";
private String taskJson =
"[{\"name\":\"shell1\",\"description\":\"\",\"taskType\":\"SHELL\",\"taskParams\":{\"resourceList\":[],"
+ "\"localParams\":[],\"rawScript\":\"echo 1\",\"conditionResult\":{\"successNode\":[\"\"],\"failedNode\":[\"\"]},\"dependence\":{}},"
+ "\"flag\":\"NORMAL\",\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\",\"failRetryTimes\":\"0\",\"failRetryInterval\":\"1\","
+ "\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"timeout\":null,\"delayTime\":\"0\"},{\"name\":\"shell2\",\"description\":\"\","
+ "\"taskType\":\"SHELL\",\"taskParams\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"echo 2\",\"conditionResult\":{\"successNode\""
+ ":[\"\"],\"failedNode\":[\"\"]},\"dependence\":{}},\"flag\":\"NORMAL\",\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\","
+ "\"failRetryTimes\":\"0\",\"failRetryInterval\":\"1\",\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"timeout\":null,\"delayTime\":\"0\"}]";
private String taskRelationJson =
"[{\"name\":\"\",\"preTaskCode\":4254865123776,\"preTaskVersion\":1,\"postTaskCode\":4254862762304,\"postTaskVersion\":1,\"conditionType\":0,"
+ "\"conditionParams\":{}},{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":4254865123776,\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":{}}]";
private String taskDefinitionJson =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
"[{\"code\":4254862762304,\"name\":\"test1\",\"version\":1,\"description\":\"\",\"delayTime\":0,\"taskType\":\"SHELL\",\"taskParams\":{\"resourceList\":[],"
+ "\"localParams\":[],\"rawScript\":\"echo 1\",\"dependence\":{},\"conditionResult\":{\"successNode\":[],\"failedNode\":[]},\"waitStartTimeout\":{},\"switchResult\":{}},\"flag\":\"YES\","
+ "\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":1,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":null,\"timeout\":0,"
+ "\"environmentCode\":-1},{\"code\":4254865123776,\"name\":\"test2\",\"version\":1,\"description\":\"\",\"delayTime\":0,\"taskType\":\"SHELL\",\"taskParams\":{\"resourceList\":[],"
+ "\"localParams\":[],\"rawScript\":\"echo 2\",\"dependence\":{},\"conditionResult\":{\"successNode\":[],\"failedNode\":[]},\"waitStartTimeout\":{},\"switchResult\":{}},\"flag\":\"YES\","
+ "\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":1,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"WARN\",\"timeout\":0,"
+ "\"environmentCode\":-1}]";
@Test
public void testQueryProcessInstanceList() {
long projectCode = 1L;
User loginUser = getAdminUser();
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
Result proejctAuthFailRes =
processInstanceService.queryProcessInstanceList(loginUser, projectCode, 46, "2020-01-01 00:00:00",
"2020-01-02 00:00:00", "", "test_user", WorkflowExecutionStatus.SUBMITTED_SUCCESS,
"192.168.xx.xx", "", 1, 10);
Assertions.assertEquals(Status.PROJECT_NOT_FOUND.getCode(), (int) proejctAuthFailRes.getCode());
Date start = DateUtils.stringToDate("2020-01-01 00:00:00");
Date end = DateUtils.stringToDate("2020-01-02 00:00:00");
ProcessInstance processInstance = getProcessInstance();
List<ProcessInstance> processInstanceList = new ArrayList<>();
Page<ProcessInstance> pageReturn = new Page<>(1, 10);
processInstanceList.add(processInstance);
pageReturn.setRecords(processInstanceList);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
putMsg(result, Status.SUCCESS, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
when(processDefineMapper.selectById(Mockito.anyInt())).thenReturn(getProcessDefinition());
when(processInstanceMapper.queryProcessInstanceListPaging(Mockito.any(Page.class), Mockito.any(), Mockito.any(),
Mockito.any(), Mockito.any(), Mockito.any(),
eq("192.168.xx.xx"), Mockito.any(), Mockito.any())).thenReturn(pageReturn);
Result dataParameterRes =
processInstanceService.queryProcessInstanceList(loginUser, projectCode, 1, "20200101 00:00:00",
"20200102 00:00:00", "", loginUser.getUserName(), WorkflowExecutionStatus.SUBMITTED_SUCCESS,
"192.168.xx.xx", "", 1, 10);
Assertions.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR.getCode(), (int) dataParameterRes.getCode());
putMsg(result, Status.SUCCESS, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
when(usersService.queryUser(loginUser.getId())).thenReturn(loginUser);
when(usersService.getUserIdByName(loginUser.getUserName())).thenReturn(loginUser.getId());
when(processInstanceMapper.queryProcessInstanceListPaging(Mockito.any(Page.class), eq(project.getCode()),
eq(1L), eq(""), eq(-1), Mockito.any(),
eq("192.168.xx.xx"), eq(start), eq(end))).thenReturn(pageReturn);
when(usersService.queryUser(processInstance.getExecutorId())).thenReturn(loginUser);
Result successRes =
processInstanceService.queryProcessInstanceList(loginUser, projectCode, 1, "2020-01-01 00:00:00",
"2020-01-02 00:00:00", "", loginUser.getUserName(), WorkflowExecutionStatus.SUBMITTED_SUCCESS,
"192.168.xx.xx", "", 1, 10);
Assertions.assertEquals(Status.SUCCESS.getCode(), (int) successRes.getCode());
when(processInstanceMapper.queryProcessInstanceListPaging(Mockito.any(Page.class), eq(project.getCode()),
eq(1L), eq(""), eq(-1), Mockito.any(),
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
eq("192.168.xx.xx"), eq(null), eq(null))).thenReturn(pageReturn);
successRes = processInstanceService.queryProcessInstanceList(loginUser, projectCode, 1, "",
"", "", loginUser.getUserName(), WorkflowExecutionStatus.SUBMITTED_SUCCESS,
"192.168.xx.xx", "", 1, 10);
Assertions.assertEquals(Status.SUCCESS.getCode(), (int) successRes.getCode());
when(usersService.queryUser(loginUser.getId())).thenReturn(null);
when(usersService.getUserIdByName(loginUser.getUserName())).thenReturn(-1);
Result executorExistRes =
processInstanceService.queryProcessInstanceList(loginUser, projectCode, 1, "2020-01-01 00:00:00",
"2020-01-02 00:00:00", "", "admin", WorkflowExecutionStatus.SUBMITTED_SUCCESS,
"192.168.xx.xx", "", 1, 10);
Assertions.assertEquals(Status.SUCCESS.getCode(), (int) executorExistRes.getCode());
when(processInstanceMapper.queryProcessInstanceListPaging(Mockito.any(Page.class), eq(project.getCode()),
eq(1L), eq(""), eq(0), Mockito.any(),
eq("192.168.xx.xx"), eq(start), eq(end))).thenReturn(pageReturn);
Result executorEmptyRes =
processInstanceService.queryProcessInstanceList(loginUser, projectCode, 1, "2020-01-01 00:00:00",
"2020-01-02 00:00:00", "", "", WorkflowExecutionStatus.SUBMITTED_SUCCESS,
"192.168.xx.xx", "", 1, 10);
Assertions.assertEquals(Status.SUCCESS.getCode(), (int) executorEmptyRes.getCode());
}
@Test
public void testQueryTopNLongestRunningProcessInstance() {
long projectCode = 1L;
User loginUser = getAdminUser();
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>(5);
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
int size = 10;
String startTime = "2020-01-01 00:00:00";
String endTime = "2020-08-02 00:00:00";
Date start = DateUtils.stringToDate(startTime);
Date end = DateUtils.stringToDate(endTime);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
Map<String, Object> projectAuthFailRes = processInstanceService
.queryTopNLongestRunningProcessInstance(loginUser, projectCode, size, startTime, endTime);
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, projectAuthFailRes.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
ProcessInstance processInstance = getProcessInstance();
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
projectAuthFailRes = processInstanceService
.queryTopNLongestRunningProcessInstance(loginUser, projectCode, -1, startTime, endTime);
Assertions.assertEquals(Status.NEGTIVE_SIZE_NUMBER_ERROR, projectAuthFailRes.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
when(usersService.queryUser(loginUser.getId())).thenReturn(loginUser);
when(usersService.getUserIdByName(loginUser.getUserName())).thenReturn(loginUser.getId());
when(usersService.queryUser(processInstance.getExecutorId())).thenReturn(loginUser);
Map<String, Object> successRes = processInstanceService.queryTopNLongestRunningProcessInstance(loginUser,
projectCode, size, startTime, endTime);
Assertions.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
public void testTopNLongestRunningProcessInstanceFailure() {
long projectCode = 1L;
User loginUser = getAdminUser();
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>(5);
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
int size = 10;
String startTime = "2020-01-01 00:00:00";
String endTime = "2020-08-02 00:00:00";
putMsg(result, Status.SUCCESS, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
Map<String, Object> startTimeBiggerFailRes = processInstanceService
.queryTopNLongestRunningProcessInstance(loginUser, projectCode, size, endTime, startTime);
Assertions.assertEquals(Status.START_TIME_BIGGER_THAN_END_TIME_ERROR,
startTimeBiggerFailRes.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
Map<String, Object> dataNullFailRes = processInstanceService
.queryTopNLongestRunningProcessInstance(loginUser, projectCode, size, null, endTime);
Assertions.assertEquals(Status.DATA_IS_NULL, dataNullFailRes.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
dataNullFailRes = processInstanceService
.queryTopNLongestRunningProcessInstance(loginUser, projectCode, size, startTime, null);
Assertions.assertEquals(Status.DATA_IS_NULL, dataNullFailRes.get(Constants.STATUS));
}
@Test
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
public void testQueryProcessInstanceById() {
long projectCode = 1L;
User loginUser = getAdminUser();
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
Map<String, Object> projectAuthFailRes =
processInstanceService.queryProcessInstanceById(loginUser, projectCode, 1);
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, projectAuthFailRes.get(Constants.STATUS));
ProcessInstance processInstance = getProcessInstance();
putMsg(result, Status.SUCCESS, projectCode);
ProcessDefinition processDefinition = getProcessDefinition();
processDefinition.setProjectCode(projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
when(processService.findProcessInstanceDetailById(processInstance.getId()))
.thenReturn(Optional.of(processInstance));
when(processService.findProcessDefinition(processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion())).thenReturn(processDefinition);
Map<String, Object> successRes = processInstanceService.queryProcessInstanceById(loginUser, projectCode, 1);
Assertions.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
Map<String, Object> workerNullRes = processInstanceService.queryProcessInstanceById(loginUser, projectCode, 1);
Assertions.assertEquals(Status.SUCCESS, workerNullRes.get(Constants.STATUS));
WorkerGroup workerGroup = getWorkGroup();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
Map<String, Object> workerExistRes = processInstanceService.queryProcessInstanceById(loginUser, projectCode, 1);
Assertions.assertEquals(Status.SUCCESS, workerExistRes.get(Constants.STATUS));
when(processService.findProcessDefinition(processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion())).thenReturn(null);;
workerExistRes = processInstanceService.queryProcessInstanceById(loginUser, projectCode, 1);
Assertions.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, workerExistRes.get(Constants.STATUS));
}
@Test
public void testQueryTaskListByProcessId() throws IOException {
long projectCode = 1L;
User loginUser = getAdminUser();
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
Map<String, Object> projectAuthFailRes =
processInstanceService.queryTaskListByProcessId(loginUser, projectCode, 1);
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, projectAuthFailRes.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
ProcessInstance processInstance = getProcessInstance();
processInstance.setState(WorkflowExecutionStatus.SUCCESS);
TaskInstance taskInstance = new TaskInstance();
taskInstance.setId(0);
taskInstance.setTaskType("SHELL");
List<TaskInstance> taskInstanceList = new ArrayList<>();
taskInstanceList.add(taskInstance);
Result res = new Result();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
res.setCode(Status.SUCCESS.ordinal());
res.setData("xxx");
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
when(processService.findProcessInstanceDetailById(processInstance.getId()))
.thenReturn(Optional.of(processInstance));
when(taskInstanceDao.findValidTaskListByProcessId(processInstance.getId(), processInstance.getTestFlag()))
.thenReturn(taskInstanceList);
when(loggerService.queryLog(taskInstance.getId(), 0, 4098)).thenReturn(res);
Map<String, Object> successRes = processInstanceService.queryTaskListByProcessId(loginUser, projectCode, 1);
Assertions.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
public void testParseLogForDependentResult() throws IOException {
String logString =
"[INFO] 2019-03-19 17:11:08.475 org.apache.dolphinscheduler.server.worker.log.TaskLogger:[172]"
+ " - [taskAppId=TASK_223_10739_452334] dependent item complete :|| 223-ALL-day-last1Day,SUCCESS\n"
+ "[INFO] 2019-03-19 17:11:08.476 org.apache.dolphinscheduler.server.worker.runner.TaskScheduleThread:[172]"
+ " - task : 223_10739_452334 exit status code : 0\n"
+ "[root@node2 current]# ";
Map<String, DependResult> resultMap =
processInstanceService.parseLogForDependentResult(logString);
Assertions.assertEquals(1, resultMap.size());
resultMap.clear();
resultMap = processInstanceService.parseLogForDependentResult("");
Assertions.assertEquals(0, resultMap.size());
}
@Test
public void testQuerySubProcessInstanceByTaskId() {
long projectCode = 1L;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
User loginUser = getAdminUser();
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
Map<String, Object> projectAuthFailRes =
processInstanceService.querySubProcessInstanceByTaskId(loginUser, projectCode, 1);
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, projectAuthFailRes.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
when(taskInstanceDao.findTaskInstanceById(1)).thenReturn(null);
Map<String, Object> taskNullRes =
processInstanceService.querySubProcessInstanceByTaskId(loginUser, projectCode, 1);
Assertions.assertEquals(Status.TASK_INSTANCE_NOT_EXISTS, taskNullRes.get(Constants.STATUS));
TaskInstance taskInstance = getTaskInstance();
taskInstance.setTaskType("HTTP");
taskInstance.setProcessInstanceId(1);
putMsg(result, Status.SUCCESS, projectCode);
when(taskInstanceDao.findTaskInstanceById(1)).thenReturn(taskInstance);
TaskDefinition taskDefinition = new TaskDefinition();
taskDefinition.setProjectCode(projectCode);
when(taskDefinitionMapper.queryByCode(taskInstance.getTaskCode())).thenReturn(taskDefinition);
Map<String, Object> notSubprocessRes =
processInstanceService.querySubProcessInstanceByTaskId(loginUser, projectCode, 1);
Assertions.assertEquals(Status.TASK_INSTANCE_NOT_SUB_WORKFLOW_INSTANCE, notSubprocessRes.get(Constants.STATUS));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
putMsg(result, Status.SUCCESS, projectCode);
taskDefinition.setProjectCode(0L);
notSubprocessRes = processInstanceService.querySubProcessInstanceByTaskId(loginUser, projectCode, 1);
Assertions.assertEquals(Status.TASK_INSTANCE_NOT_EXISTS, notSubprocessRes.get(Constants.STATUS));
taskDefinition.setProjectCode(projectCode);
when(taskDefinitionMapper.queryByCode(taskInstance.getTaskCode())).thenReturn(taskDefinition);
TaskInstance subTask = getTaskInstance();
subTask.setTaskType("SUB_PROCESS");
subTask.setProcessInstanceId(1);
putMsg(result, Status.SUCCESS, projectCode);
when(taskInstanceDao.findTaskInstanceById(subTask.getId())).thenReturn(subTask);
when(processService.findSubProcessInstance(subTask.getProcessInstanceId(), subTask.getId())).thenReturn(null);
Map<String, Object> subprocessNotExistRes =
processInstanceService.querySubProcessInstanceByTaskId(loginUser, projectCode, 1);
Assertions.assertEquals(Status.SUB_PROCESS_INSTANCE_NOT_EXIST, subprocessNotExistRes.get(Constants.STATUS));
ProcessInstance processInstance = getProcessInstance();
putMsg(result, Status.SUCCESS, projectCode);
when(processService.findSubProcessInstance(taskInstance.getProcessInstanceId(), taskInstance.getId()))
.thenReturn(processInstance);
Map<String, Object> subprocessExistRes =
processInstanceService.querySubProcessInstanceByTaskId(loginUser, projectCode, 1);
Assertions.assertEquals(Status.SUCCESS, subprocessExistRes.get(Constants.STATUS));
}
@Test
public void testUpdateProcessInstance() {
long projectCode = 1L;
User loginUser = getAdminUser();
Project project = getProject(projectCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_UPDATE)).thenReturn(result);
Map<String, Object> projectAuthFailRes = processInstanceService.updateProcessInstance(loginUser, projectCode, 1,
shellJson, taskJson, "2020-02-21 00:00:00", true, "", "", 0, "");
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, projectAuthFailRes.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
ProcessInstance processInstance = getProcessInstance();
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_UPDATE)).thenReturn(result);
when(processService.findProcessInstanceDetailById(1)).thenReturn(Optional.empty());
try {
Map<String, Object> processInstanceNullRes =
processInstanceService.updateProcessInstance(loginUser, projectCode, 1,
shellJson, taskJson, "2020-02-21 00:00:00", true, "", "", 0, "");
Assertions.fail();
} catch (ServiceException ex) {
Assertions.assertEquals(Status.PROCESS_INSTANCE_NOT_EXIST.getCode(), ex.getCode());
}
when(processService.findProcessInstanceDetailById(1)).thenReturn(Optional.ofNullable(processInstance));
processInstance.setState(WorkflowExecutionStatus.RUNNING_EXECUTION);
putMsg(result, Status.SUCCESS, projectCode);
Map<String, Object> processInstanceNotFinishRes =
processInstanceService.updateProcessInstance(loginUser, projectCode, 1,
shellJson, taskJson, "2020-02-21 00:00:00", true, "", "", 0, "");
Assertions.assertEquals(Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
processInstanceNotFinishRes.get(Constants.STATUS));
processInstance.setState(WorkflowExecutionStatus.SUCCESS);
processInstance.setTimeout(3000);
processInstance.setCommandType(CommandType.STOP);
processInstance.setProcessDefinitionCode(46L);
processInstance.setProcessDefinitionVersion(1);
ProcessDefinition processDefinition = getProcessDefinition();
processDefinition.setId(1);
processDefinition.setUserId(1);
processDefinition.setProjectCode(projectCode);
Tenant tenant = getTenant();
when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition);
when(tenantMapper.queryByTenantCode("root")).thenReturn(tenant);
when(processService.getTenantForProcess(Mockito.anyInt(), Mockito.anyInt())).thenReturn(tenant);
when(processInstanceDao.updateProcessInstance(processInstance)).thenReturn(1);
when(processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.FALSE)).thenReturn(1);
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
when(processDefinitionService.checkProcessNodeList(taskRelationJson, taskDefinitionLogs)).thenReturn(result);
putMsg(result, Status.SUCCESS, projectCode);
when(taskPluginManager.checkTaskParameters(Mockito.any())).thenReturn(true);
Map<String, Object> processInstanceFinishRes =
processInstanceService.updateProcessInstance(loginUser, projectCode, 1,
taskRelationJson, taskDefinitionJson, "2020-02-21 00:00:00", true, "", "", 0, "root");
Assertions.assertEquals(Status.SUCCESS, processInstanceFinishRes.get(Constants.STATUS));
when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition);
putMsg(result, Status.SUCCESS, projectCode);
when(processService.saveProcessDefine(loginUser, processDefinition, Boolean.FALSE, Boolean.FALSE))
.thenReturn(1);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
Map<String, Object> successRes = processInstanceService.updateProcessInstance(loginUser, projectCode, 1,
taskRelationJson, taskDefinitionJson, "2020-02-21 00:00:00", Boolean.FALSE, "", "", 0, "root");
Assertions.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
public void testQueryParentInstanceBySubId() {
long projectCode = 1L;
User loginUser = getAdminUser();
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
Map<String, Object> projectAuthFailRes =
processInstanceService.queryParentInstanceBySubId(loginUser, projectCode, 1);
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, projectAuthFailRes.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
when(processService.findProcessInstanceDetailById(1)).thenReturn(Optional.empty());
try {
Map<String, Object> processInstanceNullRes =
processInstanceService.queryParentInstanceBySubId(loginUser, projectCode, 1);
} catch (ServiceException ex) {
Assertions.assertEquals(Status.PROCESS_INSTANCE_NOT_EXIST.getCode(), ex.getCode());
}
ProcessInstance processInstance = getProcessInstance();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
processInstance.setIsSubProcess(Flag.NO);
putMsg(result, Status.SUCCESS, projectCode);
when(processService.findProcessInstanceDetailById(1)).thenReturn(Optional.ofNullable(processInstance));
Map<String, Object> notSubProcessRes =
processInstanceService.queryParentInstanceBySubId(loginUser, projectCode, 1);
Assertions.assertEquals(Status.PROCESS_INSTANCE_NOT_SUB_PROCESS_INSTANCE,
notSubProcessRes.get(Constants.STATUS));
processInstance.setIsSubProcess(Flag.YES);
putMsg(result, Status.SUCCESS, projectCode);
when(processService.findParentProcessInstance(1)).thenReturn(null);
Map<String, Object> subProcessNullRes =
processInstanceService.queryParentInstanceBySubId(loginUser, projectCode, 1);
Assertions.assertEquals(Status.SUB_PROCESS_INSTANCE_NOT_EXIST, subProcessNullRes.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
when(processService.findParentProcessInstance(1)).thenReturn(processInstance);
Map<String, Object> successRes = processInstanceService.queryParentInstanceBySubId(loginUser, projectCode, 1);
Assertions.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
public void testDeleteProcessInstanceById() {
long projectCode = 1L;
User loginUser = getAdminUser();
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
when(projectMapper.queryByCode(projectCode)).thenReturn(project);
when(projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_DELETE)).thenReturn(result);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
Map<String, Object> projectAuthFailRes =
processInstanceService.deleteProcessInstanceById(loginUser, projectCode, 1);
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, projectAuthFailRes.get(Constants.STATUS));
ProcessInstance processInstance = getProcessInstance();
processInstance.setIsSubProcess(Flag.NO);
processInstance.setState(WorkflowExecutionStatus.RUNNING_EXECUTION);
putMsg(result, Status.SUCCESS, projectCode);
when(processService.findProcessInstanceDetailById(1)).thenReturn(Optional.ofNullable(processInstance));
try {
processInstanceService.deleteProcessInstanceById(loginUser, projectCode, 1);
Assertions.fail();
} catch (ServiceException ex) {
Assertions.assertEquals(Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR.getCode(), ex.getCode());
}
processInstance.setState(WorkflowExecutionStatus.SUCCESS);
processInstance.setState(WorkflowExecutionStatus.SUCCESS);
processInstance.setTimeout(3000);
processInstance.setCommandType(CommandType.STOP);
processInstance.setProcessDefinitionCode(46L);
processInstance.setProcessDefinitionVersion(1);
ProcessDefinition processDefinition = getProcessDefinition();
processDefinition.setId(1);
processDefinition.setUserId(1);
processDefinition.setProjectCode(0L);
when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition);
try {
processInstanceService.deleteProcessInstanceById(loginUser, projectCode, 1);
Assertions.fail();
} catch (ServiceException ex) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
Assertions.assertEquals(Status.PROCESS_INSTANCE_NOT_EXIST.getCode(), ex.getCode());
}
processDefinition.setProjectCode(projectCode);
when(processService.deleteWorkProcessInstanceById(1)).thenReturn(1);
Map<String, Object> successRes =
processInstanceService.deleteProcessInstanceById(loginUser, projectCode, 1);
Assertions.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
when(processService.deleteWorkProcessInstanceById(1)).thenReturn(0);
try {
processInstanceService.deleteProcessInstanceById(loginUser, projectCode, 1);
Assertions.fail();
} catch (ServiceException ex) {
Assertions.assertEquals(Status.DELETE_PROCESS_INSTANCE_BY_ID_ERROR.getCode(), ex.getCode());
}
}
@Test
public void testViewVariables() {
ProcessInstance processInstance = getProcessInstance();
processInstance.setCommandType(CommandType.SCHEDULER);
processInstance.setScheduleTime(new Date());
processInstance.setGlobalParams("");
when(processInstanceMapper.queryDetailById(1)).thenReturn(processInstance);
Map<String, Object> successRes = processInstanceService.viewVariables(1L, 1);
Assertions.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
when(processInstanceMapper.queryDetailById(1)).thenReturn(null);
Map<String, Object> processNotExist = processInstanceService.viewVariables(1L, 1);
Assertions.assertEquals(Status.PROCESS_INSTANCE_NOT_EXIST, processNotExist.get(Constants.STATUS));
}
@Test
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
public void testViewGantt() throws Exception {
ProcessInstance processInstance = getProcessInstance();
TaskInstance taskInstance = getTaskInstance();
taskInstance.setState(TaskExecutionStatus.RUNNING_EXECUTION);
taskInstance.setStartTime(new Date());
when(processInstanceMapper.queryDetailById(1)).thenReturn(processInstance);
when(processDefinitionLogMapper.queryByDefinitionCodeAndVersion(
processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion())).thenReturn(new ProcessDefinitionLog());
when(processInstanceMapper.queryDetailById(1)).thenReturn(processInstance);
when(taskInstanceMapper.queryByInstanceIdAndName(Mockito.anyInt(), Mockito.any())).thenReturn(taskInstance);
DAG<String, TaskNode, TaskNodeRelation> graph = new DAG<>();
for (int i = 1; i <= 7; ++i) {
graph.addNode(i + "", new TaskNode());
}
when(processService.genDagGraph(Mockito.any(ProcessDefinition.class)))
.thenReturn(graph);
Map<String, Object> successRes = processInstanceService.viewGantt(0L, 1);
Assertions.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
when(processInstanceMapper.queryDetailById(1)).thenReturn(null);
Map<String, Object> processNotExist = processInstanceService.viewVariables(1L, 1);
Assertions.assertEquals(Status.PROCESS_INSTANCE_NOT_EXIST, processNotExist.get(Constants.STATUS));
}
/**
* get Mock Admin User
*
* @return admin user
*/
private User getAdminUser() {
User loginUser = new User();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
loginUser.setId(-1);
loginUser.setUserName("admin");
loginUser.setUserType(UserType.GENERAL_USER);
return loginUser;
}
/**
* get mock Project
*
* @param projectCode projectCode
* @return Project
*/
private Project getProject(long projectCode) {
Project project = new Project();
project.setCode(projectCode);
project.setId(1);
project.setName("project_test1");
project.setUserId(1);
return project;
}
/**
* get Mock process instance
*
* @return process instance
*/
private ProcessInstance getProcessInstance() {
ProcessInstance processInstance = new ProcessInstance();
processInstance.setId(1);
processInstance.setName("test_process_instance");
processInstance.setProcessDefinitionCode(46L);
processInstance.setProcessDefinitionVersion(1);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
processInstance.setStartTime(new Date());
processInstance.setEndTime(new Date());
return processInstance;
}
/**
* get mock processDefinition
*
* @return ProcessDefinition
*/
private ProcessDefinition getProcessDefinition() {
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.setCode(46L);
processDefinition.setVersion(1);
processDefinition.setId(46);
processDefinition.setName("test_pdf");
processDefinition.setProjectCode(2L);
processDefinition.setTenantId(1);
processDefinition.setDescription("");
return processDefinition;
}
private Tenant getTenant() {
Tenant tenant = new Tenant();
tenant.setId(1);
tenant.setTenantCode("root");
return tenant;
}
/**
* get Mock worker group
*
* @return worker group
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
|
*/
private WorkerGroup getWorkGroup() {
WorkerGroup workerGroup = new WorkerGroup();
workerGroup.setName("test_workergroup");
return workerGroup;
}
/**
* get Mock task instance
*
* @return task instance
*/
private TaskInstance getTaskInstance() {
TaskInstance taskInstance = new TaskInstance();
taskInstance.setId(1);
taskInstance.setName("test_task_instance");
taskInstance.setStartTime(new Date());
taskInstance.setEndTime(new Date());
taskInstance.setExecutorId(-1);
return taskInstance;
}
private void putMsg(Map<String, Object> result, Status status, Object... statusParams) {
result.put(Constants.STATUS, status);
if (statusParams != null && statusParams.length > 0) {
result.put(Constants.MSG, MessageFormat.format(status.getMsg(), statusParams));
} else {
result.put(Constants.MSG, status.getMsg());
}
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.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.Project;
import org.apache.dolphinscheduler.dao.entity.ProjectUser;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
* project mapper interface
*/
public interface ProjectMapper extends BaseMapper<Project> {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.java
|
/**
* query project detail by code
* @param projectCode projectCode
* @return project
*/
Project queryByCode(@Param("projectCode") long projectCode);
/**
* query project detail by code list
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.java
|
* @param codes codes
* @return project list
*/
List<Project> queryByCodes(@Param("codes") Collection<Long> codes);
/**
* TODO: delete
* query project detail by id
* @param projectId projectId
* @return project
*/
Project queryDetailById(@Param("projectId") int projectId);
/**
* query project detail by code
* @param projectCode projectCode
* @return project
*/
Project queryDetailByCode(@Param("projectCode") long projectCode);
/**
* query project by name
* @param projectName projectName
* @return project
*/
Project queryByName(@Param("projectName") String projectName);
/**
* project page
* @param page page
* @param projectsIds projectsIds
* @param searchName searchName
* @return project Ipage
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.java
|
IPage<Project> queryProjectListPaging(IPage<Project> page,
@Param("projectsIds") List<Integer> projectsIds,
@Param("searchName") String searchName);
/**
* query create project user
* @param userId userId
* @return project list
*/
List<Project> queryProjectCreatedByUser(@Param("userId") int userId);
/**
* query authed project list by userId
* @param userId userId
* @return project list
*/
List<Project> queryAuthedProjectListByUserId(@Param("userId") int userId);
/**
* query relation project list by userId
* @param userId userId
* @return project list
*/
List<Project> queryRelationProjectListByUserId(@Param("userId") int userId);
/**
* query project except userId
* @param userId userId
* @return project list
*/
List<Project> queryProjectExceptUserId(@Param("userId") int userId);
/**
* query project list by userId
* @param userId
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,916 |
[Bug] [Log] User can query or download other user's log
|
### 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
User can query or download other user's log
### What you expected to happen
There's permission control in loggerService.
### How to reproduce
User (not admin) query the log of a task instance which is created by other user.
<img width="1386" alt="截屏2022-11-16 09 55 30" src="https://user-images.githubusercontent.com/38122586/202098814-7afaea49-0a57-43be-8476-ea56da0a28d2.png">
### 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/12916
|
https://github.com/apache/dolphinscheduler/pull/12917
|
3106054ea78a0036069d1860a228723519efab38
|
7336afaa65e3c4bb4596081cf0049b5166506a0c
| 2022-11-16T06:14:30Z |
java
| 2022-11-25T09:59:28Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.java
|
* @return
*/
List<Project> queryProjectCreatedAndAuthorizedByUserId(@Param("userId") int userId);
/**
* query project name and user name by processInstanceId.
* @param processInstanceId processInstanceId
* @return projectName and userName
*/
ProjectUser queryProjectWithUserByProcessInstanceId(@Param("processInstanceId") int processInstanceId);
/**
* query all project
* @param userId
* @return projectList
*/
List<Project> queryAllProject(@Param("userId") int userId);
/**
* list authorized Projects
* @param userId
* @param projectsIds
* @param <T>
* @return
*/
List<Project> listAuthorizedProjects(@Param("userId") int userId, @Param("projectsIds") List<Integer> projectsIds);
/**
* query all project for dependent node
* @return projectList
*/
List<Project> queryAllProjectForDependent();
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,763 |
[Improvement][UT] Improve testListAuthorizedProjects() in ProjectMapperTest
|
### 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 testListAuthorizedProjects() in ProjectMapperTest
### 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/12763
|
https://github.com/apache/dolphinscheduler/pull/12768
|
597ae5ff7ce68251d6194ed757e680e2575cdc71
|
43719f7c15008f2e72268ce5058069e7c43b67ed
| 2022-11-07T07:19:56Z |
java
| 2022-11-27T05:15:38Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapperTest.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.BaseDaoTest;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.ProjectUser;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
public class ProjectMapperTest extends BaseDaoTest {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,763 |
[Improvement][UT] Improve testListAuthorizedProjects() in ProjectMapperTest
|
### 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 testListAuthorizedProjects() in ProjectMapperTest
### 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/12763
|
https://github.com/apache/dolphinscheduler/pull/12768
|
597ae5ff7ce68251d6194ed757e680e2575cdc71
|
43719f7c15008f2e72268ce5058069e7c43b67ed
| 2022-11-07T07:19:56Z |
java
| 2022-11-27T05:15:38Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapperTest.java
|
@Autowired
private ProjectMapper projectMapper;
@Autowired
private UserMapper userMapper;
@Autowired
private ProjectUserMapper projectUserMapper;
/**
* insert
*
* @return Project
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,763 |
[Improvement][UT] Improve testListAuthorizedProjects() in ProjectMapperTest
|
### 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 testListAuthorizedProjects() in ProjectMapperTest
### 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/12763
|
https://github.com/apache/dolphinscheduler/pull/12768
|
597ae5ff7ce68251d6194ed757e680e2575cdc71
|
43719f7c15008f2e72268ce5058069e7c43b67ed
| 2022-11-07T07:19:56Z |
java
| 2022-11-27T05:15:38Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapperTest.java
|
private Project insertOne() {
Project project = new Project();
project.setName("ut project");
project.setUserId(111);
project.setCode(1L);
project.setCreateTime(new Date());
project.setUpdateTime(new Date());
projectMapper.insert(project);
return project;
}
/**
* test update
*/
@Test
public void testUpdate() {
Project project = insertOne();
project.setCreateTime(new Date());
int update = projectMapper.updateById(project);
Assertions.assertEquals(update, 1);
}
/**
* test delete
*/
@Test
public void testDelete() {
Project projectMap = insertOne();
int delete = projectMapper.deleteById(projectMap.getId());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,763 |
[Improvement][UT] Improve testListAuthorizedProjects() in ProjectMapperTest
|
### 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 testListAuthorizedProjects() in ProjectMapperTest
### 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/12763
|
https://github.com/apache/dolphinscheduler/pull/12768
|
597ae5ff7ce68251d6194ed757e680e2575cdc71
|
43719f7c15008f2e72268ce5058069e7c43b67ed
| 2022-11-07T07:19:56Z |
java
| 2022-11-27T05:15:38Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapperTest.java
|
Assertions.assertEquals(delete, 1);
}
/**
* test query
*/
@Test
public void testQuery() {
Project project = insertOne();
List<Project> projects = projectMapper.selectList(null);
Assertions.assertNotEquals(projects.size(), 0);
}
/**
* test query detail by id
*/
@Test
public void testQueryDetailById() {
User user = new User();
user.setUserName("ut user");
userMapper.insert(user);
Project project = insertOne();
project.setUserId(user.getId());
projectMapper.updateById(project);
Project project1 = projectMapper.queryDetailById(project.getId());
Assertions.assertNotEquals(project1, null);
Assertions.assertEquals(project1.getUserName(), user.getUserName());
}
/**
* test query project by name
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,763 |
[Improvement][UT] Improve testListAuthorizedProjects() in ProjectMapperTest
|
### 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 testListAuthorizedProjects() in ProjectMapperTest
### 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/12763
|
https://github.com/apache/dolphinscheduler/pull/12768
|
597ae5ff7ce68251d6194ed757e680e2575cdc71
|
43719f7c15008f2e72268ce5058069e7c43b67ed
| 2022-11-07T07:19:56Z |
java
| 2022-11-27T05:15:38Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapperTest.java
|
@Test
public void testQueryProjectByName() {
User user = new User();
user.setUserName("ut user");
userMapper.insert(user);
Project project = insertOne();
project.setUserId(user.getId());
projectMapper.updateById(project);
Project project1 = projectMapper.queryByName(project.getName());
Assertions.assertNotEquals(project1, null);
}
/**
* test page
*/
@Test
public void testQueryProjectListPaging() {
Project project = insertOne();
User user = new User();
user.setUserName("ut user");
userMapper.insert(user);
project.setUserId(user.getId());
projectMapper.updateById(project);
Page<Project> page = new Page(1, 3);
IPage<Project> projectIPage = projectMapper.queryProjectListPaging(
page,
null,
null);
IPage<Project> projectIPage1 = projectMapper.queryProjectListPaging(
page,
null,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,763 |
[Improvement][UT] Improve testListAuthorizedProjects() in ProjectMapperTest
|
### 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 testListAuthorizedProjects() in ProjectMapperTest
### 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/12763
|
https://github.com/apache/dolphinscheduler/pull/12768
|
597ae5ff7ce68251d6194ed757e680e2575cdc71
|
43719f7c15008f2e72268ce5058069e7c43b67ed
| 2022-11-07T07:19:56Z |
java
| 2022-11-27T05:15:38Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapperTest.java
|
project.getName());
Assertions.assertEquals(projectIPage.getTotal(), 1);
Assertions.assertEquals(projectIPage1.getTotal(), 1);
}
/**
* test query project create user
*/
@Test
public void testQueryProjectCreatedByUser() {
Project project = insertOne();
List<Project> projects = projectMapper.queryProjectCreatedByUser(project.getUserId());
Assertions.assertNotEquals(projects.size(), 0);
}
/**
* test query authed project list by userId
*/
@Test
public void testQueryAuthedProjectListByUserId() {
Project project = insertOne();
List<Project> projects = projectMapper.queryProjectCreatedByUser(project.getUserId());
Assertions.assertNotEquals(projects.size(), 0);
}
/**
* test query project expect userId
*/
@Test
public void testQueryProjectExceptUserId() {
Project project = insertOne();
List<Project> projects = projectMapper.queryProjectExceptUserId(
100000);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,763 |
[Improvement][UT] Improve testListAuthorizedProjects() in ProjectMapperTest
|
### 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 testListAuthorizedProjects() in ProjectMapperTest
### 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/12763
|
https://github.com/apache/dolphinscheduler/pull/12768
|
597ae5ff7ce68251d6194ed757e680e2575cdc71
|
43719f7c15008f2e72268ce5058069e7c43b67ed
| 2022-11-07T07:19:56Z |
java
| 2022-11-27T05:15:38Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapperTest.java
|
Assertions.assertNotEquals(projects.size(), 0);
}
@Test
public void testQueryAllProject() {
User user = new User();
user.setUserName("ut user");
userMapper.insert(user);
Project project = insertOne();
project.setUserId(user.getId());
projectMapper.updateById(project);
ProjectUser projectUser = new ProjectUser();
projectUser.setProjectId(project.getId());
projectUser.setUserId(user.getId());
projectUser.setCreateTime(new Date());
projectUser.setUpdateTime(new Date());
projectUserMapper.insert(projectUser);
List<Project> allProject = projectMapper.queryAllProject(user.getId());
Assertions.assertNotEquals(allProject.size(), 0);
}
/**
* test query project permission
*/
@Test
public void testListAuthorizedProjects() {
Project project = insertOne();
List<Project> projects = projectMapper.listAuthorizedProjects(1, Collections.singletonList(project.getId()));
Assertions.assertEquals(projects.size(), 0);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,994 |
[Bug] [Worker] kill process does not take effect
|
### 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
When I execute a shell task, a workflow instance will be generated, click the stop button on the workflow instance, and check the status of the shell task instance on the page is KILL, but I found that the shell task is still executing and has not been Killed.
shell task definition
<img width="639" alt="image" src="https://user-images.githubusercontent.com/37063904/203911534-72c32290-5904-45de-bf45-e0a851e5abf8.png">
shell task instance
<img width="1182" alt="image" src="https://user-images.githubusercontent.com/37063904/203911588-c2cdc9b1-300d-436f-994d-b0df0cbbf09b.png">
shell task instance log
<img width="896" alt="image" src="https://user-images.githubusercontent.com/37063904/203911733-3585fb95-fa89-4449-abb4-cf2443aaf45c.png">
I have killed the task at 02 minutes, and the status of the task instance is KILL, but the task instance log is still executing after 02 minutes, and the execution is successful.
### What you expected to happen
The task is actually killed.
### How to reproduce
Create a workflow definition with only one shell task inside. Execute this workflow definition manually, click the stop button on the generated workflow instance, and view the status and logs of the task instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12994
|
https://github.com/apache/dolphinscheduler/pull/12995
|
43719f7c15008f2e72268ce5058069e7c43b67ed
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
| 2022-11-25T05:58:41Z |
java
| 2022-11-27T06:27:48Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,994 |
[Bug] [Worker] kill process does not take effect
|
### 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
When I execute a shell task, a workflow instance will be generated, click the stop button on the workflow instance, and check the status of the shell task instance on the page is KILL, but I found that the shell task is still executing and has not been Killed.
shell task definition
<img width="639" alt="image" src="https://user-images.githubusercontent.com/37063904/203911534-72c32290-5904-45de-bf45-e0a851e5abf8.png">
shell task instance
<img width="1182" alt="image" src="https://user-images.githubusercontent.com/37063904/203911588-c2cdc9b1-300d-436f-994d-b0df0cbbf09b.png">
shell task instance log
<img width="896" alt="image" src="https://user-images.githubusercontent.com/37063904/203911733-3585fb95-fa89-4449-abb4-cf2443aaf45c.png">
I have killed the task at 02 minutes, and the status of the task instance is KILL, but the task instance log is still executing after 02 minutes, and the execution is successful.
### What you expected to happen
The task is actually killed.
### How to reproduce
Create a workflow definition with only one shell task inside. Execute this workflow definition manually, click the stop button on the generated workflow instance, and view the status and logs of the task instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12994
|
https://github.com/apache/dolphinscheduler/pull/12995
|
43719f7c15008f2e72268ce5058069e7c43b67ed
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
| 2022-11-25T05:58:41Z |
java
| 2022-11-27T06:27:48Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
|
package org.apache.dolphinscheduler.plugin.task.api;
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 org.apache.dolphinscheduler.common.utils.PropertyUtils;
import org.apache.dolphinscheduler.plugin.task.api.model.TaskResponse;
import org.apache.dolphinscheduler.plugin.task.api.utils.AbstractCommandExecutorConstants;
import org.apache.dolphinscheduler.plugin.task.api.utils.OSUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
/**
* abstract command executor
*/
public abstract class AbstractCommandExecutor {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,994 |
[Bug] [Worker] kill process does not take effect
|
### 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
When I execute a shell task, a workflow instance will be generated, click the stop button on the workflow instance, and check the status of the shell task instance on the page is KILL, but I found that the shell task is still executing and has not been Killed.
shell task definition
<img width="639" alt="image" src="https://user-images.githubusercontent.com/37063904/203911534-72c32290-5904-45de-bf45-e0a851e5abf8.png">
shell task instance
<img width="1182" alt="image" src="https://user-images.githubusercontent.com/37063904/203911588-c2cdc9b1-300d-436f-994d-b0df0cbbf09b.png">
shell task instance log
<img width="896" alt="image" src="https://user-images.githubusercontent.com/37063904/203911733-3585fb95-fa89-4449-abb4-cf2443aaf45c.png">
I have killed the task at 02 minutes, and the status of the task instance is KILL, but the task instance log is still executing after 02 minutes, and the execution is successful.
### What you expected to happen
The task is actually killed.
### How to reproduce
Create a workflow definition with only one shell task inside. Execute this workflow definition manually, click the stop button on the generated workflow instance, and view the status and logs of the task instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12994
|
https://github.com/apache/dolphinscheduler/pull/12995
|
43719f7c15008f2e72268ce5058069e7c43b67ed
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
| 2022-11-25T05:58:41Z |
java
| 2022-11-27T06:27:48Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
|
/**
* rules for extracting Var Pool
*/
protected static final Pattern SETVALUE_REGEX = Pattern.compile(TaskConstants.SETVALUE_REGEX);
protected StringBuilder varPool = new StringBuilder();
/**
* process
*/
private Process process;
/**
* log handler
*/
protected Consumer<LinkedBlockingQueue<String>> logHandler;
/**
* logger
*/
protected Logger logger;
/**
* log list
*/
protected LinkedBlockingQueue<String> logBuffer;
protected boolean logOutputIsSuccess = false;
/*
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,994 |
[Bug] [Worker] kill process does not take effect
|
### 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
When I execute a shell task, a workflow instance will be generated, click the stop button on the workflow instance, and check the status of the shell task instance on the page is KILL, but I found that the shell task is still executing and has not been Killed.
shell task definition
<img width="639" alt="image" src="https://user-images.githubusercontent.com/37063904/203911534-72c32290-5904-45de-bf45-e0a851e5abf8.png">
shell task instance
<img width="1182" alt="image" src="https://user-images.githubusercontent.com/37063904/203911588-c2cdc9b1-300d-436f-994d-b0df0cbbf09b.png">
shell task instance log
<img width="896" alt="image" src="https://user-images.githubusercontent.com/37063904/203911733-3585fb95-fa89-4449-abb4-cf2443aaf45c.png">
I have killed the task at 02 minutes, and the status of the task instance is KILL, but the task instance log is still executing after 02 minutes, and the execution is successful.
### What you expected to happen
The task is actually killed.
### How to reproduce
Create a workflow definition with only one shell task inside. Execute this workflow definition manually, click the stop button on the generated workflow instance, and view the status and logs of the task instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12994
|
https://github.com/apache/dolphinscheduler/pull/12995
|
43719f7c15008f2e72268ce5058069e7c43b67ed
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
| 2022-11-25T05:58:41Z |
java
| 2022-11-27T06:27:48Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
|
* SHELL result string
*/
protected String taskResultString;
/**
* taskRequest
*/
protected TaskExecutionContext taskRequest;
public AbstractCommandExecutor(Consumer<LinkedBlockingQueue<String>> logHandler,
TaskExecutionContext taskRequest,
Logger logger) {
this.logHandler = logHandler;
this.taskRequest = taskRequest;
this.logger = logger;
this.logBuffer = new LinkedBlockingQueue<>();
}
public AbstractCommandExecutor(LinkedBlockingQueue<String> logBuffer) {
this.logBuffer = logBuffer;
}
/**
* build process
*
* @param commandFile command file
* @throws IOException IO Exception
*/
private void buildProcess(String commandFile) throws IOException {
List<String> command = new LinkedList<>();
ProcessBuilder processBuilder = new ProcessBuilder();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,994 |
[Bug] [Worker] kill process does not take effect
|
### 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
When I execute a shell task, a workflow instance will be generated, click the stop button on the workflow instance, and check the status of the shell task instance on the page is KILL, but I found that the shell task is still executing and has not been Killed.
shell task definition
<img width="639" alt="image" src="https://user-images.githubusercontent.com/37063904/203911534-72c32290-5904-45de-bf45-e0a851e5abf8.png">
shell task instance
<img width="1182" alt="image" src="https://user-images.githubusercontent.com/37063904/203911588-c2cdc9b1-300d-436f-994d-b0df0cbbf09b.png">
shell task instance log
<img width="896" alt="image" src="https://user-images.githubusercontent.com/37063904/203911733-3585fb95-fa89-4449-abb4-cf2443aaf45c.png">
I have killed the task at 02 minutes, and the status of the task instance is KILL, but the task instance log is still executing after 02 minutes, and the execution is successful.
### What you expected to happen
The task is actually killed.
### How to reproduce
Create a workflow definition with only one shell task inside. Execute this workflow definition manually, click the stop button on the generated workflow instance, and view the status and logs of the task instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12994
|
https://github.com/apache/dolphinscheduler/pull/12995
|
43719f7c15008f2e72268ce5058069e7c43b67ed
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
| 2022-11-25T05:58:41Z |
java
| 2022-11-27T06:27:48Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
|
processBuilder.directory(new File(taskRequest.getExecutePath()));
processBuilder.redirectErrorStream(true);
if (OSUtils.isSudoEnable()) {
if (SystemUtils.IS_OS_LINUX
&& PropertyUtils.getBoolean(AbstractCommandExecutorConstants.TASK_RESOURCE_LIMIT_STATE)) {
generateCgroupCommand(command);
} else {
command.add("sudo");
command.add("-u");
command.add(taskRequest.getTenantCode());
command.add("-E");
}
}
command.add(commandInterpreter());
command.add(commandFile);
processBuilder.command(command);
process = processBuilder.start();
printCommand(command);
}
/**
* generate systemd command.
* eg: sudo systemd-run -q --scope -p CPUQuota=100% -p MemoryMax=200M --uid=root
* @param command command
*/
private void generateCgroupCommand(List<String> command) {
Integer cpuQuota = taskRequest.getCpuQuota();
Integer memoryMax = taskRequest.getMemoryMax();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,994 |
[Bug] [Worker] kill process does not take effect
|
### 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
When I execute a shell task, a workflow instance will be generated, click the stop button on the workflow instance, and check the status of the shell task instance on the page is KILL, but I found that the shell task is still executing and has not been Killed.
shell task definition
<img width="639" alt="image" src="https://user-images.githubusercontent.com/37063904/203911534-72c32290-5904-45de-bf45-e0a851e5abf8.png">
shell task instance
<img width="1182" alt="image" src="https://user-images.githubusercontent.com/37063904/203911588-c2cdc9b1-300d-436f-994d-b0df0cbbf09b.png">
shell task instance log
<img width="896" alt="image" src="https://user-images.githubusercontent.com/37063904/203911733-3585fb95-fa89-4449-abb4-cf2443aaf45c.png">
I have killed the task at 02 minutes, and the status of the task instance is KILL, but the task instance log is still executing after 02 minutes, and the execution is successful.
### What you expected to happen
The task is actually killed.
### How to reproduce
Create a workflow definition with only one shell task inside. Execute this workflow definition manually, click the stop button on the generated workflow instance, and view the status and logs of the task instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12994
|
https://github.com/apache/dolphinscheduler/pull/12995
|
43719f7c15008f2e72268ce5058069e7c43b67ed
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
| 2022-11-25T05:58:41Z |
java
| 2022-11-27T06:27:48Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
|
command.add("sudo");
command.add("systemd-run");
command.add("-q");
command.add("--scope");
if (cpuQuota == -1) {
command.add("-p");
command.add("CPUQuota=");
} else {
command.add("-p");
command.add(String.format("CPUQuota=%s%%", taskRequest.getCpuQuota()));
}
if (memoryMax == -1) {
command.add("-p");
command.add(String.format("MemoryMax=%s", "infinity"));
} else {
command.add("-p");
command.add(String.format("MemoryMax=%sM", taskRequest.getMemoryMax()));
}
command.add(String.format("--uid=%s", taskRequest.getTenantCode()));
}
public TaskResponse run(String execCommand) throws IOException, InterruptedException {
TaskResponse result = new TaskResponse();
int taskInstanceId = taskRequest.getTaskInstanceId();
if (null == TaskExecutionContextCacheManager.getByTaskInstanceId(taskInstanceId)) {
result.setExitStatusCode(EXIT_CODE_KILL);
return result;
}
if (StringUtils.isEmpty(execCommand)) {
TaskExecutionContextCacheManager.removeByTaskInstanceId(taskInstanceId);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,994 |
[Bug] [Worker] kill process does not take effect
|
### 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
When I execute a shell task, a workflow instance will be generated, click the stop button on the workflow instance, and check the status of the shell task instance on the page is KILL, but I found that the shell task is still executing and has not been Killed.
shell task definition
<img width="639" alt="image" src="https://user-images.githubusercontent.com/37063904/203911534-72c32290-5904-45de-bf45-e0a851e5abf8.png">
shell task instance
<img width="1182" alt="image" src="https://user-images.githubusercontent.com/37063904/203911588-c2cdc9b1-300d-436f-994d-b0df0cbbf09b.png">
shell task instance log
<img width="896" alt="image" src="https://user-images.githubusercontent.com/37063904/203911733-3585fb95-fa89-4449-abb4-cf2443aaf45c.png">
I have killed the task at 02 minutes, and the status of the task instance is KILL, but the task instance log is still executing after 02 minutes, and the execution is successful.
### What you expected to happen
The task is actually killed.
### How to reproduce
Create a workflow definition with only one shell task inside. Execute this workflow definition manually, click the stop button on the generated workflow instance, and view the status and logs of the task instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12994
|
https://github.com/apache/dolphinscheduler/pull/12995
|
43719f7c15008f2e72268ce5058069e7c43b67ed
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
| 2022-11-25T05:58:41Z |
java
| 2022-11-27T06:27:48Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
|
}
String commandFilePath = buildCommandFilePath();
createCommandFileIfNotExists(execCommand, commandFilePath);
buildProcess(commandFilePath);
parseProcessOutput(process);
int processId = getProcessId(process);
result.setProcessId(processId);
taskRequest.setProcessId(processId);
boolean updateTaskExecutionContextStatus =
TaskExecutionContextCacheManager.updateTaskExecutionContext(taskRequest);
if (Boolean.FALSE.equals(updateTaskExecutionContextStatus)) {
ProcessUtils.kill(taskRequest);
result.setExitStatusCode(EXIT_CODE_KILL);
return result;
}
logger.info("process start, process id is: {}", processId);
long remainTime = getRemainTime();
boolean status = process.waitFor(remainTime, TimeUnit.SECONDS);
if (status) {
result.setExitStatusCode(process.exitValue());
} else {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,994 |
[Bug] [Worker] kill process does not take effect
|
### 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
When I execute a shell task, a workflow instance will be generated, click the stop button on the workflow instance, and check the status of the shell task instance on the page is KILL, but I found that the shell task is still executing and has not been Killed.
shell task definition
<img width="639" alt="image" src="https://user-images.githubusercontent.com/37063904/203911534-72c32290-5904-45de-bf45-e0a851e5abf8.png">
shell task instance
<img width="1182" alt="image" src="https://user-images.githubusercontent.com/37063904/203911588-c2cdc9b1-300d-436f-994d-b0df0cbbf09b.png">
shell task instance log
<img width="896" alt="image" src="https://user-images.githubusercontent.com/37063904/203911733-3585fb95-fa89-4449-abb4-cf2443aaf45c.png">
I have killed the task at 02 minutes, and the status of the task instance is KILL, but the task instance log is still executing after 02 minutes, and the execution is successful.
### What you expected to happen
The task is actually killed.
### How to reproduce
Create a workflow definition with only one shell task inside. Execute this workflow definition manually, click the stop button on the generated workflow instance, and view the status and logs of the task instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12994
|
https://github.com/apache/dolphinscheduler/pull/12995
|
43719f7c15008f2e72268ce5058069e7c43b67ed
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
| 2022-11-25T05:58:41Z |
java
| 2022-11-27T06:27:48Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
|
logger.error("process has failure, the task timeout configuration value is:{}, ready to kill ...",
taskRequest.getTaskTimeout());
ProcessUtils.kill(taskRequest);
result.setExitStatusCode(EXIT_CODE_FAILURE);
}
logger.info(
"process has exited, execute path:{}, processId:{} ,exitStatusCode:{} ,processWaitForStatus:{} ,processExitValue:{}",
taskRequest.getExecutePath(), processId, result.getExitStatusCode(), status, process.exitValue());
return result;
}
public String getVarPool() {
return varPool.toString();
}
/**
* cancel application
*
* @throws Exception exception
*/
public void cancelApplication() throws Exception {
if (process == null) {
return;
}
clear();
int processId = getProcessId(process);
logger.info("cancel process: {}", processId);
boolean killed = softKill(processId);
if (!killed) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,994 |
[Bug] [Worker] kill process does not take effect
|
### 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
When I execute a shell task, a workflow instance will be generated, click the stop button on the workflow instance, and check the status of the shell task instance on the page is KILL, but I found that the shell task is still executing and has not been Killed.
shell task definition
<img width="639" alt="image" src="https://user-images.githubusercontent.com/37063904/203911534-72c32290-5904-45de-bf45-e0a851e5abf8.png">
shell task instance
<img width="1182" alt="image" src="https://user-images.githubusercontent.com/37063904/203911588-c2cdc9b1-300d-436f-994d-b0df0cbbf09b.png">
shell task instance log
<img width="896" alt="image" src="https://user-images.githubusercontent.com/37063904/203911733-3585fb95-fa89-4449-abb4-cf2443aaf45c.png">
I have killed the task at 02 minutes, and the status of the task instance is KILL, but the task instance log is still executing after 02 minutes, and the execution is successful.
### What you expected to happen
The task is actually killed.
### How to reproduce
Create a workflow definition with only one shell task inside. Execute this workflow definition manually, click the stop button on the generated workflow instance, and view the status and logs of the task instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12994
|
https://github.com/apache/dolphinscheduler/pull/12995
|
43719f7c15008f2e72268ce5058069e7c43b67ed
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
| 2022-11-25T05:58:41Z |
java
| 2022-11-27T06:27:48Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
|
hardKill(processId);
process.destroy();
process = null;
}
}
/**
* soft kill
*
* @param processId process id
* @return process is alive
*/
private boolean softKill(int processId) {
if (processId != 0 && process.isAlive()) {
try {
String cmd = String.format("kill %d", processId);
cmd = OSUtils.getSudoCmd(taskRequest.getTenantCode(), cmd);
logger.info("soft kill task:{}, process id:{}, cmd:{}", taskRequest.getTaskAppId(), processId, cmd);
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
logger.info("kill attempt failed", e);
}
}
return process.isAlive();
}
/**
* hard kill
*
* @param processId process id
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,994 |
[Bug] [Worker] kill process does not take effect
|
### 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
When I execute a shell task, a workflow instance will be generated, click the stop button on the workflow instance, and check the status of the shell task instance on the page is KILL, but I found that the shell task is still executing and has not been Killed.
shell task definition
<img width="639" alt="image" src="https://user-images.githubusercontent.com/37063904/203911534-72c32290-5904-45de-bf45-e0a851e5abf8.png">
shell task instance
<img width="1182" alt="image" src="https://user-images.githubusercontent.com/37063904/203911588-c2cdc9b1-300d-436f-994d-b0df0cbbf09b.png">
shell task instance log
<img width="896" alt="image" src="https://user-images.githubusercontent.com/37063904/203911733-3585fb95-fa89-4449-abb4-cf2443aaf45c.png">
I have killed the task at 02 minutes, and the status of the task instance is KILL, but the task instance log is still executing after 02 minutes, and the execution is successful.
### What you expected to happen
The task is actually killed.
### How to reproduce
Create a workflow definition with only one shell task inside. Execute this workflow definition manually, click the stop button on the generated workflow instance, and view the status and logs of the task instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12994
|
https://github.com/apache/dolphinscheduler/pull/12995
|
43719f7c15008f2e72268ce5058069e7c43b67ed
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
| 2022-11-25T05:58:41Z |
java
| 2022-11-27T06:27:48Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
|
*/
private void hardKill(int processId) {
if (processId != 0 && process.isAlive()) {
try {
String cmd = String.format("kill -9 %d", processId);
cmd = OSUtils.getSudoCmd(taskRequest.getTenantCode(), cmd);
logger.info("hard kill task:{}, process id:{}, cmd:{}", taskRequest.getTaskAppId(), processId, cmd);
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
logger.error("kill attempt failed ", e);
}
}
}
private void printCommand(List<String> commands) {
logger.info("task run command: {}", String.join(" ", commands));
}
/**
* clear
*/
private void clear() {
LinkedBlockingQueue<String> markerLog = new LinkedBlockingQueue<>(1);
markerLog.add(ch.qos.logback.classic.ClassicConstants.FINALIZE_SESSION_MARKER.toString());
if (!logBuffer.isEmpty()) {
logHandler.accept(logBuffer);
logBuffer.clear();
}
logHandler.accept(markerLog);
}
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,994 |
[Bug] [Worker] kill process does not take effect
|
### 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
When I execute a shell task, a workflow instance will be generated, click the stop button on the workflow instance, and check the status of the shell task instance on the page is KILL, but I found that the shell task is still executing and has not been Killed.
shell task definition
<img width="639" alt="image" src="https://user-images.githubusercontent.com/37063904/203911534-72c32290-5904-45de-bf45-e0a851e5abf8.png">
shell task instance
<img width="1182" alt="image" src="https://user-images.githubusercontent.com/37063904/203911588-c2cdc9b1-300d-436f-994d-b0df0cbbf09b.png">
shell task instance log
<img width="896" alt="image" src="https://user-images.githubusercontent.com/37063904/203911733-3585fb95-fa89-4449-abb4-cf2443aaf45c.png">
I have killed the task at 02 minutes, and the status of the task instance is KILL, but the task instance log is still executing after 02 minutes, and the execution is successful.
### What you expected to happen
The task is actually killed.
### How to reproduce
Create a workflow definition with only one shell task inside. Execute this workflow definition manually, click the stop button on the generated workflow instance, and view the status and logs of the task instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12994
|
https://github.com/apache/dolphinscheduler/pull/12995
|
43719f7c15008f2e72268ce5058069e7c43b67ed
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
| 2022-11-25T05:58:41Z |
java
| 2022-11-27T06:27:48Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
|
* get the standard output of the process
*
* @param process process
*/
private void parseProcessOutput(Process process) {
String threadLoggerInfoName = taskRequest.getTaskLogName();
ExecutorService getOutputLogService = newDaemonSingleThreadExecutor(threadLoggerInfoName);
getOutputLogService.submit(() -> {
try (BufferedReader inReader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
String line;
while ((line = inReader.readLine()) != null) {
if (line.startsWith("${setValue(") || line.startsWith("#{setValue(")) {
varPool.append(findVarPool(line));
varPool.append("$VarPool$");
} else {
logBuffer.add(line);
taskResultString = line;
}
}
logOutputIsSuccess = true;
} catch (Exception e) {
logger.error(e.getMessage(), e);
logOutputIsSuccess = true;
}
});
getOutputLogService.shutdown();
ExecutorService parseProcessOutputExecutorService = newDaemonSingleThreadExecutor(threadLoggerInfoName);
parseProcessOutputExecutorService.submit(() -> {
try {
long lastFlushTime = System.currentTimeMillis();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,994 |
[Bug] [Worker] kill process does not take effect
|
### 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
When I execute a shell task, a workflow instance will be generated, click the stop button on the workflow instance, and check the status of the shell task instance on the page is KILL, but I found that the shell task is still executing and has not been Killed.
shell task definition
<img width="639" alt="image" src="https://user-images.githubusercontent.com/37063904/203911534-72c32290-5904-45de-bf45-e0a851e5abf8.png">
shell task instance
<img width="1182" alt="image" src="https://user-images.githubusercontent.com/37063904/203911588-c2cdc9b1-300d-436f-994d-b0df0cbbf09b.png">
shell task instance log
<img width="896" alt="image" src="https://user-images.githubusercontent.com/37063904/203911733-3585fb95-fa89-4449-abb4-cf2443aaf45c.png">
I have killed the task at 02 minutes, and the status of the task instance is KILL, but the task instance log is still executing after 02 minutes, and the execution is successful.
### What you expected to happen
The task is actually killed.
### How to reproduce
Create a workflow definition with only one shell task inside. Execute this workflow definition manually, click the stop button on the generated workflow instance, and view the status and logs of the task instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12994
|
https://github.com/apache/dolphinscheduler/pull/12995
|
43719f7c15008f2e72268ce5058069e7c43b67ed
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
| 2022-11-25T05:58:41Z |
java
| 2022-11-27T06:27:48Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
|
while (logBuffer.size() > 0 || !logOutputIsSuccess) {
if (logBuffer.size() > 0) {
lastFlushTime = flush(lastFlushTime);
} else {
Thread.sleep(TaskConstants.DEFAULT_LOG_FLUSH_INTERVAL);
}
}
} catch (Exception e) {
Thread.currentThread().interrupt();
logger.error(e.getMessage(), e);
} finally {
clear();
}
});
parseProcessOutputExecutorService.shutdown();
}
/**
* find var pool
*
* @param line
* @return
*/
private String findVarPool(String line) {
Matcher matcher = SETVALUE_REGEX.matcher(line);
if (matcher.find()) {
return matcher.group(1);
}
return null;
}
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,994 |
[Bug] [Worker] kill process does not take effect
|
### 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
When I execute a shell task, a workflow instance will be generated, click the stop button on the workflow instance, and check the status of the shell task instance on the page is KILL, but I found that the shell task is still executing and has not been Killed.
shell task definition
<img width="639" alt="image" src="https://user-images.githubusercontent.com/37063904/203911534-72c32290-5904-45de-bf45-e0a851e5abf8.png">
shell task instance
<img width="1182" alt="image" src="https://user-images.githubusercontent.com/37063904/203911588-c2cdc9b1-300d-436f-994d-b0df0cbbf09b.png">
shell task instance log
<img width="896" alt="image" src="https://user-images.githubusercontent.com/37063904/203911733-3585fb95-fa89-4449-abb4-cf2443aaf45c.png">
I have killed the task at 02 minutes, and the status of the task instance is KILL, but the task instance log is still executing after 02 minutes, and the execution is successful.
### What you expected to happen
The task is actually killed.
### How to reproduce
Create a workflow definition with only one shell task inside. Execute this workflow definition manually, click the stop button on the generated workflow instance, and view the status and logs of the task instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12994
|
https://github.com/apache/dolphinscheduler/pull/12995
|
43719f7c15008f2e72268ce5058069e7c43b67ed
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
| 2022-11-25T05:58:41Z |
java
| 2022-11-27T06:27:48Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
|
* get remain time(s)
*
* @return remain time
*/
private long getRemainTime() {
long usedTime = (System.currentTimeMillis() - taskRequest.getStartTime()) / 1000;
long remainTime = taskRequest.getTaskTimeout() - usedTime;
if (remainTime < 0) {
throw new RuntimeException("task execution time out");
}
return remainTime;
}
/**
* get process id
*
* @param process process
* @return process id
*/
private int getProcessId(Process process) {
int processId = 0;
try {
Field f = process.getClass().getDeclaredField(TaskConstants.PID);
f.setAccessible(true);
processId = f.getInt(process);
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
return processId;
}
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,994 |
[Bug] [Worker] kill process does not take effect
|
### 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
When I execute a shell task, a workflow instance will be generated, click the stop button on the workflow instance, and check the status of the shell task instance on the page is KILL, but I found that the shell task is still executing and has not been Killed.
shell task definition
<img width="639" alt="image" src="https://user-images.githubusercontent.com/37063904/203911534-72c32290-5904-45de-bf45-e0a851e5abf8.png">
shell task instance
<img width="1182" alt="image" src="https://user-images.githubusercontent.com/37063904/203911588-c2cdc9b1-300d-436f-994d-b0df0cbbf09b.png">
shell task instance log
<img width="896" alt="image" src="https://user-images.githubusercontent.com/37063904/203911733-3585fb95-fa89-4449-abb4-cf2443aaf45c.png">
I have killed the task at 02 minutes, and the status of the task instance is KILL, but the task instance log is still executing after 02 minutes, and the execution is successful.
### What you expected to happen
The task is actually killed.
### How to reproduce
Create a workflow definition with only one shell task inside. Execute this workflow definition manually, click the stop button on the generated workflow instance, and view the status and logs of the task instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12994
|
https://github.com/apache/dolphinscheduler/pull/12995
|
43719f7c15008f2e72268ce5058069e7c43b67ed
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
| 2022-11-25T05:58:41Z |
java
| 2022-11-27T06:27:48Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
|
* when log buffer siz or flush time reach condition , then flush
*
* @param lastFlushTime last flush time
* @return last flush time
*/
private long flush(long lastFlushTime) {
long now = System.currentTimeMillis();
/*
* when log buffer siz or flush time reach condition , then flush
*/
if (logBuffer.size() >= TaskConstants.DEFAULT_LOG_ROWS_NUM
|| now - lastFlushTime > TaskConstants.DEFAULT_LOG_FLUSH_INTERVAL) {
lastFlushTime = now;
logHandler.accept(logBuffer);
logBuffer.clear();
}
return lastFlushTime;
}
protected abstract String buildCommandFilePath();
protected abstract void createCommandFileIfNotExists(String execCommand, String commandFile) throws IOException;
ExecutorService newDaemonSingleThreadExecutor(String threadName) {
ThreadFactory threadFactory = new ThreadFactoryBuilder()
.setDaemon(true)
.setNameFormat(threadName)
.build();
return Executors.newSingleThreadExecutor(threadFactory);
}
protected abstract String commandInterpreter();
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,997 |
[Bug] [API] The workflow instance clicks the rerun button, and the end time is the end time of the last instance
|
### 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
The workflow instance clicks the rerun button, and the end time is the end time of the last instance.
<img width="1181" alt="iShot_2022-11-25_17 00 46" src="https://user-images.githubusercontent.com/37063904/203942380-f4f70834-5540-4302-bbee-1f6e828207fd.png">
### What you expected to happen
When the workflow instance clicks the rerun button, the end time is reset to null.
### How to reproduce
The workflow instance clicks the rerun button and observes the end time of the instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12997
|
https://github.com/apache/dolphinscheduler/pull/12998
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
|
f9a0ecbc81a5a63b4265983e41b05281db14b772
| 2022-11-25T09:06:34Z |
java
| 2022-11-27T07:08:30Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,997 |
[Bug] [API] The workflow instance clicks the rerun button, and the end time is the end time of the last instance
|
### 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
The workflow instance clicks the rerun button, and the end time is the end time of the last instance.
<img width="1181" alt="iShot_2022-11-25_17 00 46" src="https://user-images.githubusercontent.com/37063904/203942380-f4f70834-5540-4302-bbee-1f6e828207fd.png">
### What you expected to happen
When the workflow instance clicks the rerun button, the end time is reset to null.
### How to reproduce
The workflow instance clicks the rerun button and observes the end time of the instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12997
|
https://github.com/apache/dolphinscheduler/pull/12998
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
|
f9a0ecbc81a5a63b4265983e41b05281db14b772
| 2022-11-25T09:06:34Z |
java
| 2022-11-27T07:08:30Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.dao.entity;
import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.TaskDependType;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.google.common.base.Strings;
/**
* process instance
*/
@NoArgsConstructor
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,997 |
[Bug] [API] The workflow instance clicks the rerun button, and the end time is the end time of the last instance
|
### 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
The workflow instance clicks the rerun button, and the end time is the end time of the last instance.
<img width="1181" alt="iShot_2022-11-25_17 00 46" src="https://user-images.githubusercontent.com/37063904/203942380-f4f70834-5540-4302-bbee-1f6e828207fd.png">
### What you expected to happen
When the workflow instance clicks the rerun button, the end time is reset to null.
### How to reproduce
The workflow instance clicks the rerun button and observes the end time of the instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12997
|
https://github.com/apache/dolphinscheduler/pull/12998
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
|
f9a0ecbc81a5a63b4265983e41b05281db14b772
| 2022-11-25T09:06:34Z |
java
| 2022-11-27T07:08:30Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java
|
@Data
@TableName("t_ds_process_instance")
public class ProcessInstance {
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* process definition code
*/
private Long processDefinitionCode;
/**
* process definition version
*/
private int processDefinitionVersion;
/**
* process state
*/
private WorkflowExecutionStatus state;
/**
* state history
*/
private String stateHistory;
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,997 |
[Bug] [API] The workflow instance clicks the rerun button, and the end time is the end time of the last instance
|
### 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
The workflow instance clicks the rerun button, and the end time is the end time of the last instance.
<img width="1181" alt="iShot_2022-11-25_17 00 46" src="https://user-images.githubusercontent.com/37063904/203942380-f4f70834-5540-4302-bbee-1f6e828207fd.png">
### What you expected to happen
When the workflow instance clicks the rerun button, the end time is reset to null.
### How to reproduce
The workflow instance clicks the rerun button and observes the end time of the instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12997
|
https://github.com/apache/dolphinscheduler/pull/12998
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
|
f9a0ecbc81a5a63b4265983e41b05281db14b772
| 2022-11-25T09:06:34Z |
java
| 2022-11-27T07:08:30Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java
|
* state desc list from state history
*/
@TableField(exist = false)
private List<StateDesc> stateDescList;
/**
* recovery flag for failover
*/
private Flag recovery;
/**
* start time
*/
private Date startTime;
/**
* end time
*/
private Date endTime;
/**
* run time
*/
private int runTimes;
/**
* name
*/
private String name;
/**
* host
*/
private String host;
/**
* process definition structure
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,997 |
[Bug] [API] The workflow instance clicks the rerun button, and the end time is the end time of the last instance
|
### 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
The workflow instance clicks the rerun button, and the end time is the end time of the last instance.
<img width="1181" alt="iShot_2022-11-25_17 00 46" src="https://user-images.githubusercontent.com/37063904/203942380-f4f70834-5540-4302-bbee-1f6e828207fd.png">
### What you expected to happen
When the workflow instance clicks the rerun button, the end time is reset to null.
### How to reproduce
The workflow instance clicks the rerun button and observes the end time of the instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12997
|
https://github.com/apache/dolphinscheduler/pull/12998
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
|
f9a0ecbc81a5a63b4265983e41b05281db14b772
| 2022-11-25T09:06:34Z |
java
| 2022-11-27T07:08:30Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java
|
*/
@TableField(exist = false)
private ProcessDefinition processDefinition;
/**
* process command type
*/
private CommandType commandType;
/**
* command parameters
*/
private String commandParam;
/**
* node depend type
*/
private TaskDependType taskDependType;
/**
* task max try times
*/
private int maxTryTimes;
/**
* failure strategy when task failed.
*/
private FailureStrategy failureStrategy;
/**
* warning type
*/
private WarningType warningType;
/**
* warning group
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,997 |
[Bug] [API] The workflow instance clicks the rerun button, and the end time is the end time of the last instance
|
### 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
The workflow instance clicks the rerun button, and the end time is the end time of the last instance.
<img width="1181" alt="iShot_2022-11-25_17 00 46" src="https://user-images.githubusercontent.com/37063904/203942380-f4f70834-5540-4302-bbee-1f6e828207fd.png">
### What you expected to happen
When the workflow instance clicks the rerun button, the end time is reset to null.
### How to reproduce
The workflow instance clicks the rerun button and observes the end time of the instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12997
|
https://github.com/apache/dolphinscheduler/pull/12998
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
|
f9a0ecbc81a5a63b4265983e41b05281db14b772
| 2022-11-25T09:06:34Z |
java
| 2022-11-27T07:08:30Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java
|
private Integer warningGroupId;
/**
* schedule time
*/
private Date scheduleTime;
/**
* command start time
*/
private Date commandStartTime;
/**
* user define parameters string
*/
private String globalParams;
/**
* dagData
*/
@TableField(exist = false)
private DagData dagData;
/**
* executor id
*/
private int executorId;
/**
* executor name
*/
@TableField(exist = false)
private String executorName;
/**
* tenant code
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,997 |
[Bug] [API] The workflow instance clicks the rerun button, and the end time is the end time of the last instance
|
### 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
The workflow instance clicks the rerun button, and the end time is the end time of the last instance.
<img width="1181" alt="iShot_2022-11-25_17 00 46" src="https://user-images.githubusercontent.com/37063904/203942380-f4f70834-5540-4302-bbee-1f6e828207fd.png">
### What you expected to happen
When the workflow instance clicks the rerun button, the end time is reset to null.
### How to reproduce
The workflow instance clicks the rerun button and observes the end time of the instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12997
|
https://github.com/apache/dolphinscheduler/pull/12998
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
|
f9a0ecbc81a5a63b4265983e41b05281db14b772
| 2022-11-25T09:06:34Z |
java
| 2022-11-27T07:08:30Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java
|
@TableField(exist = false)
private String tenantCode;
/**
* queue
*/
@TableField(exist = false)
private String queue;
/**
* process is sub process
*/
private Flag isSubProcess;
/**
* task locations for web
*/
@TableField(exist = false)
private String locations;
/**
* history command
*/
private String historyCmd;
/**
* depend processes schedule time
*/
@TableField(exist = false)
private String dependenceScheduleTimes;
/**
* process duration
*
* @return
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,997 |
[Bug] [API] The workflow instance clicks the rerun button, and the end time is the end time of the last instance
|
### 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
The workflow instance clicks the rerun button, and the end time is the end time of the last instance.
<img width="1181" alt="iShot_2022-11-25_17 00 46" src="https://user-images.githubusercontent.com/37063904/203942380-f4f70834-5540-4302-bbee-1f6e828207fd.png">
### What you expected to happen
When the workflow instance clicks the rerun button, the end time is reset to null.
### How to reproduce
The workflow instance clicks the rerun button and observes the end time of the instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12997
|
https://github.com/apache/dolphinscheduler/pull/12998
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
|
f9a0ecbc81a5a63b4265983e41b05281db14b772
| 2022-11-25T09:06:34Z |
java
| 2022-11-27T07:08:30Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java
|
@TableField(exist = false)
private String duration;
/**
* process instance priority
*/
private Priority processInstancePriority;
/**
* worker group
*/
private String workerGroup;
/**
* environment code
*/
private Long environmentCode;
/**
* process timeout for warning
*/
private int timeout;
/**
* tenant id
*/
private int tenantId;
/**
* varPool string
*/
private String varPool;
/**
* serial queue next processInstanceId
*/
private int nextProcessInstanceId;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,997 |
[Bug] [API] The workflow instance clicks the rerun button, and the end time is the end time of the last instance
|
### 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
The workflow instance clicks the rerun button, and the end time is the end time of the last instance.
<img width="1181" alt="iShot_2022-11-25_17 00 46" src="https://user-images.githubusercontent.com/37063904/203942380-f4f70834-5540-4302-bbee-1f6e828207fd.png">
### What you expected to happen
When the workflow instance clicks the rerun button, the end time is reset to null.
### How to reproduce
The workflow instance clicks the rerun button and observes the end time of the instance.
### Anything else
_No response_
### Version
3.1.x
### 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/12997
|
https://github.com/apache/dolphinscheduler/pull/12998
|
d480c271ec7d86b3af1a6132b88bbb2cdcabc558
|
f9a0ecbc81a5a63b4265983e41b05281db14b772
| 2022-11-25T09:06:34Z |
java
| 2022-11-27T07:08:30Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java
|
/**
* dry run flag
*/
private int dryRun;
/**
* re-start time
*/
private Date restartTime;
/**
* workflow block flag
*/
@TableField(exist = false)
private boolean isBlocked;
/**
* test flag
*/
private int testFlag;
/**
* set the process name with process define version and timestamp
*
* @param processDefinition processDefinition
*/
public ProcessInstance(ProcessDefinition processDefinition) {
this.processDefinition = processDefinition;
this.name = String.join("-",
processDefinition.getName(),
String.valueOf(processDefinition.getVersion()),
DateUtils.getCurrentTimeStamp());
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.