Skip to main content

Algorithm Plugin SDK

算法侧最小接口

from algorithm_plugin_sdk import Algorithm

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

算法包需要声明 algorithm_plugin_sdk.algorithms entry point。

单次运行

algorithm-plugin run camera-space-mano \
  --input '{"input_dataset":"/data/input1","output":"/data/output1"}' \
  --input '{"input_dataset":"/data/input2","output":"/data/output2"}' \
  --gpu-ids 0 \
  --parameters '{"batch_size":16}'

--gpu-ids--parameters 可省略,也可用 --request-file 读取完整请求 JSON。

配置现有仓库

目标算法仓库必须满足:

  • 仓库本身是 Git 工作树根目录。
  • 仓库包含自己的 .venv
  • <repository>/.venv/bin/algorithm-plugin 存在且可执行。

建议将生成的 release-manifest.jsonalgorithm-plugin.json 加入算法仓库的 .gitignore,不要手动编辑或提交它们。

通过目标仓库的虚拟环境执行:

sudo /srv/camera-space-mano/.venv/bin/algorithm-plugin configure \
  --repository /srv/camera-space-mano \
  --compute-url http://compute:5180 \
  --api-key "$LDP_INTERNAL_API_KEY" \
  --port 9030 \
  --cluster production \
  --gpu-ids 0,1

重复执行 configure 需要显式提供 --force

确认输出后执行:

sudo systemctl daemon-reload
sudo systemctl enable camera-space-mano.service
sudo systemctl restart camera-space-mano.service
sudo systemctl status camera-space-mano.service --no-pager

serve

/srv/camera-space-mano/.venv/bin/algorithm-plugin serve \
  --config /srv/camera-space-mano/algorithm-plugin.json

安装与测试

python -m pip install .
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.3.3.tar.gz (52.9 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.3.3-py3-none-any.whl (48.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ls_algorithm_plugin_sdk-0.3.3.tar.gz
  • Upload date:
  • Size: 52.9 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.3.3.tar.gz
Algorithm Hash digest
SHA256 5f8901cd39f4526e4e69d197aa44cbc48ef98816b4d545ef483b401cea6d4bdc
MD5 c6f4134946b36b44f2726cf907dab6c6
BLAKE2b-256 f5caf2c5808f51affc02fd2b32f93e6c0638ac302efe97162984f983bfb8ae16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ls_algorithm_plugin_sdk-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e3cab0e41fc24ba0813a2ae43aa64c112f1e1ff8d4dd1c31238eac9efbbbd370
MD5 1226d962b3de52e3dc88a582eb04ea23
BLAKE2b-256 dd022fe269013b841aca4423796dcea14e52bb9c53bc2ce91e836b4f88345437

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.3 This release

2 files

0.3.1

2 files

0.3.0

2 files

0.2.5

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