MCPcopy
hub / github.com/ray-project/ray / parse_node_labels_json

Function parse_node_labels_json

python/ray/_private/label_utils.py:43–56  ·  view source on GitHub ↗
(labels_json: str)

Source from the content-addressed store, hash-verified

41
42
43def parse_node_labels_json(labels_json: str) -> Dict[str, str]:
44 labels = json.loads(labels_json)
45 if not isinstance(labels, dict):
46 raise ValueError("The format after deserialization is not a key-value pair map")
47 for key, value in labels.items():
48 if not isinstance(key, str):
49 raise ValueError("The key is not string type.")
50 if not isinstance(value, str):
51 raise ValueError(f'The value of the "{key}" is not string type')
52
53 # Validate parsed custom node labels don't begin with ray.io prefix
54 validate_node_labels(labels)
55
56 return labels
57
58
59def parse_node_labels_string(labels_str: str) -> Dict[str, str]:

Callers 2

startFunction · 0.90

Calls 2

validate_node_labelsFunction · 0.85
itemsMethod · 0.45

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…