新的信息

This commit is contained in:
dongchangxi committed 2024-09-02 16:52:37 +08:00
1 parent c66fc76e10
commit 345790cb05
51 files changed
+5187 -61

No files matched your search

+58 -11
View File
@@ -1,10 +1,10 @@
import redis, os, sys,requests,platform
import redis, os, sys,requests,platform,json
if platform.system() == 'Windows':
sys.path.append('e:\\libs\\')
sys.path.append('E:\\make2\\libs\\')
#sys.path.append('libs')
else:
sys.path.append('/data/deploy/make3d/make2/libs/')
import config, libs,libs_db
import config, libs,libs_db,libs_db_task_rc
def main(cmd, order_id):
if cmd == 'print': #order_id
@@ -19,17 +19,45 @@ def main(cmd, order_id):
key = 'model:foot'
elif cmd == 'rebuild': #pid
key = 'model:rebuild'
elif cmd == 'gs':
key = 'ai:ai_build'
if order_id == 'view':
for i in r.lrange(key, 0, -1):
print(i)
print(f'当前{key}队列长度:{r.llen(key)}')
if cmd == "rc_model_build":
nums = libs_db_task_rc.get_task_rc_count()
print(f'当前{cmd}队列长度:{nums}')
notify(f'当前{cmd}队列长度:{nums}')
else:
print(f'当前{cmd}队列长度:{r.llen(key)}')
notify(f'当前{cmd}队列长度:{r.llen(key)}')
for i in r.lrange(key, 0, -1):
print(i)
print(f'当前{key}队列长度:{r.llen(key)}')
else:
order_ids = order_id.split(',')
for order_id in order_ids:
r.lpush(key, order_id)
print(f'已推送{order_id}到{key}, 当前队列长度:{r.llen(key)}')
def notify(content):
if content == "":
return "content 不能为空"
for user_agent_id in config.notify_user_Ids:
data = {
'userId': user_agent_id,
'message': content,
}
headers = {'Content-Type': 'application/json'}
message_send_url = "https://mp.api.suwa3d.com/api/qyNotify/sendMessage?userId="+user_agent_id+"&message="+content
response = requests.post(message_send_url, data=json.dumps(data), headers=headers)
def cmd(cmdName,pid):
if pid == "view":
key = ""
@@ -43,10 +71,18 @@ def cmd(cmdName,pid):
key = 'model:make10'
elif cmdName == 'foot': # print_id
key = 'model:foot'
for i in r.lrange(key, 0, -1):
print(i)
print(f'当前{key}队列长度:{r.llen(key)}')
exit()
if pid == 'view':
# for i in r.lrange(key, 0, -1):
# print(i)
print(f'当前{cmd}队列长度:{r.llen(key)}')
notify(f'当前{cmd}队列长度:{r.llen(key)}')
exit()
else:
for i in r.lrange(key, 0, -1):
print(i)
print(f'当前{key}队列长度:{r.llen(key)}')
exit()
res = requests.get(f'https://mp.api.suwa3d.com/api/infoQuery/infoByPid?pid={pid}&cmd={cmdName}')
#获取res 的数据
@@ -135,13 +171,24 @@ def listDataToStr(data,cmdName):
if __name__ == '__main__':
r = config.redis_remote
if len(sys.argv) == 3:
cmdName = sys.argv[1]
pid = sys.argv[2]
elif len(sys.argv) == 2:
cmd = sys.argv[1]
order_id = 'view'
if cmd == "auto_view":
arrCmd = ["print","foot","gs","rc_model_build"]
for cmdV in arrCmd:
main(cmdV, order_id)
exit(1)
else:
print('用法:python push_cmd.py <cmd> <order_id>')
exit(1)
r = config.redis_remote
#pid 可能是多个的,用逗号分隔,查询的时候接口应该也要支持多个的
if cmdName == 'make3d' or cmdName == 'make3d10' or cmdName == 'rebuild':