Browse Source

打包指令记载

master
xueyinfei 8 hours ago
parent
commit
2671601b2e
  1. 2
      README_zh_CN.md
  2. 18
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java
  3. 10
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
  4. 43
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
  5. 15
      dolphinscheduler-api/src/main/resources/application.yaml
  6. 2
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.java
  7. 17
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml

2
README_zh_CN.md

@ -61,6 +61,7 @@ DolphinScheduler 的主要特性如下:
欢迎通过以方式加入社区: 欢迎通过以方式加入社区:
- 根目录打包指令 : mvn clean install -pl dolphinscheduler-api -am -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dmaven.javadoc.skip=true -Dspotless.check.skip=true
- 加入 [DolphinScheduler Slack](https://s.apache.org/dolphinscheduler-slack) - 加入 [DolphinScheduler Slack](https://s.apache.org/dolphinscheduler-slack)
- 关注 [DolphinScheduler Twitter](https://twitter.com/dolphinschedule) 来获取最新消息 - 关注 [DolphinScheduler Twitter](https://twitter.com/dolphinschedule) 来获取最新消息
- 订阅 DolphinScheduler 邮件列表, 用户订阅 users@dolphinscheduler.apache.org 开发者请订阅 dev@dolphinscheduler.apache.org - 订阅 DolphinScheduler 邮件列表, 用户订阅 users@dolphinscheduler.apache.org 开发者请订阅 dev@dolphinscheduler.apache.org
@ -75,4 +76,3 @@ DolphinScheduler enriches the <a href="https://landscape.cncf.io/?landscape=obse
</p > </p >
打包指令 : mvn clean package --% -Dmaven.test.skip=true -Prelease

18
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java

@ -40,10 +40,7 @@ import org.apache.commons.lang3.StringUtils;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.apache.dolphinscheduler.api.enums.Status.*; import static org.apache.dolphinscheduler.api.enums.Status.*;
@ -116,6 +113,19 @@ public class ProcessInstanceController extends BaseController {
return result; return result;
} }
@GetMapping("/latest-process/list")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_INSTANCE_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryLatestProcessInstanceList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "processDefineCode") String processDefineCode) {
Result result = processInstanceService.queryLatestProcessInstanceList(Arrays.stream(processDefineCode.split(","))
.mapToLong(Long::parseLong)
.toArray());
return result;
}
/** /**
* query task list by process instance id * query task list by process instance id
* *

10
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java

@ -18,16 +18,16 @@
package org.apache.dolphinscheduler.api.service; package org.apache.dolphinscheduler.api.service;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus; import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.plugin.task.api.enums.DependResult; import org.apache.dolphinscheduler.plugin.task.api.enums.DependResult;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/** /**
* process instance service * process instance service
*/ */
@ -201,4 +201,6 @@ public interface ProcessInstanceService {
*/ */
List<ProcessInstance> queryByProcessDefineCode(Long processDefinitionCode, List<ProcessInstance> queryByProcessDefineCode(Long processDefinitionCode,
int size); int size);
Result queryLatestProcessInstanceList(long[] processDefineCode);
} }

43
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java

