Skip to content

KeyError "CPU" in _init_agent_loop_workers #3137

@KivenChen

Description

@KivenChen

The latest dev of agent_loop involved inspecting cluster resources, and placing workers in a custom, PACK-like strategy. However, there is a potential problem when inspecting resources:

def _init_agent_loop_workers(self):
        self.agent_loop_workers = []
        ...
        node_ids = [node["NodeID"] for node in ray.nodes() if node["Alive"] and node["Resources"]["CPU"] == 0]

In Ray clusters, CPU as a resource key is optional. It is a very common practice to set Ray head node to num_cpus=0 and Ray will not include "CPU" key in its resource dict.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions