
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
对于一个新的推理场景,开发流水线的步骤如下:
在products目录下创建一个对应产品的目录(以example为例)),并且在products/init.py中加上import. 后续步骤创建的类的文件都放在此目录中, 且必须在example/init.py中import, 否则可能会初始化失败。
from . import example
开发一个InferTaskConfig的子类,一般放在task.py。 其中包含一个任务需要的配置信息。包括: 1) 数据源信息:jetstream的subject、消费者等信息 2)输出目标信息:可能是数据库、jetstream
开发一个TaskManager的子类,从数据库或其他来源获取上述InferTaskConfig的全部对象。
开发一个InferPipeline的子类,用于实现推理任务的流水线。 一般只需要实现其中的__exec__方法。exec 目前没有标准化的模板,主要包括以下几步: 1) source:数据源。一般都是jetstream,已经内置好。 2) 预处理:将数据源的消息转换成内部对象。 需要自行开发,一般就是一个map算子。 3)窗口算子: 如果有窗口需求,可以增加一个窗口算子,包含时间窗口、计数窗口等。 窗口算子都已经内置实现,只需要引用即可。 4) 推理预处理:将一个窗口中的元素集合转换成推理服务的请求。 定制开发,要看推理服务的请求需要如何组织。 5) 调用推理服务。 这一般是一个map算子,是个通用的算子。 6) 写入目标。 根据具体需求引用sink算子将数据发送给下游。
# 在streaming-infer目录中执行以下命令, 将在本地启动
export RAY_PARAMETERS='{"task_type": "example"}'; python3.9 -m streaming_infer.main
其中任务的配置是在example/task_manager.py中写死的,可以用nats命令向写死的nats发送消息
cur_sec=`date '+%s'`; nats -s "ns://10.31.76.16:8221" pub js-test-7 --count=3 --sleep 1s "{\"time\": $cur_sec}"
这种情况下不会启动ray, 因为pipeline的运行本身是不依赖ray的。 但是目前只运行单个线程,这种情况下可以添加断点来调试。
RAY_PARAMETERS='{"task_type": "example"}'; python3.9 -m streaming_infer.local_test --id ex_1
发送消息的方法同上。
FAQs
streaming_infer
We found that streaming-infer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.