From 2b1f542577dd8dfc54d3433dff3615796ceab0af Mon Sep 17 00:00:00 2001 From: shikeying <shikeying@163.com> Date: 星期二, 11 十月 2022 17:17:50 +0800 Subject: [PATCH] 视频下载,解析分析调度跑通 --- recommend-video/src/main/java/com/iplatform/recvideo/SimilarExecutor.java | 36 +++++++++++++++++++++++++++--------- 1 files changed, 27 insertions(+), 9 deletions(-) diff --git a/recommend-video/src/main/java/com/iplatform/recvideo/SimilarExecutor.java b/recommend-video/src/main/java/com/iplatform/recvideo/SimilarExecutor.java index 1318e53..61d1450 100644 --- a/recommend-video/src/main/java/com/iplatform/recvideo/SimilarExecutor.java +++ b/recommend-video/src/main/java/com/iplatform/recvideo/SimilarExecutor.java @@ -4,11 +4,11 @@ import com.iplatform.recvideo.util.PythonInvokeUtils; import com.iplatform.recvideo.util.TestUtils; import com.iplatform.recvideo.util.VideoFileUtils; +import com.walker.infrastructure.utils.FileUtils; import com.walker.infrastructure.utils.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; import java.util.ArrayList; import java.util.List; @@ -85,7 +85,14 @@ public int execute() throws Exception{ if(!this.pythonLoadVideoDone){ logger.debug("褰撳墠 pythonLoadVideoDone = false, 闇�瑕佹煡璇㈡暟鎹簱鏄惁宸插姞杞借棰�"); - this.pythonLoadVideoDone = this.pythonLoadVideoDone(this.batchId, VideoFileUtils.combineBatchPath(videoDataFolder, batchId)); + String batchPath = VideoFileUtils.combineBatchPath(videoDataFolder, batchId); + if(!FileUtils.isExist(batchPath)){ + // 鏂囦欢澶逛笉瀛樺湪锛屾垨鐣ヨ鐘舵�佽褰曪紝2022-10-11 + this.ignoreTaskStatus(batchId); + logger.warn("鏂囦欢澶逛笉瀛樺湪锛屽拷鐣ヨ鎵规璁板綍锛岃嚜鍔ㄦ洿鏂颁负'宸插畬鎴�', batchPath = " + batchPath); + return 1; + } + this.pythonLoadVideoDone = this.pythonLoadVideoDone(this.batchId, batchPath); } // 1: 濡傛灉瑙嗛杩樻湭鍔犺浇锛屽垯鍏堝姞杞借棰� @@ -115,9 +122,13 @@ } } if(StringUtils.isEmptyList(this.videoFolderInfoList)){ - logger.warn("瑙嗛鍒嗘瀽鏂囦欢澶瑰唴瀹逛负绌猴紝鏃犳硶缁х画鏌ヨ鐩镐技搴︾粨鏋�! videoFolderInfoList = null"); - return -1; + logger.warn("瑙嗛鍒嗘瀽鏂囦欢澶瑰唴瀹逛负绌猴紝鏃犳硶缁х画鏌ヨ鐩镐技搴︾粨鏋�!蹇界暐璇ユ壒娆°�� videoFolderInfoList = null"); +// return -1; + // 鏂囦欢澶逛笉娌℃湁浠讳綍瑙嗛鏂囦欢锛屾垨鐣ヨ鐘舵�佽褰曪紝2022-10-11 + this.ignoreTaskStatus(batchId); + return 1; } + for(VideoFolderInfo v : this.videoFolderInfoList){ this.videoIdList.add(v.getVideoId()); } @@ -139,14 +150,14 @@ } try { - this.processOneSearchAndWrite(); + this.processOneSearchAndWrite(this.batchId); return 0; } catch (Exception e) { throw new Exception("processOneSearchAndWrite(): " + e.getMessage(), e); } } - private void processOneSearchAndWrite() throws Exception{ + private void processOneSearchAndWrite(String batchId) throws Exception{ if(this.currentVideoFolderIndex >= this.videoFolderInfoList.size()){ throw new IllegalArgumentException("currentVideoFolderIndex 瓒婄晫: " + this.currentVideoFolderIndex); } @@ -170,7 +181,7 @@ // 姣忎釜瑙嗛鐨勬渶鍚庝竴寮犲浘鐗� if((this.currentImageIndex + 1) >= currentVideoFolderInfo.getImageInfoSize()){ try { - this.writeRcVideoT2(currentVideoFolderInfo); + this.writeRcVideoT2(currentVideoFolderInfo, batchId); } catch (Exception ex){ throw new Exception("writeRcVideoT2()鎵ц閿欒:" + ex.getMessage(), ex); } @@ -239,12 +250,19 @@ * 鍒嗘瀽琛�'rc_video_t1'锛屽苟鎶婄粰瀹氳棰戠浉浼艰褰曞啓鍏ョ浜屼釜涓存椂琛�'rc_video_t2' * @param videoFolderInfo */ - protected abstract void writeRcVideoT2(VideoFolderInfo videoFolderInfo); + protected abstract void writeRcVideoT2(VideoFolderInfo videoFolderInfo, String batchId); /** * 鍒嗘瀽缁欏畾鎵规鎵�鏈夎棰戠敤鎴锋帹鑽愮殑瑙嗛淇℃伅锛屽苟鍐欏叆琛�:'rc_video_user' * @param batchId - * @param recVideoIdList 鎺ㄨ崘瑙嗛id闆嗗悎 + * @param recVideoIdList 鏈壒娆″鐞嗗師濮嬭棰慽d闆嗗悎 */ protected abstract void writeRcVideoUser(String batchId, List<String> recVideoIdList); + + /** + * 蹇界暐璇ョ姸鎬佹壒娆★紝鐢变簬鏂囦欢澶逛笉瀛樺湪绛夊師鍥狅紝涓嶅甫澶勭悊锛屼笉瑕佸湪杩欓噷鎵撲即銆� + * @param batchId + * @date 2022-10-11 + */ + protected abstract void ignoreTaskStatus(String batchId); } -- Gitblit v1.9.1