edgehub
一款灵活高效的,跨进程分布式边缘计算引擎。
安装方式
pip3 install edgehub
使用示例
示例1
该示例由一个Master节点和两个Node节点组成。
Master负责消息传递,不负责运算。
两个Node,一个Node节点负责实时读入摄像头视频流,另一个Node节点负责展示前一个Node读到的视频流。
本示例需要安装python-opencv: pip3 install opencv-python
master.py
from edgehub import Master
if __name__ == '__main__':
SERVER_IP = '127.0.0.1'
SERVER_PROT = 9010
m = Master("master", address=(SERVER_IP, SERVER_PROT), authkey=b'z', log_level="DEBUG")
server = m.get_server()
server.serve_forever()
node_cam_read.py
from edgehub import Node
import cv2
class CameraNode(Node):
stream = Node
camera_url = 1
def before_run(self):
self.register_queue("cam")
self.stream = cv2.VideoCapture(self.camera_url)
def on_queue_process(self, queue_name):
(grabbed, frame) = self.stream.read()
self.put(frame, queue_name)
if __name__ == '__main__':
SERVER_IP = '127.0.0.1'
SERVER_PROT = 9010
n = CameraNode("cap_put", address=(SERVER_IP, SERVER_PROT), authkey=b'z')
n.run()
node_cam_show.py
from edgehub import Node
import cv2
class CamGetNode(Node):
def before_run(self):
self.register_queue("cam")
def on_queue_process(self, queue_name):
item = self.get(queue_name)
cv2.imshow("queue_name", item)
key = cv2.waitKey(1) & 0xFF
if key == ord("q"):
raise StopIteration()
# 为了确保队列不积压 导致延迟递增 每次执行完后清空当前队列,这样每次处理时就会取到最新图片
self.clear(queue_name)
if __name__ == '__main__':
SERVER_IP = '127.0.0.1'
SERVER_PROT = 9010
n = CamGetNode(name="cam_get", address=(SERVER_IP, SERVER_PROT), authkey=b'z')
n.run()
Metadata
Release files for edgehub 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| edgehub-0.0.5.tar.gz | 8.7 kB | Without provenance | Details for edgehub-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| edgehub-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for edgehub-0.0.5-py3-none-any.whl |
Total release size: 19.5 kB
Release files / edgehub-0.0.5.tar.gz
| Download URL | edgehub-0.0.5.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d0d1f6757349f8effea7b26d8fb0c8924756aae0962c5dcd5a425c9c291afa8
|
|
BLAKE2b-256 checksum How to use checksums |
882cc4ff9af4467cf6491cebb6066699ea553bc7184a21aab270741584615d3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.0 requests/2.23.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.4
|
Release files / edgehub-0.0.5-py3-none-any.whl
| Download URL | edgehub-0.0.5-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e88f0782d75361f89631d6c218cc42e3f4149934069548a5c153e080c4f11c1b
|
|
BLAKE2b-256 checksum How to use checksums |
989642ba45d6f64dc1d24d12d0cc2de7add7b0fb8515ef83f770974116c3458e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.0 requests/2.23.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.4
|
Security for edgehub 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.