为满足用户通过 Ray 进行多模态数据处理等需求,EMR Serverless 支持用户进行 Ray 作业的提交和执行。开箱即用,无需额外的集群管理。
登录 EMR Serverless 控制台,选择目标队列。
进入编辑作业页面,有如下两种方式:
方式一:
在作业编辑框的右上角,开发类型选择 PrestoSQL。
开发模式可选择UI或者YAML。
在作业编辑页面的右上角,开发模式选择UI。
参数说明
参数名称 | 参数作用 | 是否必须 |
|---|---|---|
镜像 | 镜像类型,可以选择基础镜像或自定义镜像 | 是 |
镜像地址 | 选择执行作业时实际使用的镜像 | 是 |
资源文件 | Ray作业文件地址 | 是 |
代码入口(Entry Point) | 作业的入口地址 | 是 |
Head CPU | 执行Ray作业时head Pod CPU资源量 | 是 |
Head Memory | 执行Ray作业时head Pod Memory资源量 | 是 |
Worker CPU | 执行Ray作业时worker Pod CPU资源量 | 是 |
Worker Memory | 执行Ray作业时worker Pod Memory资源量 | 是 |
Worker Replicas | 执行Ray作业时worker Pod 的数量 | 是 |
说明
其余可选参数请根据需要填写。
在作业编辑页面的右上角,开发模式选择YAML,并在编辑框中输入作业内容,以下为示例:
apiVersion: ray.io/v1 kind: RayJob metadata: name: myrayjob spec: entrypoint: python /home/ray/workdir/{relative path}/{job name}.py; # working_dir: 代码zip包的tos地址,必填 # pip: 运行时依赖包 # env_vars: 环境变量 runtimeEnvYAML: | working_dir: tos://{TOS bucket name}/{path}/demo.zip pip: - requests==2.26.0 - pendulum==2.1.2 env_vars: counter_name: "test_counter" # rayClusterSpec specifies the RayCluster instance to be created by the RayJob controller. rayClusterSpec: rayVersion: '2.30.0' # should match the Ray version in the image of the containers # 是否开启 autoScaling enableInTreeAutoscaling: false # Ray head pod template headGroupSpec: #pod template template: spec: containers: - name: ray-head image: image-repo-cn-beijing.cr.volces.com/emr-serverless-ray/ray:2.30.0-boto3 resources: limits: cpu: "2" memory: "2Gi" workerGroupSpecs: # the pod replicas in this group typed worker - replicas: 1 # 开启 autoScaling 时的 worker min/max 数量 minReplicas: 1 maxReplicas: 2 #pod template template: spec: containers: - name: ray-worker image: image-repo-cn-beijing.cr.volces.com/emr-serverless-ray/ray:2.30.0-boto3 resources: limits: cpu: "2" memory: "2Gi"
作业信息编辑完成后,即可点击运行按钮,提交成功后会在页面顶部显示Ray Job 作业 已提交,随后页面会自动跳转到作业管理页并筛选出该Ray Job作业。
说明
作业提交后,可以在 Serverless 作业管理页面查看作业日志与Ray UI,也可以执行重跑、终止等操作。
详细操作请参考:Serverless Ray 使用指南。