如何在 autoscaler config.yaml 中说明特定节点的 CPU 数量

问题描述

我正在尝试查找 config.yml for ray autoscaler 的命令

我知道有 max_workers 但这将集群视为一个整体。我想限制每个工作节点上启动的 cpu 数量

例如:

worker_node:
            max_cpus: 3
Head_node:
            max_cpus: 4

我该怎么做?

解决方法

每个工作器的 CPU 数量由特定于提供者的工作器配置决定。这就是 node_config 字段的用途。例如,对于 AWSm,如果您想指定一台 4 CPU 的机器,您可以执行类似

available_node_types:
    cpu_4_ondemand:
        node_config:
            InstanceType: m4.xlarge
        min_workers: 1
        max_workers: 5

注意特定于 EC2 的 InstanceType 字段(它是 4 个 cpu,因为这是 m4.xlarge 实例上的 cpu 数量)。

对于 Kubernetes,您需要在 node_config 字段中放置一个 CRD。例如

node_config:
    apiVersion: v1
    kind: Pod
    metadata:
        # Automatically generates a name for the pod with this prefix.
        generateName: ray-worker-

        # Must match the worker node service selector above if a worker node
        # service is required.
        labels:
            component: ray-worker
    spec:
          resources:
              requests:
                  cpu: 4000m
                  memory: 512MiB

有关更多信息,您可能有兴趣查看 ray 存储库中提供程序的特定示例。例如,以下是 aws 示例:https://github.com/ray-project/ray/tree/master/python/ray/autoscaler/aws