0527 ljc
This commit is contained in:
parent
badf228bd6
commit
87775bc06f
@ -16,11 +16,6 @@ public class TargetManagerCreateReq {
|
||||
*/
|
||||
private String targetName;
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
@ -45,4 +40,9 @@ public class TargetManagerCreateReq {
|
||||
* 文件大小(byte)
|
||||
*/
|
||||
private Double totalSize;
|
||||
|
||||
/**
|
||||
* 组织id
|
||||
*/
|
||||
private String projectId;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class TargetManagerResp{
|
||||
/**
|
||||
* 组织id
|
||||
*/
|
||||
private Long orgId;
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
|
@ -11,7 +11,6 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
@ -38,10 +37,16 @@ public class PipelineSchedulerConfig implements SchedulingConfigurer {
|
||||
@Override
|
||||
public void configureTasks(@NotNull ScheduledTaskRegistrar taskRegistrar) {
|
||||
this.taskRegistrar = taskRegistrar;
|
||||
log.info("ScheduledTaskRegistrar 初始化完成");
|
||||
}
|
||||
|
||||
|
||||
public void addTask(String taskId, Runnable task, String cronExpression) {
|
||||
if (taskRegistrar == null) {
|
||||
log.error("【定时任务失败】taskRegistrar 尚未初始化,请检查调度器是否已启动");
|
||||
return;
|
||||
}
|
||||
|
||||
CronTask cronTask = new CronTask(task, cronExpression);
|
||||
ScheduledTask scheduledTask = taskRegistrar.scheduleCronTask(cronTask);
|
||||
taskFutures.put(taskId, scheduledTask);
|
||||
@ -133,13 +138,13 @@ public class PipelineSchedulerConfig implements SchedulingConfigurer {
|
||||
return future != null && future.isCancelled();
|
||||
}
|
||||
|
||||
@Component
|
||||
public static class PipelineSchedulerTask implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// 定时任务逻辑代码
|
||||
System.out.println("Pipeline Task: " + new Date());
|
||||
}
|
||||
}
|
||||
// @Component
|
||||
// public static class PipelineSchedulerTask implements Runnable {
|
||||
//
|
||||
// @Override
|
||||
// public void run() {
|
||||
// // 定时任务逻辑代码
|
||||
// System.out.println("Pipeline Task: " + new Date());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class PipelineSchedulingPropertiesServiceImpl extends ServiceImpl<Pipelin
|
||||
}
|
||||
|
||||
public void addTask(PipelineSchedulingProperties task) {
|
||||
if (ContextStateEnum.RUNNING.getCode().equals(Integer.parseInt(task.getStatus()))) {
|
||||
if (ContextStateEnum.RUNNING.getCode() == Integer.parseInt(task.getStatus())) {
|
||||
pipelineSchedulerConfig.addTask(task.getPipelineId(), () -> {
|
||||
},task.getCronExpression());
|
||||
}
|
||||
@ -60,12 +60,12 @@ public class PipelineSchedulingPropertiesServiceImpl extends ServiceImpl<Pipelin
|
||||
public void startTask(String taskId) {
|
||||
pipelineSchedulerConfig.startTask(taskId);
|
||||
taskRepository.update(null, new UpdateWrapper<PipelineSchedulingProperties>()
|
||||
.set("status", "RUNNING").eq("task_id", taskId));
|
||||
.set("status", String.valueOf(ContextStateEnum.RUNNING.getCode())).eq("task_id", taskId));
|
||||
}
|
||||
|
||||
public void stopTask(String taskId) {
|
||||
pipelineSchedulerConfig.stopTask(taskId);
|
||||
taskRepository.update(null, new UpdateWrapper<PipelineSchedulingProperties>()
|
||||
.set("status", "STOPPED").eq("task_id", taskId));
|
||||
.set("status", String.valueOf(ContextStateEnum.STOP.getCode())).eq("task_id", taskId));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
package cd.casic.ci.process.engine.scheduler.trigger;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
||||
/**
|
||||
* @author HopeLi
|
||||
* @version v1.0
|
||||
* @ClassName SchedulingTrigger
|
||||
* @Date: 2025/5/27 15:05
|
||||
* @Description:
|
||||
*/
|
||||
@Configuration
|
||||
public class SchedulingTrigger {
|
||||
@Scheduled(fixedRate = 5000)
|
||||
public void triggerScheduler() {
|
||||
// 用于触发调度器初始化
|
||||
}
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
package cd.casic.ci.process.engine.worker;
|
||||
|
||||
import cd.casic.ci.common.pipeline.annotation.Plugin;
|
||||
import cd.casic.ci.process.engine.constant.EngineRuntimeConstant;
|
||||
import cd.casic.ci.process.engine.context.ConstantContextHolder;
|
||||
import cd.casic.ci.process.engine.runContext.BaseRunContext;
|
||||
import cd.casic.ci.process.engine.runContext.TaskRunContext;
|
||||
import cd.casic.ci.process.process.dataObject.base.PipBaseElement;
|
||||
import cd.casic.ci.process.process.dataObject.log.PipTaskLog;
|
||||
import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline;
|
||||
import cd.casic.ci.process.process.dataObject.target.TargetVersion;
|
||||
import cd.casic.ci.process.process.dataObject.task.PipTask;
|
||||
|
@ -36,11 +36,6 @@ public class TargetManager extends PipBaseElement {
|
||||
@TableField("target_type")
|
||||
private String targetType;
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ -84,8 +79,8 @@ public class TargetManager extends PipBaseElement {
|
||||
/**
|
||||
* 组织id
|
||||
*/
|
||||
@TableField("org_id")
|
||||
private Long orgId;
|
||||
@TableField("project_id")
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
|
Loading…
x
Reference in New Issue
Block a user