Skip to main content

Smart Platforms Libs

Project description

Smart Platforms Libs

项目结构

主框架

  • smart.auto: 自动化框架
  • smart.aaas: auto as a service 自动化任务发布为rest服务
  • smart.utils: 工具类
  • smart.rest: simple rest server
  • smart.rulenet: 规则网络 (原型版本)

任务类库

  • auto_tasks.tools: 基础任务工具
  • auto_tasks.jsonl: jsonl文件读写
  • auto_tasks.redis: redis管道服务, 用于向aaas发送数据和读取结果
  • auto_tasks.aaas: aaas客户端, 启动远程任务

How-to-Use

Install

# 安装方法1
## 仓库安装
pip install smartlibs

## 源码打包安装
python3 setup.py sdist
pip install dist/smartlibs-0.1.4.tar.gz

# 记录安装文件
sudo python3 setup.py install --record logs/files.txt

## 更新
pip install --force-reinstall --no-deps smartlibs

Quick Start

smart_auto quick start

查看命令说明: smart_auto -- --help

Run Cmd Example:

smart_auto auto_tasks.tasks 'task:tools__tool.range~@tools__print.item_iter'

Bind Arg:

smart_auto auto_tasks.tasks task:tools__tool.range~@tools__print.item_iter --bind_arg.tools__tool.range.size=20 --bind_arg.tools__print.item_iter.head=None

Multi Tasks:

smart_auto auto_tasks.test helloworld,helloworld smart_auto auto_tasks.test '["task:tools__tool.range~@tools__print.item_iter","helloworld"]'

smart_aaas quick start

启动aaas服务: smart_aaas

查看命令说明: smart_aaas -- --help

[推荐使用 Postman 测试后面的Api]

查看服务描述(asdl: auto service description language):

curl 'http://127.0.0.1/auto/run?module=starter.aaas.client&only_parse=1'

创建任务:

curl 'http://127.0.0.1/auto/run?module=starter.aaas.client&name=task:tools__tool.range~@tools__print.item_iter'
在运行smart_aaas的终端将看到任务执行日志

名词解释

  • smartlibs: smartnlp底层框架, 设计用于数据科学
  • smart_auto: 任务自动化工具命令行, 等同于python -m smart.auto.run
  • smart_aaas: 自动化发布成服务的工具命令行, 等同于python -m smart.aaas.run

smart_auto

  • asdl: auto service description language 自动化服务描述语言, 基于 yaml
  • auto yml: 使用asdl编写的yml文件
  • task: 最小任务单元, 即使是单进程运行模式, 任务的设计应符合进程隔离; 即任务间应通过管道传递数据
  • tree: 任务树, 每个任务最多一个前置任务, 可以有多个后置任务, 不能出现环形依赖
  • task expression: 任务表达式, 设计简要的字符串规则, 可被解析为任务名、任务方法、连接方法、绑定配置
  • task key: 任务表达式中的任务名、任务方法作为任务关键字, 同一个tree下task key不能重复; 如需复用任务函数, 可用$+数字追加到任务方法之后
  • module: 以'.'分割的路径名(dotted_module_path), 追加'.yml'后缀应指向 auto yml 文件; 完整格式: python包名.下属文件路径(路径分隔符替换成'.').auto_yml文件名
  • pip: 数据管道, 为任务树的依赖任务之间提供数据队列; 发送机制为广播, 即前置任务同时向多个后置任务发送相同数据, 后置任务不能向前置任务发送数据

教程

参考代码

  • tests: 单元测试

starter: 入门教程

  • starter.helloworld: 学习创建auto.yml, 编写任务类

  • starter.aaas: aaas客户端和服务端示例 (通过Redis建立数据管道)

开发

Windows环境

注意: Windows需在命令行执行git config --global core.autocrlf input

Start Redis Server

docker run -d --name myredis -p 6379:6379 redis redis-server --appendonly yes

Project details


Download files

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

Source Distribution

smartlibs-0.1.10.tar.gz (136.3 kB view details)

Uploaded Source

Built Distribution

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

smartlibs-0.1.10-py3-none-any.whl (186.6 kB view details)

Uploaded Python 3

File details

Details for the file smartlibs-0.1.10.tar.gz.

File metadata

  • Download URL: smartlibs-0.1.10.tar.gz
  • Upload date:
  • Size: 136.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for smartlibs-0.1.10.tar.gz
Algorithm Hash digest
SHA256 fa7a84e525e6c61a6cafa030cd0d632c717329e7b98a8b969cb44124555eff65
MD5 da4d2c9e72dadaded0e9068ac5b40286
BLAKE2b-256 bb7172e233037349fab684da7bcbface4e3114d4021df0379f2e6257c8152490

See more details on using hashes here.

Provenance

The following attestation bundles were made for smartlibs-0.1.10.tar.gz:

Publisher: publish.yml on huanghw1989/smartlibs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smartlibs-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: smartlibs-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 186.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for smartlibs-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 0a06f98c78898e0aac22b1b3b2e18ba61b8d72825db5176e33b8d5643bbde499
MD5 cd72952a79d738a06c55dba5e89921f4
BLAKE2b-256 8d40a9fb526097ff569d9d094b4ee510e7071d138e8255c39a0501d1d10ab36c

See more details on using hashes here.

Provenance

The following attestation bundles were made for smartlibs-0.1.10-py3-none-any.whl:

Publisher: publish.yml on huanghw1989/smartlibs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page