作业运行参数配置

更新时间:
复制 MD 格式

本文介绍Lindorm 计算引擎 RAY 作业的常用配置项和配置方法。

配置项概览

Ray 作业支持 作业级别与集群级别两类配置:

  • jobConfig:作业级配置,如目标资源组、RuntimeEnv、TTL 等。

  • clusterConfig:集群级配置,如镜像、Head/Worker 资源规格、机型偏好、环境变量等。

jobConfig 配置项

配置项

是否必填

默认值

说明

jobConfig.computeGroup

目标 RAY 资源组名称,兼容计算引擎统一的 compute-group配置。

jobConfig.runtimeEnvJson

Ray RuntimeEnv JSON 字符串,用于指定依赖包、工作目录、环境变量等。

jobConfig.ttlSecondsAfterFinished

300

作业完成后 Ray 集群的保留时间,单位为秒。

clusterConfig 配置项

集群级配置

配置项

是否必填

默认值

说明

clusterConfig.image

平台默认镜像

运行 Ray 作业使用的镜像地址,不填写则使用默认镜像。如需使用自定义镜像可参考 使用自定义镜像运行 RAY 作业

clusterConfig.env.<key>

集群级环境变量。

Head 节点配置

配置项

是否必填

默认值

说明

clusterConfig.head.cpu

4

Head 节点 CPU 核数。

clusterConfig.head.memoryGB

16

Head 节点内存(GB)。

clusterConfig.head.diskSizeGB

30

Head 节点磁盘(GB)。

clusterConfig.head.machineType

Head 节点机型偏好。

clusterConfig.head.env.<key>

Head 节点环境变量。

Worker Group 配置

Worker Group 通过名称来区分,例如定义名为 wg1 的 Worker Group:clusterConfig.workerGroup.wg1.*

配置项

是否必填

默认值

说明

clusterConfig.workerGroup.wg1.cpu

4

Worker CPU 核数。

clusterConfig.workerGroup.wg1.memoryGB

16

Worker 内存(GB)。

clusterConfig.workerGroup.wg1.diskSizeGB

30

Worker 磁盘(GB)。

clusterConfig.workerGroup.wg1.replicas

2

Worker 副本数。

clusterConfig.workerGroup.wg1.minReplicas

最小 Worker 副本数,开启自动扩缩容时生效。

clusterConfig.workerGroup.wg1.maxReplicas

最大 Worker 副本数,开启自动扩缩容时生效。

clusterConfig.workerGroup.wg1.machineType

Worker 机型偏好。

clusterConfig.workerGroup.wg1.env.<key>

Worker 节点环境变量。

配置方法

通过 POST /api/v1/lindorm/jobs/{token} 提交 Ray 作业,所有配置通过请求体中的 conf 字段传入。

{
  "owner": "data-team",
  "mainResourceKind": "ray",
  "mainResource": "python my_script.py --arg1 val1",
  "name": "my-ray-job",
  "conf": {
    "jobConfig.computeGroup": "raycgserverless",
    "jobConfig.runtimeEnvJson": "{\"pip\":[\"pandas\"],\"working_dir\":\"https://your-bucket.oss-cn-hangzhou.aliyuncs.com/ray-project.zip\"}",
    "clusterConfig.head.cpu": "4",
    "clusterConfig.head.memoryGB": "16",
    "clusterConfig.workerGroup.wg1.cpu": "8",
    "clusterConfig.workerGroup.wg1.memoryGB": "32",
    "clusterConfig.workerGroup.wg1.minReplicas": "1",
    "clusterConfig.workerGroup.wg1.maxReplicas": "4"
  }
}