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.1.tar.gz (50.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.3.1-py3-none-any.whl (45.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ls_algorithm_plugin_sdk-0.3.1.tar.gz
  • Upload date:
  • Size: 50.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.3.1.tar.gz
Algorithm Hash digest
SHA256 fb15438b0a54ca6d6ea45bec36ee91640df8d78ad5fba46cf65405995a136677
MD5 178dca0cc1dc6b5799621ada9eae2bd8
BLAKE2b-256 0d85dbabb7658f34798dad44ac84cef9a776b581c7daa444de4943fe4fdcd081

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ls_algorithm_plugin_sdk-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8d64c707318abc062ebd24b5abb975f2a598d4876b0384150c0637be6093c506
MD5 3336f1ca09d4b3f624547280dcebfea2
BLAKE2b-256 595ab1c7702b7e99f7856b661fd2371fbe613845e59aca5c4b2debed51f63b74

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.3

2 files

This release

0.3.1 This release

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