Commit fe76fb6b by huangfusuper

Merge remote-tracking branch 'origin/developer' into developer

parents 4fa01369 ff7c5543
......@@ -661,7 +661,17 @@ public class ApiFlowServiceImpl implements ApiFlowService {
}
}
List<RunRecording> runRecordList = runRecordingMapper.findByStartAndEndTime(startDate.getTime(), endDate.getTime(), flowIds);
String scheduleStatus = jsonObject.getString("scheduleStatus");
List<String> scheduleStatusList = new ArrayList<>();
if(StringUtils.isNotEmpty(scheduleStatus)){
scheduleStatusList = Arrays.asList(scheduleStatus.split(","));
}
String executeStatus = jsonObject.getString("executeStatus");
List<String> executeStatusList = new ArrayList<>();
if(StringUtils.isNotEmpty(executeStatus)){
executeStatusList = Arrays.asList(executeStatus.split(","));
}
List<RunRecording> runRecordList = runRecordingMapper.findByStartAndEndTime(startDate.getTime(), endDate.getTime(), flowIds, scheduleStatusList, executeStatusList);
return runRecordList;
}
......
......@@ -16,7 +16,7 @@ spring:
redis:
database: 0
host: 10.0.120.218
host: 10.0.120.208
port: 6379
password:
......
package com.byit.enums;
/**
* @Description
* @Author guo_m
* @Date 2020-03-31
*/
public enum ExecuteStatusEnum {
UN_START(1, "未运行"),
STARTING(2, "运行中"),
FINISH(3, "暂停"),
STOP(4, "完成"),
;
private Integer code;
private String msg;
private ExecuteStatusEnum(Integer code, String msg){
this.code = code;
this.msg = msg;
}
public Integer getCode(){
return this.code;
}
public String getMsg(){
return this.msg;
}
}
package com.byit.enums;
/**
* @Description 调度状态
* @Author guo_m
* @Date 2020-03-31
*/
public enum ScheduleStatusEnum {
SUCCESS(1, "成功"),
FAIL(2, "失败"),
REPAIR_SUCCESS(3, "补批成功"),
REPAIR_FAIL(4, "补批失败"),
KILL(5, "杀死")
;
private Integer code;
private String msg;
private ScheduleStatusEnum(Integer code, String msg){
this.code = code;
this.msg = msg;
}
public Integer getCode(){
return this.code;
}
public String getMsg(){
return this.msg;
}
}
......@@ -137,7 +137,11 @@ public interface RunRecordingMapper {
*/
List<RunRecording> findUnFinishByRunId(String runId);
List<RunRecording> findByStartAndEndTime(@Param("startDate")long startDate, @Param("endDate")long endDate, @Param("flowIds")List<Integer> flowIds);
List<RunRecording> findByStartAndEndTime(@Param("startDate")long startDate,
@Param("endDate")long endDate,
@Param("flowIds")List<Integer> flowIds,
@Param("scheduleStatusList")List<String> scheduleStatusList,
@Param("executeStatusList")List<String> executeStatusList);
/**
* 获取运行实例
......
......@@ -76,20 +76,21 @@
<select id="findByRunIdAndFlowAndNode" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from job_task_run_log
where node_id = #{nodeId} and flow_name = #{flowName}
where run_id = #{runId} and flow_name = #{flowName}
and node_name = #{nodeName}
</select>
<select id="findByRunIdAndFlowName" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from job_task_run_log
where node_id = #{nodeId} and flow_name = #{flowName}
where run_id = #{runId} and flow_name = #{flowName}
</select>
<select id="findByRunId" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from job_task_run_log
where run_id = #{runId}
order by trigger_time desc
</select>
<select id="findJobTaskRunLogWithBLOBsByFlowIdAndRunId" resultMap="ResultMapWithBLOBs">
......
......@@ -113,10 +113,25 @@
<if test="flowIds != null">
and flow_id in (
<foreach collection="flowIds" item="flowId" separator=",">
flowId
#{flowId}
</foreach>
)
</if>
<if test="scheduleStatusList != null">
and flow_status in (
<foreach collection="scheduleStatusList" item="scheduleStatus" separator=",">
${scheduleStatus}
</foreach>
)
</if>
<if test="executeStatusList != null">
and flow_run_result in (
<foreach collection="executeStatusList" item="executeStatus" separator=",">
${executeStatus}
</foreach>
)
</if>
order by start_time desc
</select>
......
......@@ -87,4 +87,17 @@ public class ResponseResult<T> implements Serializable {
tResponseResult.setCode(code);
return tResponseResult;
}
/**
* 判断是否成功
* @return
*/
public boolean isSuccess(){
//成功
if ("0000000".equals(this.code)){
return true;
}
//失败
return false;
}
}
\ No newline at end of file
......@@ -82,6 +82,21 @@ public class JobUtils {
*/
private static final String REQUEST_FLOW_MAKESUCCESS = "/api/flow/madeSuccess";
/**
* 获取运行实例
*/
public static final String REQUEST_LOADSCHEDULE = "/api/flow/loadScheduleResult";
/**
* 获取运行实例日志
*/
public static final String REQUEST_LOADSCHEDULELOG = "/api/flow/loadScheduleLog";
/**
* 补批工作流
*/
public static final String REQUEST_REPAIRFLOW = "/api/flow/repairFlow";
private static final String REQUEST_REAL_EXECT = "/api/node/runNode";
private static final String REQUEST_RUN_HISTORY = "/api/node/runHistory";
......@@ -290,6 +305,65 @@ public class JobUtils {
}
/**
* 获取运行实例接口
* @param startTime 开始时间 yyyyMMdd 格式
* @param endTime 结束时间 yyyyMMdd 格式
* @param workspaceName 工作空间名称
* @param flowName 工作流名称
* @param scheduleStatus 调度状态 1 未开始 2运行中 3暂停 4完成 多个以“,”隔开
* @param executeStatus 执行结果 1 成功 2 失败 3 补批成功 4 补批失败 5.kill 多个以“,”隔开
* @return
*/
public static ResponseResult loadScheduleResult(String startTime, String endTime, String workspaceName, String flowName, String scheduleStatus, String executeStatus){
Map<String, Object> param = new HashMap<>();
param.put("startTime", startTime);
param.put("endTime", endTime);
param.put("workspaceName", workspaceName);
param.put("flowName", flowName);
param.put("scheduleStatus", scheduleStatus);
param.put("executeStatus", executeStatus);
String response = createHttpRequest(REQUEST_LOADSCHEDULE, "param=" + JSON.toJSONString(param));
log.info("--------------------获取运行实例接口调用成功,结果为:{}------------------------",response);
return JSON.parseObject(response, ResponseResult.class);
}
/**
* 获取工作流运行实例的节点日志
* @param runId
* @param flowName
* @return
*/
public static ResponseResult loadScheduleLog(String runId, String flowName){
Map<String, Object> param = new HashMap<>();
param.put("runId", runId);
param.put("flowName", flowName);
String response = createHttpRequest(REQUEST_LOADSCHEDULELOG, "param=" + JSON.toJSONString(param));
log.info("--------------------获取工作流运行实例的节点日志接口调用成功,结果为:{}------------------------",response);
return JSON.parseObject(response, ResponseResult.class);
}
/**
* 补批工作流
* @param workspaceName 工作空间名称
* @param flowName 工作流名称
* @param nodeNames 节点名称 多个节点以","隔开
* @param repairTimes 补批日期 多个日期以","隔开
* @return
*/
public static ResponseResult repairFlow(String workspaceName, String flowName, String nodeNames, String repairTimes){
Map<String, Object> param = new HashMap<>();
param.put("workspaceName", workspaceName);
param.put("flowName", flowName);
param.put("nodeNames", nodeNames);
param.put("repairTimes", repairTimes);
String response = createHttpRequest(REQUEST_REPAIRFLOW, "param=" + JSON.toJSONString(param));
log.info("--------------------补批工作流接口调用成功,结果为:{}------------------------",response);
return JSON.parseObject(response, ResponseResult.class);
}
/**
* 创建工作空间
* @param workspaceName
* @return
......@@ -359,4 +433,16 @@ public class JobUtils {
return path;
}
public static void main(String[] args) {
RunNode runNode = new RunNode();
runNode.setScriptUrl("ddmp/M00/00/00/CgB4Al5wa36AaUJ7AAAAiYy1k-k9801.py");
runNode.setJobType("PYTHON");
runNode.setNodeId("2");
runNode.setNodeName("lijkki");
runNode.setRunCmd("python ${biz_file}");
JobUtils.setRequestUrl("http://127.0.0.1:8998/myth-job-admin");
JobUtils.setTOKEN("test");
JobUtils.realExectNode(runNode);
}
}
......@@ -27,7 +27,8 @@ public class IndexController {
@RequestMapping("/demo")
@ResponseBody
public UserDTO say(String name){
return demoService.hello(name);
System.out.println(name);
return null;
}
@RequestMapping("/demo1")
@ResponseBody
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment