丁云鹏 11 mesi fa
parent
commit
e306d40296

+ 6 - 0
recommend-feature-produce/src/main/java/com/tzld/piaoquan/recommend/feature/produce/service/DTSConfigService.java

@@ -51,4 +51,10 @@ public class DTSConfigService {
         }
         return optional.get();
     }
+
+    public List<DTSConfig> getAllDTSConfig() {
+
+        return JSONUtils.fromJson(ConfigService.getAppConfig().getProperty("dts.config.v2", ""), new TypeToken<List<DTSConfig>>() {
+        }, Collections.emptyList());
+    }
 }

+ 38 - 0
recommend-feature-produce/src/main/java/com/tzld/piaoquan/recommend/feature/produce/task/HourODPSToRedisTask.java

@@ -0,0 +1,38 @@
+package com.tzld.piaoquan.recommend.feature.produce.task;
+
+import com.tzld.piaoquan.recommend.feature.produce.model.DTSConfig;
+import com.tzld.piaoquan.recommend.feature.produce.service.DTSConfigService;
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @author dyp
+ */
+@Slf4j
+public class HourODPSToRedisTask {
+    private static String cmd = "spark-submit " +
+            " --class com.tzld.piaoquan.recommend.feature.produce.ODPSToRedis" +
+            " --master yarn " +
+            " --driver-memory 512M" +
+            " --executor-memory 512M" +
+            " --executor-cores 1" +
+            " --num-executors 8 " +
+            "recommend-feature-produce.jar" +
+            " -project loghubods" +
+            " -table alg_vid_feature_all_exp" +
+            " -dt `date +\"%Y%m%d\"`" +
+            " -hh `date+\"%H\"`" +
+            " -env test";
+
+    public static void main(String[] args) throws IOException {
+        String env = "test";
+        DTSConfigService dtsConfigService = new DTSConfigService(env);
+        List<DTSConfig> configs = dtsConfigService.getAllDTSConfig();
+
+        Runtime.getRuntime().exec(cmd);
+        System.out.println("end");
+    }
+
+}