# client sample, 2022.4.2
import redis, fire

def run(host='127.0.0.1', port=6379, timeout=10):
	''' host: 127.0.0.1,  192.168.1.55, 192.168.201.120, 172.17.0.1, 172.18.0.1 '''
	r	= redis.Redis(host=host,port=port, decode_responses=True)
	# when topk= 0 or missing, means translate all the sents , gecoff= 1 , to disable gec 
	#id  = r.xadd("xwps", {"debug":1, "topk":32, })
	id = r.xadd('xwps', {"key":"PG115_11bae9_1a7a3c5d32e68a6d0f2567504f286dbe","rid":"861591","ct":1649389547.2116,"tit":"\u6587\u6863.doc","doc":"The internet and the modern society\rWith the development of technology, the application of the internet is more and more universal in the modern society. Therefore, a question arises: whether the internet can do impossible things or it distracts people's attention rather than help people do things better. It is natural that people can never reach the same viewpoints. As far as I am concerned, the internet brings us an efficient lifestyle in the modern society instead of distracting people's attention.\rNowadays, we live in a world which is covered by the internet. We can' not have a perfect life without internet. For instance,when we are at home, we can any watch TV programs and know kinds of news from all over the world. Besides, we don\rt need to shop in the supermarkets to buy goods no longer. The online shopping help people to buy things easily and there would be a postman sending your goods to your house. What's more, it is possible to connect with other people in any moment and anywhere by using the internet. There are numerous telephone apps applying to communicate with each other.\rThe internet has made grate influence in the modern society. On the one hand, the internet is changing people's thinking mood. In the non-internet period, when we encounter difficulties or questions, we often asked for the solutions from old and knowledgeable men or believe the words which have been spread for a long history. However,today if we meet questions,we can solve them by ourselves through using internet to get answers in some websites,such as baidu and google. On the other hand, internet gives us more efficient and wonderful lives. Thinking about writing letters which need a long time to convey from the sender to the receiver.The internet has changed this way,it make our lives more convenient and satisfied. We all know that the internet is usually related to the computers or other advantaged technology. It is internet that makes an unpredictable progress in our modern society. As a student, I gain a large amount of information that broads my horizon on the internet, such as taking remote lessons and learning intercultural knowledge.\rIn a nutshell, the internet plays an important role in the modern society. Not only can it do thing that are impossible in the past, but also it motivates people into a better and efficient lifestyle.\r","lang":"zh_cn","mq_name":"pigai_callback_api_essay","routing_key":"pigai_callback_api_essay","progress":"0","models":"nn"})
	print ( "id:", id,flush=True)
	res	= r.blpop([f"suc:{id}",f"err:{id}"], timeout=timeout)
	print (res if res is not None else "result is None") 

if __name__ == '__main__':
	fire.Fire(run)
