Fedora通知的后端工作进程守护程序
fmn.consumer的Python项目详细描述
fmn是要管理的一系列系统 由触发的最终用户通知 fedmsg, the Fedora FEDerated MESsage bus。
此模块包含Fedora通知的后端工作进程。
有一个家长占位符回购协议,其中包含一些有用的信息 想通读一遍,像overview,一点 architecture diagram。
黑客攻击
请在此处查找开发说明:https://github.com/fedora-infra/fmn/#hacking
运行
在项目的部分中有三个组件要运行:
- FEDMSG消费者
- 一个或多个工人
- 后端
使用者是应用程序的一部分,它接收来自 fedmsg,然后将它们发送给工人,他们将看到谁的偏好 消息匹配(即:向谁发送通知以及在哪个频道上)。 然后,工作进程将其结果发送到接收结果的后端,然后 只需要做IO:发送电子邮件,发布到IRC等等。
要运行这些部分,只需启动rabbitmq-server和redis并调用, 在三个不同的终端中(都运行同一个虚拟环境):
$ fedmsg-hub $ python fmn/consumer/worker.py $ python fmn/consumer/backend.py
方便的脚本
在scripts/dir中有一个方便的脚本,用于调试某些用户为什么这样做 或者没有收到消息。它需要一个用户名和一个fedmsg msg\u id 尝试根据 那个用户。
架构
+-------------+ Read | | Write +------+ prefs DB +<------+ | | | | + | +-------------+ | | | | +------------------+ +--------+ | | | | |fmn.lib| | | | | v | | +-------+ |<--+ User | | +----------+ +---+ | | | | | fmn.lib| | Central WebApp | +--------+ | | | +------------------+ | +----->| Worker +--------+ | | | | | fedmsg | +----------+ | | | | | | +----------+ | | +------------------+ | | fmn.lib| | +--------------------+ | | fedmsg consumer | | | | | | Backend | +-->| +------------>| Worker +--------------->| | | | | | | | | +-----+ +---+ +---+ | +------------------+ | +----------+ | |email| |IRC| |SSE| | | | +--+--+---+-+-+--+-+-+ | | +----------+ | | | | | | | fmn.lib| | | | | | | | | | | | | | +----->| Worker +--------+ | | | | RabbitMQ | | RabbitMQ | | | | +----------+ | | | | v v v | | | v
常见问题解答
问:如果工人和后端抱怨
self.db[key] = value TypeError: String or Integer object expected for key, unicode found
A:修改fedmsg.d/fmn.py的配置以使用redis
# Some configuration for the rule processors "fmn.rules.utils.use_pkgdb2": False, "fmn.rules.utils.pkgdb2_api_url": "http://209.132.184.188/api/", "fmn.rules.cache": { 'backend': 'dogpile.cache.redis', 'arguments': { 'host': 'localhost', 'port': 6379, 'db': 0, 'redis_expiration_time': 60*60*2, # 2 hours 'distributed_lock': True }, # "backend": "dogpile.cache.dbm", # "expiration_time": 300, # "arguments": { # "filename": "/var/tmp/fmn-cache.dbm", # }, },
问:当我运行worker和后端时,它会立即退出
A:您是否运行了RabbitMQ服务器和Redis服务器?
systemctl status rabbitmq-server redis
如果不运行
systemctl start rabbitmq-server redis
问:运行fedmsg hub时,显示输出中没有初始化内容
A:您更新了回购协议并再次运行安装程序了吗?
git pull workon fmn python setup.py develop
问:我现在已经运行了fedmsg hub、worker.py和后端。
A:加载Web界面并启用IRC并添加您的昵称。查看fmn.web和fmn了解更多信息。
问:这是说我的尼克无效
你的尼克登记了吗?如果没有使用正确的信息运行此程序
/msg NickServ REGISTER password youremail@example.com
src:freenode
问:我怎么知道它是否有效?
A:在IRC中,您应该通过ThreeBot与您联系
<threebot> <user>.id.fedoraproject.org has requested that notifications be sent to this nick <threebot> * To accept, visit this address:
问:如何进行压力测试?
A:待续。正在创建脚本