Browse Source

打包指令记载

master
xueyinfei 7 hours ago
parent
commit
2671601b2e
  1. 18
      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. 53
      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

18
README_zh_CN.md

@ -26,27 +26,27 @@ DolphinScheduler 的主要特性如下:
## 快速开始
- 如果想要体验
- [standalone 启动](https://dolphinscheduler.apache.org/zh-cn/docs/3.1.5/guide/installation/standalone)
- [Docker 启动](https://dolphinscheduler.apache.org/zh-cn/docs/3.1.5/guide/start/docker)
- [standalone 启动](https://dolphinscheduler.apache.org/zh-cn/docs/3.1.5/guide/installation/standalone)
- [Docker 启动](https://dolphinscheduler.apache.org/zh-cn/docs/3.1.5/guide/start/docker)
- 想 Kubernetes 部署
- [Kubernetes 部署](https://dolphinscheduler.apache.org/zh-cn/docs/3.1.5/guide/installation/kubernetes)
- [Kubernetes 部署](https://dolphinscheduler.apache.org/zh-cn/docs/3.1.5/guide/installation/kubernetes)
## 系统部分截图
* **主页**:项目和工作流概览,包括最新的工作流实例和任务实例状态统计。
![home](images/home.png)
![home](images/home.png)
* **工作流定义**: 通过拖拉拽创建和管理工作流,轻松构建和维护复杂的工作流。
![workflow-definition](images/workflow-definition.png)
![workflow-definition](images/workflow-definition.png)
* **工作流树状图**: 抽象的树形结构可以更清晰的理解任务之间的关系
![workflow-tree](images/workflow-tree.png)
![workflow-tree](images/workflow-tree.png)
* **数据源**: 管理支持多种外部数据源,为MySQL、PostgreSQL、Hive、Trino等,并提供统一的数据访问能力。
![data-source](images/data-source.png)
![data-source](images/data-source.png)
* **监控**:实时查看master、worker和数据库的状态,包括服务器资源使用情况和负载情况,无需登录服务器即可快速进行健康检查。
![monitor](images/monitor.png)
![monitor](images/monitor.png)
## 建议和报告 bugs
@ -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 Twitter](https://twitter.com/dolphinschedule) 来获取最新消息
- 订阅 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 >
打包指令 : 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.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import static org.apache.dolphinscheduler.api.enums.Status.*;
@ -116,6 +113,19 @@ public class ProcessInstanceController extends BaseController {
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
*

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

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

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

@ -17,10 +17,6 @@
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_UPDATE;
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.utils.DateUtils;
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.dao.entity.ProcessDefinition;
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.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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.apache.commons.lang3.StringUtils;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@ -101,6 +96,14 @@ import java.util.Objects;
import java.util.function.Function;
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
*/
@ -330,6 +333,15 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
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
*
@ -343,14 +355,16 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
public Map<String, Object> queryTaskListByProcessId(User loginUser, long projectCode,
Integer processId) throws IOException {
Project project = projectMapper.queryByCode(projectCode);
//check user access for project
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
// check user access for project
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());
ProcessDefinition processDefinition =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition != null && projectCode != processDefinition.getProjectCode()) {
putMsg(result, PROCESS_INSTANCE_NOT_EXIST, processId);
return result;
@ -485,21 +499,23 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
String globalParams,
String locations, int timeout, String tenantCode) {
Project project = projectMapper.queryByCode(projectCode);
//check user access for project
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_UPDATE);
// check user access for project
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_UPDATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
//check process instance exists
// check process instance exists
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId)
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processInstanceId));
//check process instance exists in project
ProcessDefinition processDefinition0 = processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
// check process instance exists in project
ProcessDefinition processDefinition0 =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition0 != null && projectCode != processDefinition0.getProjectCode()) {
putMsg(result, PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
return result;
}
//check process instance status
// check process instance status
if (!processInstance.getState().isFinished()) {
putMsg(result, PROCESS_INSTANCE_STATE_OPERATION_ERROR,
processInstance.getName(), processInstance.getState().toString(), "update");
@ -660,7 +676,8 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processInstanceId));
// check process instance status
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 =

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

@ -41,9 +41,9 @@ spring:
basename: i18n/messages
datasource:
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
username: admin
password: 123456
url: jdbc:mysql://47.113.147.166:3306/dolphinscheduler?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: dbf
password: 1q2w3e4r
# driver-class-name: org.postgresql.Driver
# url: jdbc:postgresql://127.0.0.1:5432/dolphinscheduler
# username: root
@ -188,9 +188,12 @@ spring:
on-profile: mysql
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.0.3:3306/dolphinscheduler
username: admin
password: 123456
url: jdbc:mysql://47.113.147.166:3306/dolphinscheduler
#url: jdbc:mysql://192.168.0.3:3306/dolphinscheduler
username: dbf
#username: admin
password: 1q2w3e4r
#password: 123456
quartz:
properties:
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,
@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>
order by id asc
</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
<include refid="baseSql"/>

Loading…
Cancel
Save