|
@@ -1,6 +1,5 @@
|
|
|
# self is a sample Python script.
|
|
|
import random
|
|
|
-import time
|
|
|
import traceback
|
|
|
import platform
|
|
|
|
|
@@ -34,9 +33,9 @@ class RabbitMQConfig(object):
|
|
|
|
|
|
|
|
|
# 本地仓库位置
|
|
|
-local_path = os.environ.get('LOCAL_GIT_DIR', "./spider_result_handler")
|
|
|
+local_path = os.environ.get('FAAS_CODE_DIR', "./spider_result_handler")
|
|
|
# 远程仓库位置
|
|
|
-remote_path = os.environ.get('REMOVE_GIT_PATH', 'http://172.17.0.1:16666/gogs/dynamic_py_function.git')
|
|
|
+remote_path = os.environ.get('REMOVE_GIT_PATH', 'http://git.itlym.cn/gogs/dynamic_py_function.git')
|
|
|
|
|
|
|
|
|
######################################################################################################
|
|
@@ -227,6 +226,7 @@ def load_mock_msg(file_name):
|
|
|
|
|
|
repo = GitRepository(local_path, remote_path)
|
|
|
repo.pull()
|
|
|
+print('pull git.repo=' + remote_path + ' TO local=' + local_path)
|
|
|
|
|
|
|
|
|
def pull_code_and_reload():
|
|
@@ -272,13 +272,12 @@ if __name__ == '__main__':
|
|
|
# 将要发送的消息
|
|
|
sys_platform = platform.platform().lower()
|
|
|
if "windows" in sys_platform:
|
|
|
- print("Windows")
|
|
|
testMsg = load_mock_msg('m3u8TsTask.json')
|
|
|
testMsg = load_mock_msg('normalHtml.json')
|
|
|
spider_task_queue = connected_to_spider_mq()
|
|
|
|
|
|
for i in range(5):
|
|
|
- #spider_task_queue.publishMsg(json.dumps(testMsg, ensure_ascii=False), delay_ms=2000)
|
|
|
+ spider_task_queue.publishMsg(json.dumps(testMsg, ensure_ascii=False), delay_ms=2000)
|
|
|
print('生产者发送第 {} 个消息成功 '.format(i + 1))
|
|
|
print('\n -- 主程序不被阻塞,执行其它操作 --- \n')
|
|
|
time.sleep(10000)
|