Explorar el Código

增加dockerfile && docker-compose.yaml

罗俊辉 hace 9 meses
padre
commit
a03898d71f
Se han modificado 4 ficheros con 46 adiciones y 7 borrados
  1. 11 0
      Dockerfile
  2. 19 0
      docker-compose.yaml
  3. 3 3
      test/rank_dev.py
  4. 13 4
      test/score_list_dev.py

+ 11 - 0
Dockerfile

@@ -0,0 +1,11 @@
+FROM registry.cn-hangzhou.aliyuncs.com/stuuudy/cyber-crawler-base:latest
+
+WORKDIR /LongArticleAlgServer
+
+COPY . .
+
+ENV TZ=Asia/Shanghai
+
+RUN pip install -r requirements.txt -i https://mirrors.163.com/pypi/simple/ --no-cache-dir
+
+CMD ["hypercorn", "alg_app:app", "--config", "alg.toml"]

+ 19 - 0
docker-compose.yaml

@@ -0,0 +1,19 @@
+version: '3.8'
+
+services:
+  server-prod:
+
+    build:
+      context: .
+      dockerfile: Dockerfile
+    image: long_article_alg_server
+    container_name: long_article_alg_server
+    restart: unless-stopped
+    ports:
+      - '6060:6060'
+    networks:
+      - crawler
+    entrypoint: ["hypercorn", "alg_app:app", "--config", "alg.toml"]
+
+networks:
+  crawler:

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 3 - 3
test/rank_dev.py


+ 13 - 4
test/score_list_dev.py

@@ -17,10 +17,15 @@ def score_list(account):
     :param account:
     :return:
     """
-    url2 = "http://192.168.100.31:6062/score_list"
+    url2 = "http://192.168.100.31:6060/score_list"
     body = {
         "account_nickname_list": [account],
-        "text_list": ['保姆为300万拆迁款,嫁给大24岁老头,丈夫去世后,她发现房产证没有丈夫名字'] * 50,
+        "text_list": [
+            "在俄罗斯买好地了,却发现没有公路、码头、仓储、燃气管道……”",
+            "被霸占15年后成功收回,岛礁资源超100万吨,曾遭到美菲联手抢夺",
+            "感人!河南姐弟被父母遗弃,7岁弟弟带着姐姐看病:别怕,以后我养",
+            "山东26岁女子产下罕见“4胞胎”,丈夫却突然消失,婆婆:养不起"
+        ],
         "max_time": None,
         "min_time": None,
         "interest_type": "avg",
@@ -33,8 +38,12 @@ def score_list(account):
 
 
 if __name__ == '__main__':
+    # a = time.time()
+    # with ThreadPoolExecutor(max_workers=100) as pool:
+    #     pool.map(score_list, ["生活良读"] * 1)
+    # b = time.time()
+    # print(b - a)
     a = time.time()
-    with ThreadPoolExecutor(max_workers=100) as pool:
-        pool.map(score_list, ["生活良读"] * 1000)
+    res = score_list("生活情感叁读")
     b = time.time()
     print(b - a)

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio