parent
091c01b2e4
commit
673f91ec43
@ -11,7 +11,7 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class DispatchJobRequest {
|
public class DispatchJobRequest {
|
||||||
|
|
||||||
@NotNull(message = "namespaceId 不能为空")
|
@NotBlank(message = "namespaceId 不能为空")
|
||||||
private String namespaceId;
|
private String namespaceId;
|
||||||
|
|
||||||
@NotNull(message = "jobId 不能为空")
|
@NotNull(message = "jobId 不能为空")
|
||||||
@ -29,7 +29,7 @@ public class DispatchJobRequest {
|
|||||||
@NotBlank(message = "group 不能为空")
|
@NotBlank(message = "group 不能为空")
|
||||||
private String groupName;
|
private String groupName;
|
||||||
|
|
||||||
@NotBlank(message = "parallelNum 不能为空")
|
@NotNull(message = "parallelNum 不能为空")
|
||||||
private Integer parallelNum;
|
private Integer parallelNum;
|
||||||
|
|
||||||
@NotNull(message = "executorType 不能为空")
|
@NotNull(message = "executorType 不能为空")
|
||||||
@ -38,7 +38,7 @@ public class DispatchJobRequest {
|
|||||||
@NotBlank(message = "executorInfo 不能为空")
|
@NotBlank(message = "executorInfo 不能为空")
|
||||||
private String executorInfo;
|
private String executorInfo;
|
||||||
|
|
||||||
@NotBlank(message = "executorTimeout 不能为空")
|
@NotNull(message = "executorTimeout 不能为空")
|
||||||
private Integer executorTimeout;
|
private Integer executorTimeout;
|
||||||
|
|
||||||
private String argsStr;
|
private String argsStr;
|
||||||
|
@ -122,4 +122,10 @@ public interface SystemConstants {
|
|||||||
* 客户端返回的非json对象,单值比如 "aa", 123等
|
* 客户端返回的非json对象,单值比如 "aa", 123等
|
||||||
*/
|
*/
|
||||||
String SINGLE_PARAM = "SINGLE_PARAM";
|
String SINGLE_PARAM = "SINGLE_PARAM";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作流触发类型
|
||||||
|
* 仅表示定时任务类型为工作流
|
||||||
|
*/
|
||||||
|
Integer WORKFLOW_TRIGGER_TYPE = 99;
|
||||||
}
|
}
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
package com.aizuda.easy.retry.server.common.enums;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 1 CRON表达式 2 固定时间 3 工作流
|
|
||||||
* @author xiaowoniu
|
|
||||||
* @date 2024-01-03 22:10:01
|
|
||||||
* @since 2.6.0
|
|
||||||
*/
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Getter
|
|
||||||
public enum TriggerTypeEnum {
|
|
||||||
CRON(1, "CRON表达式"),
|
|
||||||
FIXED_TIME(2, "固定时间"),
|
|
||||||
WORKFLOW(3, "工作流");
|
|
||||||
|
|
||||||
private final Integer type;
|
|
||||||
private final String desc;
|
|
||||||
|
|
||||||
public static TriggerTypeEnum get(Integer type) {
|
|
||||||
for (TriggerTypeEnum triggerTypeEnum : TriggerTypeEnum.values()) {
|
|
||||||
if (triggerTypeEnum.type.equals(type)) {
|
|
||||||
return triggerTypeEnum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,7 +12,6 @@ import com.aizuda.easy.retry.server.common.config.SystemProperties;
|
|||||||
import com.aizuda.easy.retry.server.common.dto.PartitionTask;
|
import com.aizuda.easy.retry.server.common.dto.PartitionTask;
|
||||||
import com.aizuda.easy.retry.server.common.dto.ScanTask;
|
import com.aizuda.easy.retry.server.common.dto.ScanTask;
|
||||||
import com.aizuda.easy.retry.server.common.enums.JobTaskExecutorSceneEnum;
|
import com.aizuda.easy.retry.server.common.enums.JobTaskExecutorSceneEnum;
|
||||||
import com.aizuda.easy.retry.server.common.enums.TriggerTypeEnum;
|
|
||||||
import com.aizuda.easy.retry.server.common.strategy.WaitStrategies;
|
import com.aizuda.easy.retry.server.common.strategy.WaitStrategies;
|
||||||
import com.aizuda.easy.retry.server.common.util.DateUtils;
|
import com.aizuda.easy.retry.server.common.util.DateUtils;
|
||||||
import com.aizuda.easy.retry.server.common.util.PartitionTaskUtils;
|
import com.aizuda.easy.retry.server.common.util.PartitionTaskUtils;
|
||||||
@ -168,7 +167,7 @@ public class ScanJobTaskActor extends AbstractActor {
|
|||||||
Job::getId, Job::getNamespaceId)
|
Job::getId, Job::getNamespaceId)
|
||||||
.eq(Job::getJobStatus, StatusEnum.YES.getStatus())
|
.eq(Job::getJobStatus, StatusEnum.YES.getStatus())
|
||||||
.eq(Job::getDeleted, StatusEnum.NO.getStatus())
|
.eq(Job::getDeleted, StatusEnum.NO.getStatus())
|
||||||
.ne(Job::getTriggerType, TriggerTypeEnum.WORKFLOW.getType())
|
.ne(Job::getTriggerType, SystemConstants.WORKFLOW_TRIGGER_TYPE)
|
||||||
.in(Job::getBucketIndex, scanTask.getBuckets())
|
.in(Job::getBucketIndex, scanTask.getBuckets())
|
||||||
.le(Job::getNextTriggerAt,
|
.le(Job::getNextTriggerAt,
|
||||||
DateUtils.toNowMilli() + DateUtils.toEpochMilli(SystemConstants.SCHEDULE_PERIOD))
|
DateUtils.toNowMilli() + DateUtils.toEpochMilli(SystemConstants.SCHEDULE_PERIOD))
|
||||||
|
@ -3,11 +3,11 @@ package com.aizuda.easy.retry.server.web.service.impl;
|
|||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.util.HashUtil;
|
import cn.hutool.core.util.HashUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.aizuda.easy.retry.common.core.constant.SystemConstants;
|
||||||
import com.aizuda.easy.retry.common.core.enums.StatusEnum;
|
import com.aizuda.easy.retry.common.core.enums.StatusEnum;
|
||||||
import com.aizuda.easy.retry.server.common.WaitStrategy;
|
import com.aizuda.easy.retry.server.common.WaitStrategy;
|
||||||
import com.aizuda.easy.retry.server.common.config.SystemProperties;
|
import com.aizuda.easy.retry.server.common.config.SystemProperties;
|
||||||
import com.aizuda.easy.retry.server.common.enums.JobTaskExecutorSceneEnum;
|
import com.aizuda.easy.retry.server.common.enums.JobTaskExecutorSceneEnum;
|
||||||
import com.aizuda.easy.retry.server.common.enums.TriggerTypeEnum;
|
|
||||||
import com.aizuda.easy.retry.server.common.exception.EasyRetryServerException;
|
import com.aizuda.easy.retry.server.common.exception.EasyRetryServerException;
|
||||||
import com.aizuda.easy.retry.server.common.strategy.WaitStrategies;
|
import com.aizuda.easy.retry.server.common.strategy.WaitStrategies;
|
||||||
import com.aizuda.easy.retry.server.common.util.CronUtils;
|
import com.aizuda.easy.retry.server.common.util.CronUtils;
|
||||||
@ -151,7 +151,7 @@ public class JobServiceImpl implements JobService {
|
|||||||
updateJob.setNamespaceId(job.getNamespaceId());
|
updateJob.setNamespaceId(job.getNamespaceId());
|
||||||
|
|
||||||
// 工作流任务
|
// 工作流任务
|
||||||
if (Objects.equals(jobRequestVO.getTriggerType(), TriggerTypeEnum.WORKFLOW.getType())) {
|
if (Objects.equals(jobRequestVO.getTriggerType(), SystemConstants.WORKFLOW_TRIGGER_TYPE)) {
|
||||||
job.setNextTriggerAt(0L);
|
job.setNextTriggerAt(0L);
|
||||||
// 非常驻任务 > 非常驻任务
|
// 非常驻任务 > 非常驻任务
|
||||||
} else if (Objects.equals(job.getResident(), StatusEnum.NO.getStatus()) && Objects.equals(
|
} else if (Objects.equals(job.getResident(), StatusEnum.NO.getStatus()) && Objects.equals(
|
||||||
@ -174,7 +174,7 @@ public class JobServiceImpl implements JobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Long calculateNextTriggerAt(final JobRequestVO jobRequestVO, Long time) {
|
private static Long calculateNextTriggerAt(final JobRequestVO jobRequestVO, Long time) {
|
||||||
if (Objects.equals(jobRequestVO.getTriggerType(), TriggerTypeEnum.WORKFLOW.getType())) {
|
if (Objects.equals(jobRequestVO.getTriggerType(), SystemConstants.WORKFLOW_TRIGGER_TYPE)) {
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ public class JobServiceImpl implements JobService {
|
|||||||
public Job updateJobResident(JobRequestVO jobRequestVO) {
|
public Job updateJobResident(JobRequestVO jobRequestVO) {
|
||||||
Job job = JobConverter.INSTANCE.toJob(jobRequestVO);
|
Job job = JobConverter.INSTANCE.toJob(jobRequestVO);
|
||||||
job.setResident(StatusEnum.NO.getStatus());
|
job.setResident(StatusEnum.NO.getStatus());
|
||||||
if (Objects.equals(jobRequestVO.getTriggerType(), TriggerTypeEnum.WORKFLOW.getType())) {
|
if (Objects.equals(jobRequestVO.getTriggerType(), SystemConstants.WORKFLOW_TRIGGER_TYPE)) {
|
||||||
return job;
|
return job;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,15 +24,15 @@ const enums = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
triggerType: {
|
triggerType: {
|
||||||
'1': {
|
|
||||||
'name': 'CRON表达式',
|
|
||||||
'color': '#d06892'
|
|
||||||
},
|
|
||||||
'2': {
|
'2': {
|
||||||
'name': '固定时间',
|
'name': '固定时间',
|
||||||
'color': '#f5a22d'
|
'color': '#f5a22d'
|
||||||
},
|
},
|
||||||
'3': {
|
'3': {
|
||||||
|
'name': 'CRON表达式',
|
||||||
|
'color': '#d06892'
|
||||||
|
},
|
||||||
|
'99': {
|
||||||
'name': '工作流',
|
'name': '工作流',
|
||||||
'color': '#76f52d'
|
'color': '#76f52d'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user