初始化均价系统

This commit is contained in:
2018-03-07 09:59:22 +08:00
commit 933f2d7aec
16 changed files with 4350 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import json
import multiprocessing
import time
import redis
QUEUE = "calc_cmd"
redis_pool = redis.ConnectionPool(host='192.168.0.144', port=6379, db=0)
def monitor(pname):
client = redis.Redis(connection_pool=redis_pool)
while True:
pre_counter = client.llen(QUEUE)
time.sleep(60)
print(pname + "#####################################:".zfill(100) + str(
pre_counter - client.llen(QUEUE)) + "/min")
def format_cmd(cmd):
return json.loads(cmd)
if __name__ == "__main__":
pool = multiprocessing.Pool(processes=1)
pool.apply_async(monitor, ("Monitor-001",))
pool.close()
pool.join()