Skip to content
Open
1 change: 1 addition & 0 deletions docs/docs/en/guide/upgrade/incompatible.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ This document records the incompatible updates between each version. You need to
* **Removed transient fields**: `stateDescList`, `workflowDefinition`, `dagData`, `queue`, `locations`, `dependenceScheduleTimes`
* **Removed derived properties**: `cmdTypeIfComplement`, `complementData` (related to complement-data executions; use the detail API to obtain them)
* To obtain any of these fields, use the detail API `GET /projects/{projectCode}/workflow-instances/{id}` instead, which continues to return the full `WorkflowInstance` object. ([#18444](https://github.com/apache/dolphinscheduler/pull/18444))
* The task instance list APIs (`GET /projects/{projectCode}/task-instances`, `GET /projects/{projectCode}/task-instances/visual`) no longer return the heavy fields `taskParams`, `varPool`, and `logPath` in the response body. To obtain these fields, use the task detail obtained from the workflow instance detail API, which continues to return the full `TaskInstance` object. ([#18595](https://github.com/apache/dolphinscheduler/pull/18595))

1 change: 1 addition & 0 deletions docs/docs/zh/guide/upgrade/incompatible.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@
* **移除的非数据库字段**:`stateDescList`、`workflowDefinition`、`dagData`、`queue`、`locations`、`dependenceScheduleTimes`
* **移除的派生属性**:`cmdTypeIfComplement`、`complementData`(补数执行相关,如需获取请使用详情接口)
* 如需获取这些字段,请使用详情接口 `GET /projects/{projectCode}/workflow-instances/{id}`,该接口仍返回完整的 `WorkflowInstance` 对象 ([#18444](https://github.com/apache/dolphinscheduler/pull/18444))
* 任务实例列表接口(`GET /projects/{projectCode}/task-instances`、`GET /projects/{projectCode}/task-instances/visual`)的响应体不再返回大字段 `taskParams`、`varPool` 和 `logPath`。如需获取这些字段,请通过工作流实例详情接口获取任务详情,该接口仍返回完整的 `TaskInstance` 对象 ([#18595](https://github.com/apache/dolphinscheduler/pull/18595))

Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,13 @@
import org.apache.dolphinscheduler.api.service.TaskInstanceService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.api.utils.SensitivePropertyUtils;
import org.apache.dolphinscheduler.api.vo.TaskInstanceSummaryVO;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.TaskExecuteType;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus;
import org.apache.dolphinscheduler.plugin.task.api.utils.ParameterUtils;

import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
Expand Down Expand Up @@ -99,25 +96,25 @@ public class TaskInstanceController extends BaseController {
@GetMapping()
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_TASK_LIST_PAGING_ERROR)
public Result<PageInfo<TaskInstance>> queryTaskListPaging(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@Parameter(name = "projectCode", description = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "workflowInstanceId", required = false, defaultValue = "0") Integer workflowInstanceId,
@RequestParam(value = "workflowInstanceName", required = false) String workflowInstanceName,
@RequestParam(value = "workflowDefinitionName", required = false) String workflowDefinitionName,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam(value = "taskName", required = false) String taskName,
@RequestParam(value = "taskCode", required = false) Long taskCode,
@RequestParam(value = "executorName", required = false) String executorName,
@RequestParam(value = "stateType", required = false) TaskExecutionStatus stateType,
@RequestParam(value = "host", required = false) String host,
@RequestParam(value = "startDate", required = false) String startTime,
@RequestParam(value = "endDate", required = false) String endTime,
@RequestParam(value = "taskExecuteType", required = false, defaultValue = "BATCH") TaskExecuteType taskExecuteType,
@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize) {
public Result<PageInfo<TaskInstanceSummaryVO>> queryTaskListPaging(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@Parameter(name = "projectCode", description = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "workflowInstanceId", required = false, defaultValue = "0") Integer workflowInstanceId,
@RequestParam(value = "workflowInstanceName", required = false) String workflowInstanceName,
@RequestParam(value = "workflowDefinitionName", required = false) String workflowDefinitionName,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam(value = "taskName", required = false) String taskName,
@RequestParam(value = "taskCode", required = false) Long taskCode,
@RequestParam(value = "executorName", required = false) String executorName,
@RequestParam(value = "stateType", required = false) TaskExecutionStatus stateType,
@RequestParam(value = "host", required = false) String host,
@RequestParam(value = "startDate", required = false) String startTime,
@RequestParam(value = "endDate", required = false) String endTime,
@RequestParam(value = "taskExecuteType", required = false, defaultValue = "BATCH") TaskExecuteType taskExecuteType,
@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize) {
checkPageParams(pageNo, pageSize);
searchVal = ParameterUtils.handleEscapes(searchVal);
Result<PageInfo<TaskInstance>> result = taskInstanceService.queryTaskListPaging(
return taskInstanceService.queryTaskListPaging(
loginUser,
projectCode,
workflowInstanceId,
Expand All @@ -134,13 +131,6 @@ public Result<PageInfo<TaskInstance>> queryTaskListPaging(@Parameter(hidden = tr
taskExecuteType,
pageNo,
pageSize);
PageInfo<TaskInstance> pageInfo = result.getData();
if (pageInfo != null && pageInfo.getTotalList() != null) {
pageInfo.setTotalList(pageInfo.getTotalList().stream()
.map(SensitivePropertyUtils::mask)
.collect(Collectors.toList()));
}
return result;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.api.vo.TaskInstanceSummaryVO;
import org.apache.dolphinscheduler.common.enums.TaskExecuteType;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus;

Expand All @@ -44,22 +44,22 @@ public interface TaskInstanceService {
* @param pageSize page size
* @return task list page
*/
Result<PageInfo<TaskInstance>> queryTaskListPaging(User loginUser,
long projectCode,
Integer workflowInstanceId,
String workflowInstanceName,
String workflowDefinitionName,
String taskName,
Long taskCode,
String executorName,
String startDate,
String endDate,
String searchVal,
TaskExecutionStatus stateType,
String host,
TaskExecuteType taskExecuteType,
Integer pageNo,
Integer pageSize);
Result<PageInfo<TaskInstanceSummaryVO>> queryTaskListPaging(User loginUser,
long projectCode,
Integer workflowInstanceId,
String workflowInstanceName,
String workflowDefinitionName,
String taskName,
Long taskCode,
String executorName,
String startDate,
String endDate,
String searchVal,
TaskExecutionStatus stateType,
String host,
TaskExecuteType taskExecuteType,
Integer pageNo,
Integer pageSize);

/**
* change one task instance's state from failure to forced success
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
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.api.vo.TaskInstanceSummaryVO;
import org.apache.dolphinscheduler.common.enums.TaskExecuteType;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
import org.apache.dolphinscheduler.dao.model.TaskInstanceSummaryDto;
import org.apache.dolphinscheduler.dao.repository.ProjectDao;
import org.apache.dolphinscheduler.dao.repository.TaskInstanceDao;
import org.apache.dolphinscheduler.dao.repository.WorkflowInstanceDao;
Expand Down Expand Up @@ -106,23 +108,23 @@ public class TaskInstanceServiceImpl extends BaseServiceImpl implements TaskInst
* @return task list page
*/
@Override
public Result<PageInfo<TaskInstance>> queryTaskListPaging(User loginUser,
long projectCode,
Integer workflowInstanceId,
String workflowInstanceName,
String workflowDefinitionName,
String taskName,
Long taskCode,
String executorName,
String startDate,
String endDate,
String searchVal,
TaskExecutionStatus stateType,
String host,
TaskExecuteType taskExecuteType,
Integer pageNo,
Integer pageSize) {
Result<PageInfo<TaskInstance>> result = new Result<>();
public Result<PageInfo<TaskInstanceSummaryVO>> queryTaskListPaging(User loginUser,
long projectCode,
Integer workflowInstanceId,
String workflowInstanceName,
String workflowDefinitionName,
String taskName,
Long taskCode,
String executorName,
String startDate,
String endDate,
String searchVal,
TaskExecutionStatus stateType,
String host,
TaskExecuteType taskExecuteType,
Integer pageNo,
Integer pageSize) {
Result<PageInfo<TaskInstanceSummaryVO>> result = new Result<>();
// check user access for project
projectService.checkProjectAndAuthThrowException(loginUser, projectCode, TASK_INSTANCE);
int[] statusArray = null;
Expand All @@ -131,9 +133,9 @@ public Result<PageInfo<TaskInstance>> queryTaskListPaging(User loginUser,
}
Date start = checkAndParseDateParameters(startDate);
Date end = checkAndParseDateParameters(endDate);
Page<TaskInstance> page = new Page<>(pageNo, pageSize);
PageInfo<TaskInstance> pageInfo = new PageInfo<>(pageNo, pageSize);
IPage<TaskInstance> taskInstanceIPage;
Page<TaskInstanceSummaryDto> page = new Page<>(pageNo, pageSize);
PageInfo<TaskInstanceSummaryVO> pageInfo = new PageInfo<>(pageNo, pageSize);
IPage<TaskInstanceSummaryDto> taskInstanceIPage;
if (taskExecuteType == TaskExecuteType.STREAM) {
// stream task without workflow instance
taskInstanceIPage = taskInstanceDao.queryStreamTaskInstanceListPaging(
Expand Down Expand Up @@ -165,20 +167,23 @@ public Result<PageInfo<TaskInstance>> queryTaskListPaging(User loginUser,
start,
end);
}
List<TaskInstance> taskInstanceList = taskInstanceIPage.getRecords();
List<TaskInstanceSummaryDto> taskInstanceList = taskInstanceIPage.getRecords();
List<Integer> executorIds =
taskInstanceList.stream().map(TaskInstance::getExecutorId).distinct().collect(Collectors.toList());
taskInstanceList.stream().map(TaskInstanceSummaryDto::getExecutorId).distinct()
.collect(Collectors.toList());
List<User> users = usersService.queryUser(executorIds);
Map<Integer, User> userMap = users.stream().collect(Collectors.toMap(User::getId, v -> v));
for (TaskInstance taskInstance : taskInstanceList) {
for (TaskInstanceSummaryDto taskInstance : taskInstanceList) {
taskInstance.setDuration(DateUtils.format2Duration(taskInstance.getStartTime(), taskInstance.getEndTime()));
User user = userMap.get(taskInstance.getExecutorId());
if (user != null) {
taskInstance.setExecutorName(user.getUserName());
}
}
pageInfo.setTotal((int) taskInstanceIPage.getTotal());
pageInfo.setTotalList(taskInstanceList);
pageInfo.setTotalList(taskInstanceList.stream()
.map(TaskInstanceSummaryVO::fromSummaryDto)
.collect(Collectors.toList()));
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import org.apache.dolphinscheduler.dao.entity.WorkflowTaskRelationLog;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.WorkflowDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.model.TaskInstanceSummaryDto;
import org.apache.dolphinscheduler.dao.model.WorkflowInstanceSummaryDto;
import org.apache.dolphinscheduler.dao.repository.ProjectDao;
import org.apache.dolphinscheduler.dao.repository.TaskDefinitionDao;
Expand Down Expand Up @@ -707,11 +708,11 @@ public GanttDto viewGantt(User loginUser, long projectCode, Integer workflowInst

List<Task> taskList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(nodeList)) {
List<TaskInstance> taskInstances = taskInstanceDao.queryByWorkflowInstanceIdsAndTaskCodes(
List<TaskInstanceSummaryDto> taskInstances = taskInstanceDao.queryByWorkflowInstanceIdsAndTaskCodes(
Collections.singletonList(workflowInstanceId), nodeList);
for (Long node : nodeList) {
TaskInstance taskInstance = null;
for (TaskInstance instance : taskInstances) {
TaskInstanceSummaryDto taskInstance = null;
for (TaskInstanceSummaryDto instance : taskInstances) {
if (instance.getWorkflowInstanceId() == workflowInstanceId && instance.getTaskCode() == node) {
taskInstance = instance;
break;
Expand Down
Loading
Loading