@ -17,10 +17,6 @@
package org.apache.dolphinscheduler.api.service.impl; package org.apache.dolphinscheduler.api.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.INSTANCE_DELETE; 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.INSTANCE_UPDATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_INSTANCE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_INSTANCE;
@ -53,7 +49,6 @@ import org.apache.dolphinscheduler.common.graph.DAG;
import org.apache.dolphinscheduler.common.model.TaskNodeRelation; import org.apache.dolphinscheduler.common.model.TaskNodeRelation;
import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.plugin.task.api.utils.ParameterUtils;
import org.apache.dolphinscheduler.common.utils.placeholder.BusinessTimeUtils; import org.apache.dolphinscheduler.common.utils.placeholder.BusinessTimeUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
@ -78,13 +73,13 @@ import org.apache.dolphinscheduler.dao.repository.ProcessInstanceDao;
import org.apache.dolphinscheduler.plugin.task.api.enums.DependResult; 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.model.Property;
import org.apache.dolphinscheduler.plugin.task.api.parameters.ParametersNode; 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.expand.CuringParamsService;
import org.apache.dolphinscheduler.service.model.TaskNode; import org.apache.dolphinscheduler.service.model.TaskNode;
import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.task.TaskPluginManager; import org.apache.dolphinscheduler.service.task.TaskPluginManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.apache.commons.lang3.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
@ -101,6 +96,14 @@ import java.util.Objects;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/** /**
* process instance service impl * process instance service impl
*/ */
@ -330,6 +333,15 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
return result; return result;
} }
@Override
public Result queryLatestProcessInstanceList(long[] processDefineCodes) {
List<ProcessInstance> processInstances =
processInstanceMapper.queryLatestProcessInstanceList(processDefineCodes);
Result result = new Result();
result.setData(processInstances);
return result;
}
/** /**
* query task list by process instance id * query task list by process instance id
* *
@ -344,13 +356,15 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
Integer processId) throws IOException { Integer processId) throws IOException {
Project project = projectMapper.queryByCode(projectCode); Project project = projectMapper.queryByCode(projectCode);
// check user access for project // check user access for project
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE); Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) { if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result; return result;
} }
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processId) ProcessInstance processInstance = processService.findProcessInstanceDetailById(processId)
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processId)); .orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processId));
ProcessDefinition processDefinition = processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode()); ProcessDefinition processDefinition =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition != null && projectCode != processDefinition.getProjectCode()) { if (processDefinition != null && projectCode != processDefinition.getProjectCode()) {
putMsg(result, PROCESS_INSTANCE_NOT_EXIST, processId); putMsg(result, PROCESS_INSTANCE_NOT_EXIST, processId);
return result; return result;
@ -486,7 +500,8 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
String locations, int timeout, String tenantCode) { String locations, int timeout, String tenantCode) {
Project project = projectMapper.queryByCode(projectCode); Project project = projectMapper.queryByCode(projectCode);
// check user access for project // check user access for project
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_UPDATE); Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_UPDATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) { if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result; return result;
} }
@ -494,7 +509,8 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId) ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId)
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processInstanceId)); .orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processInstanceId));
// check process instance exists in project // check process instance exists in project
ProcessDefinition processDefinition0 = processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode()); ProcessDefinition processDefinition0 =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition0 != null && projectCode != processDefinition0.getProjectCode()) { if (processDefinition0 != null && projectCode != processDefinition0.getProjectCode()) {
putMsg(result, PROCESS_INSTANCE_NOT_EXIST, processInstanceId); putMsg(result, PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
return result; return result;
@ -660,7 +676,8 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processInstanceId)); .orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processInstanceId));
// check process instance status // check process instance status
if (!processInstance.getState().isFinished()) { if (!processInstance.getState().isFinished()) {
throw new ServiceException(PROCESS_INSTANCE_STATE_OPERATION_ERROR, processInstance.getName(), processInstance.getState(), "delete"); throw new ServiceException(PROCESS_INSTANCE_STATE_OPERATION_ERROR, processInstance.getName(),
processInstance.getState(), "delete");
} }
ProcessDefinition processDefinition = ProcessDefinition processDefinition =

15
dolphinscheduler-api/src/main/resources/application.yaml

@ -41,9 +41,9 @@ spring:
basename: i18n/messages basename: i18n/messages
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.0.3:3306/dolphinscheduler?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true url: jdbc:mysql://47.113.147.166:3306/dolphinscheduler?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: admin username: dbf
password: 123456 password: 1q2w3e4r
# driver-class-name: org.postgresql.Driver # driver-class-name: org.postgresql.Driver
# url: jdbc:postgresql://127.0.0.1:5432/dolphinscheduler # url: jdbc:postgresql://127.0.0.1:5432/dolphinscheduler
# username: root # username: root
@ -188,9 +188,12 @@ spring:
on-profile: mysql on-profile: mysql
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.0.3:3306/dolphinscheduler url: jdbc:mysql://47.113.147.166:3306/dolphinscheduler
username: admin #url: jdbc:mysql://192.168.0.3:3306/dolphinscheduler
password: 123456 username: dbf
#username: admin
password: 1q2w3e4r
#password: 123456
quartz: quartz:
properties: properties:
org.quartz.jobStore.driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate org.quartz.jobStore.driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate

2
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.java

@ -260,4 +260,6 @@ public interface ProcessInstanceMapper extends BaseMapper<ProcessInstance> {
ProcessInstance loadNextProcess4Serial(@Param("processDefinitionCode") Long processDefinitionCode, ProcessInstance loadNextProcess4Serial(@Param("processDefinitionCode") Long processDefinitionCode,
@Param("state") int state, @Param("id") int id); @Param("state") int state, @Param("id") int id);
List<ProcessInstance> queryLatestProcessInstanceList(@Param("processDefineCodes") long[] processDefineCodes);
} }

17
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml

@ -247,6 +247,23 @@
</if> </if>
order by id asc order by id asc
</select> </select>
<select id="queryLatestProcessInstanceList" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
select
pi.*
from t_ds_process_instance pi
inner join (
select process_definition_code, max(end_time) as max_end_time
from t_ds_process_instance
where process_definition_code in
<foreach collection="processDefineCodes" item="code" open="(" close=")" separator=",">
#{code}
</foreach>
group by process_definition_code
) t on pi.process_definition_code = t.process_definition_code
and pi.end_time = t.max_end_time
</select>
<select id="queryByProcessDefineCodeAndProcessDefinitionVersionAndStatusAndNextId" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> <select id="queryByProcessDefineCodeAndProcessDefinitionVersionAndStatusAndNextId" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
select select
<include refid="baseSql"/> <include refid="baseSql"/>

Loading…
Cancel
Save