Skip to main content

Algorithm Plugin SDK

算法仓库只实现一个 Algorithm 类并声明 entry point。SDK 统一提供单次运行、WebUI、HTTP service、release manifest、compute 注册、心跳以及裸机进程管理。 算法仓库不需要 Dockerfile、Web 框架代码或 service 启停脚本。

算法侧最小接口

from algorithm_plugin_sdk import Algorithm

class MyAlgorithm(Algorithm):
    @classmethod
    def metadata(cls): ...
    def execute(self, request, context): ...

算法包声明 algorithm_plugin_sdk.algorithms entry point,并在仓库根目录发布只读的 release-manifest.json。同一个 execute() 会被所有运行方式复用。

单次运行

algorithm-plugin run camera-space-mano \
  --input '{"dataset":"/data/input"}' \
  --output-dir /data/output

一次生成、一次启动、一次停止

在算法仓库根目录执行:

algorithm-plugin config \
  --compute-url http://compute:5180 \
  --api-key "$LDP_INTERNAL_API_KEY" \
  --public-url http://10.0.0.4:9000 \
  --input-root /data/jobs/input \
  --workspace-root /data/jobs/workspace \
  --cluster production \
  --namespace camera-space-mano \
  --node-name 10.0.0.4 \
  --gpu-ids 0

algorithm-plugin start
algorithm-plugin stop

gpu_ids 属于部署配置,不由 /v1/executions 请求提供。SDK 启动服务后会将配置的 GPU IDs 自动注入每个 AlgorithmRequest

config 自动发现当前仓库和唯一 Algorithm entry point,并从 release-manifest.json 补齐 algorithm type、version、implementation digest、build revision、schema、启动入口、 PID 和日志路径。生成的 algorithm-plugin.json 权限为 0600。开发环境可使用 algorithm-plugin config --local 跳过 compute 注册。

start 默认在后台启动 0.0.0.0:9000,同时提供 /ui//v1/*,自动注册并每 5 秒心跳。日志写到 .algorithm-plugin/service.logstop 只终止 PID、启动时间和命令行 均匹配当前配置的 SDK 进程,避免误杀复用 PID 的其他进程。

需要前台运行(例如 systemd)时仍可使用:

algorithm-plugin serve camera-space-mano --port 9000 --webui

安装与测试

python -m pip install '.[service]'
python -m unittest discover -s tests -v

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ls_algorithm_plugin_sdk-0.2.5.tar.gz (42.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ls_algorithm_plugin_sdk-0.2.5-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

Details for the file ls_algorithm_plugin_sdk-0.2.5.tar.gz.

File metadata

  • Download URL: ls_algorithm_plugin_sdk-0.2.5.tar.gz
  • Upload date:
  • Size: 42.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.20

File hashes

Hashes for ls_algorithm_plugin_sdk-0.2.5.tar.gz
Algorithm Hash digest
SHA256 1c6d3ae1583308fcb40afcca85a2ed4016327b8f2836adf8d57f7a1ca6a51050
MD5 814d849238490483feb69d5f285642a2
BLAKE2b-256 feabd2846f1479301d321a8cb6ae68dcc0cdeeadd06f4599f33a1ed2ed79cccc

See more details on using hashes here.

File details

Details for the file ls_algorithm_plugin_sdk-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for ls_algorithm_plugin_sdk-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f872ce7662a8da2cef46bed3bfab506c2ad3372c2b101b829f5b4b44ae3bb139
MD5 a6df254fdf3233e1c499a88c01f0a237
BLAKE2b-256 187ee5ac9746fbfcce04287d269111e84f60d8e8ae8bd840297380fd83d55f02

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.3

2 files

0.3.1

2 files

0.3.0

2 files

This release

0.2.5 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page