Move gRPC calls outside of Raylet stats lock (#6090)

This commit is contained in:
Mitchell Stern 2019-11-05 00:47:15 -08:00 committed by Philipp Moritz
parent e312f3d282
commit 82be14f943

View file

@ -404,14 +404,15 @@ class RayletStats(threading.Thread):
counter = 0
while True:
time.sleep(1.0)
replies = {}
for node in self.nodes:
node_id = node["NodeID"]
stub = self.stubs[node_id]
reply = stub.GetNodeStats(node_manager_pb2.NodeStatsRequest())
replies[node["NodeManagerAddress"]] = reply
with self._raylet_stats_lock:
for node in self.nodes:
node_id = node["NodeID"]
stub = self.stubs[node_id]
reply = stub.GetNodeStats(
node_manager_pb2.NodeStatsRequest())
self._raylet_stats[node[
"NodeManagerAddress"]] = MessageToDict(reply)
for address, reply in replies.items():
self._raylet_stats[address] = MessageToDict(reply)
counter += 1
# From time to time, check if new nodes have joined the cluster
# and update self.nodes