Skip to main content

hello-datap-component-base

数据处理平台组件 SDK:统一入参/出参、Ray 分布式日志、数据跟踪(track)、结果投递(OSS + MNS)。

当前版本:0.6.7

安装

pip install hello-datap-component-base==0.6.7

Ray 集群由平台或作业入口初始化,组件代码内无需 ray.init()。

集成方式(推荐:提示词)

不要从零对照 API 手写骨架。 将下方提示词交给 Cursor / Copilot 等 AI,附上你的业务描述,即可生成符合平台规范的完整组件代码。

场景 提示词文件 SDK 要求
普通流水线节点(自行 ray.get 批量聚合) prompts/普通组件集成提示词.md = 0.6.7
流水线已开启 「DAG 流式执行 / DAG 漏斗视角」 prompts/DAG流式组件集成提示词.md = 0.6.7

如何选型

流水线「高级」里是否勾选「启用 DAG 流式执行」?
├── 否 → 用「普通组件」提示词,继承 BaseService
└── 是 → 用「DAG 流式」提示词,继承 DagStreamingService(自动 dagStream 计数 + 并发/超时)

提示词内已包含:Ray runtime_env 透传、logger / track 用法、失败隔离、代码骨架。以提示词为准,本文不再重复展开。

参考示例

提交远程 Ray 集群前,可先对照仓库内完整 Demo:

目录 类型 说明
examples/batch_compute/ 普通组件 加减乘除批量计算,BaseService + ray.get
examples/dag_streaming/ DAG 流式 同上业务,含 outputResult.dagStream

各子目录含 service.py + config.json,运行方式见对应 README.md。

运行组件

component_manager start <config.json> --class-name <YourServiceClass>

等价:python -m hello_datap_component_base.cli start ...

常用子命令:list · validate · test

配置要点

config.json 中 params 会作为 process(data) / extract_items(params) 的入参;平台注入的跟踪、MNS、OSS 等变量写在 runtime_env.env_vars 或由平台下发(提示词中说明如何传给 Ray worker)。

最小字段:name(必需)、version、work_flow_id、work_flow_instance_id、task_id、runtime_env、params。

数据跟踪传输

track.log() 默认继续使用 MNS;设置 DATA_TRACK_TRANSPORT=kafka 后切换到 Kafka。Kafka 需要 DATA_TRACK_KAFKA_BOOTSTRAP_SERVERS,topic 可通过 DATA_TRACK_KAFKA_TOPIC 覆盖,默认 platform_process_bag_track_v2。tools.extract_specific_env_vars() 会将这些配置连同 MNS 回滚配置透传给 Ray worker。

返回格式

框架将业务 process 返回值包在 data.out_put 中;整体结构:

{
  "code": 0,
  "message": "success",
  "processing_time": 0.12,
  "data": {
    "work_flow_id": 123,
    "work_flow_instance_id": 456,
    "task_id": "task-001",
    "out_put": { }
  }
}

失败时 code = -1,out_put 为 null。DAG 流式组件的业务结果与 dagStream 字段同在 out_put 内(详见 DAG 提示词)。

SDK 能力一览

模块 用途
BaseService 普通组件基类
DagStreamingService DAG 流式组件(推荐 = 0.6.7)
logger Header / 按数据 key 分文件的 Ray 业务日志,可上传 OSS
track 数据跟踪,两段式上报 MNS/Kafka(默认 MNS)
tools extract_specific_env_vars()、bag 路径解析等

项目结构

hello_datap_component_base/   # SDK 源码
prompts/                      # 集成提示词(推荐入口)
examples/                     # 可运行的参考 Demo
tests/

许可证

MIT License

Metadata

Release files for hello-datap-component-base 0.6.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hello-datap-component-base 0.6.7
File Size Uploaded
hello_datap_component_base-0.6.7.tar.gz 101.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hello-datap-component-base 0.6.7
File Interpreter ABI Platform
hello_datap_component_base-0.6.7-py3-none-any.whl Python 3 none any Details

Total release size: 173.9 kB

Release files / hello_datap_component_base-0.6.7.tar.gz

Download URL hello_datap_component_base-0.6.7.tar.gz
Size 101.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b140666329c3235b09c52f1379f0e93f527aadc9a5c2c0f09afec1466840e6f2
BLAKE2b-256 checksum
How to use checksums
0019ee363bd1d73d42cb4fb55d3858e0e1a69cd65db5f9bddb02b94680653288
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / hello_datap_component_base-0.6.7-py3-none-any.whl

Download URL hello_datap_component_base-0.6.7-py3-none-any.whl
Size 72.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04d78e10c0c444a38e0e7ffc7a72b036d56d5f98f1b2c86cb602f4f0e9281b72
BLAKE2b-256 checksum
How to use checksums
3e7911714708360c50251c59fb8d00df379729b60701fed1cd569ad3585bc9a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release history Release notifications | RSS feed

This release

0.6.7 This release

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.6

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release 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