topic_group_queue.py 916 B

12345678910111213141516171819202122232425262728293031
  1. class TopicGroup(object):
  2. """
  3. 生成topic,group, platform, mode等信息
  4. """
  5. def __init__(self):
  6. self.spider_list = [
  7. # ("test", "recommend", "test"),
  8. ("zhsdm", "recommend", "zhuhaoshiduomo"),
  9. ("fxs", "recommend", "fuxiaoshun"),
  10. ("zwwfsn", "recommend", "zhuwanwufusunew"),
  11. ('zjsjmn', 'recommend', 'zhujinshanjinmeinew'),
  12. ('hhxxzfdn', 'recommend', 'huanhuanxixizhufudaonew')
  13. ]
  14. def produce(self):
  15. """
  16. 工作代码
  17. :return: list [{}, {}, {}, {}, {}]
  18. """
  19. result = [
  20. {
  21. "topic": "{}_{}_prod".format(i[0], i[1]),
  22. "group": "{}_{}_prod".format(i[0], i[1]),
  23. "mode": i[1],
  24. "platform": i[2]
  25. } for i in self.spider_list
  26. ]
  27. return result
  28. # print(TopicGroup().produce())