Observed since 20 Oct, 17:01 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
a publish&subscrib toolkit
pubsub的最初目的是通过redis服务转发单目摄像头数据,供深度学习和ROS两方同时订阅FairMOT识别结果的用途,同时pubsub在主-从两台机器上进行部署主-从和多话题的支持,修改了配置文件的配置方式setup.py,并发布到pypiconfigs模块,可通过此模块直接获得配置信息redis.exceptions.ConnectionError: Connection closed by server.https://github.com/andymccurdy/redis-py/issues/1140
使用try... except redis.exceptions.ConnectionError:的方法规避了此问题
FYI
- 在本项目下,使用`py37`没有出现此问题
- 在本项目下,使用`python`没有出现此问题
- 在`FairMOT`下出现此问题,初步怀疑是`timeout`问题
该问题通过安装hiredis的方式进行了修复,修复版本0.1.5,暂未出现此问题
scheduled to be closed ASAP for overcoming of output buffer limits查看/var/log/redis/redis-server.log,可以发现
3105:M 23 Nov 18:06:12.428 # Client id=105 addr=<sub-ip>:33750 fd=7 name= age=2 idle=0 flags=N db=3 sub=1 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=38 omem=35102272 events=rw cmd=subscribe scheduled to be closed ASAP for overcoming of output buffer limits.
所有的client请求redis数据的时候,redis要返回给client的数据都会先被存储在output-buffer中,等所有信息都被传送完毕之后,再清除output-buffer中的数据。为了防止output-buffer过大,redis进行了限制。
在配置文件/etc/redis/redis.conf中进行修改
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
如果难以准确估计缓冲区需要的大小和持续时间,可以直接设为0,如下
client-output-buffer-limit pubsub 0 0 0
修改后重启redis服务。
topic,消费者/订阅端会“串台“原因分析
状态:已修复,不影响调用方式
修复版本: 0.1.7
本工具依赖redis服务请先安装redis-server
apt install redis-server
为Python安装依赖
pip3.7 install opencv-python numpy pyyaml hiredis redis
pip2.7 install opencv-python numpy pyyaml hiredis redis
setup.py 文件本身指明了相关依赖,但是由于公司网络原因,可能会出现无法正常下载安装的情况,建议在安装之前手动完成依赖包的安装。
step1. 在~路径下新建路径robot\configs,注意:请勿使用其他路径
step2. 将项目目录下的配置文件config\pubsub.yaml拷贝到~\robot\configs路径下,注意:请勿修改文件名称
step3. 按实际情况修改~\robot\configs\pubsub.yaml文件
# camera data pub & sub config
mono:
type: "pub"
source: "0"
host: "172.172.0.10"
port: "6379"
db: 3
name: "robot_mono"
topic: "robot_mono"
# bbox from FairMOT pub & sub config
track:
type: "pub"
source: "0"
host: "172.172.0.11"
port: "6379"
db: 3
name: "robot_track"
topic: "robot_track"
参数说明:
mono: 指定为单目相机,该名称请勿修改
type: 发布消息,请勿修改
source: camera device id, 通过 ls /dev/video* 配合 v4l2-ctl -d /dev/video0 --all查看
host: 消息发布ip,对应部署了pubsub程序的服务器的IP地址
port: 消息发布端口,对应部署了pubsub程序的服务器的Redis服务的端口
db: 不需改动
name: 消息发布服务的名称
topic: 消息发布话题的名称
track: 指定为跟踪算法,该名称请勿修改
type: 发布消息,请勿修改
source: 请勿修改
host: 消息发布ip,对应部署了tracking算法的服务器的IP地址
port: 消息发布端口,对应部署了tracking算法的服务器的Redis服务的端口
db: 不需改动
name: 消息发布服务的名称
topic: 消息发布话题的名称
step5. 在~/.bashrc中声明configs地址
echo export ROBOT_CONFIGS=$(dirname ~/.)'/robot/configs' >> ~/.bashrc && source ~/.bashrc
setp6. 如果存在主-从部署,请在从机上重复上述过程
请注意:
在/etc/rc.local脚本中增加了开机自启动代码,代码如下
export PUBLISHERPATH=$(dirname ~/.)'/robot/pubsub'
source $(dirname $(which conda))/activate pubsub
cd $PUBLISHERPATH
python app.py
第一段申明了MONOPUB的路径
第二段进入到该路径
第三段在后台启动脚本publish.sh 并输出日志到pub.log
第三段回到home
可使用ps -ef | grep python查看
分别在python2.7和python3.7版本下进行测试。
pip install aa-pubsub
IP下,可以不必另外配置IP下,从机需要依照主机的配置方法自行配置请注意:
Docker间传输目前Publisher端读取摄像头数据到Subscriber端得到数据拥有约100ms的延时,其中有20秒是docker造成的延时。
目前Publisher端读取摄像头数据到Subscriber端得到数据拥有约100ms的延时,同网段指办公网段(10.1.x.x)
目前Publisher端读取摄像头数据到Subscriber端得到数据拥有约100ms-200ms的延时,不同网段指办公网段与GPU服务器(10.1.x.x与10.0.40.x)
测试用例的统一运行入口是test.py文件
python test.py
testcases路径下实现,以test_{name}.py的形式命名py文件中,测试类以{name}Test的形式命名unittestpip install twine
version.py的版本号python setup.py sdist
twine upload dist/*
# 单目相机
mono:
type: "pub"
source: "0"
host: "127.0.0.1"
port: "6379"
db: 3
name: "robot_mono"
topic: "robot_mono"
# FairMOT得到的bbox
track:
type: "pub"
source: "0"
host: "127.0.0.1"
port: "6379"
db: 3
name: "robot_track"
topic: "robot_track"
# 跟随目标识别开/关量
switch_send:
type: "pub"
source: "0"
host: "10.1.101.179"
port: "6379"
db: 3
name: "robot_switch_send"
topic: "robot_switch_send"
# 跟随目标识别开/关执行反馈量
switch_feedback:
type: "pub"
source: "0"
host: "10.1.101.179"
port: "6379"
db: 3
name: "robot_switch_feedback"
topic: "robot_switch_feedback"
# 跟随目标切换信号量
control_singal_load_track_feature:
type: "pub"
source: "0"
host: "10.1.101.179"
port: "6379"
db: 3
name: "control_singal_load_track_feature"
topic: "control_singal_load_track_feature"
# 匹配到的跟随目标的图片地址
target_matched:
type: "pub"
source: "0"
host: "10.1.101.141"
port: "6380"
db: 3
name: "target_matched"
topic: "target_matched"
# 跌倒开关
fall_down_switch:
type: "pub"
source: "0"
host: "10.1.157.165"
port: "6379"
db: 3
name: "fall_down_switch"
topic: "fall_down_switch"
# 跌倒开关的反馈
fall_down_switch_result:
type: "sub"
source: "0"
host: "10.1.157.165"
port: "6379"
db: 3
name: "fall_down_switch_result"
topic: "fall_down_switch_result"
# 目标人员跌倒信息
target_status:
type: "sub"
source: "0"
host: "10.1.157.165"
port: "6379"
db: 3
name: "target_status"
topic: "target_status"
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.9 | 24 Nov 2020 | 0 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 17:01 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:6b56e3c0ff9bc80dda81d55ed2e8a6ce8e3f8dd9df068407671f841a0d71a2be