| | |
| | | package com.iplatform.recvideo.api; |
| | | |
| | | import com.iplatform.core.BeanContextAware; |
| | | import com.iplatform.recvideo.config.VideoSimilarProperties; |
| | | import com.iplatform.recvideo.scheduler.VideoSearchScheduler; |
| | | import com.iplatform.recvideo.service.VideoExecutorServiceImpl; |
| | | import com.iplatform.recvideo.support.DefaultSimilarExecutor; |
| | | import com.walker.scheduler.ScheduleEngine; |
| | | import com.walker.scheduler.util.OptionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/debug/video") |
| | |
| | | private RestTemplate restTemplate; |
| | | private VideoSimilarProperties videoSimilarProperties; |
| | | private VideoExecutorServiceImpl videoExecutorService; |
| | | |
| | | private VideoSearchScheduler videoSearchScheduler = null; |
| | | |
| | | private DefaultSimilarExecutor similarExecutor = null; |
| | | |
| | |
| | | this.videoExecutorService = videoExecutorService; |
| | | } |
| | | |
| | | @RequestMapping("/start_scheduler_1") |
| | | public String testStartVideoSearchScheduler(){ |
| | | if(this.videoSearchScheduler != null){ |
| | | this.videoSearchScheduler.stop(); |
| | | this.videoSearchScheduler = null; |
| | | } |
| | | |
| | | List<Integer[]> timeRanges = new ArrayList<Integer[]>(1); |
| | | timeRanges.add(new Integer[]{10,11}); |
| | | timeRanges.add(new Integer[]{12,12}); |
| | | |
| | | this.videoSearchScheduler = new VideoSearchScheduler(100, "视频相似度分析调度任务"); |
| | | this.videoSearchScheduler.setOption(OptionUtils.combineEveryDayHourRange(timeRanges)); |
| | | this.videoSearchScheduler.setScheduleEngine(BeanContextAware.getBeanByType(ScheduleEngine.class)); |
| | | this.videoSearchScheduler.setMaxFailedTimes(10); |
| | | this.videoSearchScheduler.start(); |
| | | return this.videoSearchScheduler.getName() + " 启动"; |
| | | } |
| | | |
| | | /** |
| | | * 该测试用于模拟调度任务,每次调用一次执行器方法,批量处理一张图片数据。<p></p> |
| | | * 最终完成一批多个视频的相似度检索并写入数据库中。 |