Ver código fonte

add module task

丁云鹏 1 ano atrás
pai
commit
6473c80676

+ 1 - 0
pom.xml

@@ -17,6 +17,7 @@
     <modules>
         <module>recommend-server-service</module>
         <module>recommend-server-client</module>
+        <module>recommend-server-task</module>
     </modules>
 
     <dependencies>

+ 13 - 14
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/score/VlogShareLRScorer.java

@@ -1,9 +1,7 @@
 package com.tzld.piaoquan.recommend.server.service.score;
 
 
-
 import com.tzld.piaoquan.recommend.server.common.base.*;
-import com.tzld.piaoquan.recommend.server.gen.recommend.CtrSamples;
 import com.tzld.piaoquan.recommend.server.gen.recommend.LRSamples;
 import com.tzld.piaoquan.recommend.server.service.rank.RankParam;
 import com.tzld.piaoquan.recommend.server.service.score.feature.FeatureUsage;
@@ -19,11 +17,11 @@ import java.util.List;
 import java.util.concurrent.*;
 
 
-public class VlogShareLRScorer extends BaseLRModelScorer{
+public class VlogShareLRScorer extends BaseLRModelScorer {
 
     private final static int CORE_POOL_SIZE = 64;
 
-    private static final int LOCAL_TIME_OUT= 150;
+    private static final int LOCAL_TIME_OUT = 150;
     private final static Logger LOGGER = LoggerFactory.getLogger(VlogShareLRScorer.class);
     private static final ExecutorService executorService = Executors.newFixedThreadPool(128);
     private static final FeatureUsage featureUsage = new FeatureUsage();
@@ -39,8 +37,8 @@ public class VlogShareLRScorer extends BaseLRModelScorer{
 
     @Override
     public List<RankItem> scoring(final RankParam param,
-                               final UserFeature userFeature,
-                               final List<RankItem> rankItems) {
+                                  final UserFeature userFeature,
+                                  final List<RankItem> rankItems) {
         long startTime = System.currentTimeMillis();
         LRModel model = (LRModel) this.getModel();
         LOGGER.debug("model size: [{}]", model.getModelSize());
@@ -58,8 +56,8 @@ public class VlogShareLRScorer extends BaseLRModelScorer{
     }
 
     private List<RankItem> rankByJava(final List<RankItem> items,
-                                        final RankParam param,
-                                        final UserFeature user) {
+                                      final RankParam param,
+                                      final UserFeature user) {
         long startTime = System.currentTimeMillis();
         LRModel model = (LRModel) this.getModel();
         LOGGER.debug("model size: [{}]", model.getModelSize());
@@ -110,8 +108,9 @@ public class VlogShareLRScorer extends BaseLRModelScorer{
             lrSamples = bytesFeatureExtractor.single(userInfoBytes, newsInfoBytes,
                     new RequestContextBytesFeature(requestContext));
         } catch (Exception e) {
-            LOGGER.error("extract feature error for imei={}, doc={}, [{}]", new Object[]{new String(userInfoBytes.getUid()), item.getVideoid(),
-                    ExceptionUtils.getFullStackTrace(e)});
+            LOGGER.error("extract feature error for imei={}, doc={}, [{}]",
+                    new Object[]{new String(userInfoBytes.getUid()), item.getVideoId(),
+                            ExceptionUtils.getFullStackTrace(e)});
         }
 
 
@@ -125,13 +124,13 @@ public class VlogShareLRScorer extends BaseLRModelScorer{
             }
 
 
-            CtrSamples.Builder samples =  CtrSamples.newBuilder();
-            samples.setLr_samples(lrSamples);
-            item.setSamples(samples);
+//            CtrSamples.Builder samples =  CtrSamples.newBuilder();
+//            samples.setLr_samples(lrSamples);
+//            item.setSamples(samples);
         }
 
         item.setScore(pro);
-        item.setRecScore(pro);
+        // item.setRecScore(pro);
         return pro;
     }
 

+ 48 - 0
recommend-server-task/pom.xml

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>recommend-server</artifactId>
+        <groupId>com.tzld.piaoquan</groupId>
+        <version>1.0.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>recommend-server-task</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.tzld.piaoquan</groupId>
+            <artifactId>recommend-server-service</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <finalName>recommend-server-task</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <mainClass>com.tzld.piaoquan.recommend.server.task.Application</mainClass>
+                    <layout>ZIP</layout>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+
+    </build>
+
+</project>

+ 27 - 0
recommend-server-task/src/main/java/com/tzld/piaoquan/recommend/server/task/Application.java

@@ -0,0 +1,27 @@
+package com.tzld.piaoquan.recommend.server.task;
+
+import com.tzld.piaoquan.recommend.feature.client.FeatureClient;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+
+/**
+ * https://github.com/grpc-swagger/grpc-swagger/blob/master/README_CN.md
+ */
+@SpringBootApplication
+@EnableEurekaClient
+@EnableAspectJAutoProxy
+public class Application {
+    public static void main(String[] args) {
+        SpringApplication.run(Application.class, args);
+    }
+
+
+    @Bean
+    public FeatureClient featureClient() {
+        return new FeatureClient();
+    }
+}
+