初始化均价系统
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user