mirror of
https://github.com/wassname/ray.git
synced 2026-06-29 17:37:07 +08:00
Fix linting on master branch (#6174)
This commit is contained in:
@@ -279,7 +279,7 @@ class LoadMetrics(object):
|
||||
now - t for t in self.last_heartbeat_time_by_ip.values()
|
||||
]
|
||||
most_delayed_heartbeats = sorted(
|
||||
list(self.last_heartbeat_time_by_ip.items()),
|
||||
self.last_heartbeat_time_by_ip.items(),
|
||||
key=lambda pair: pair[1])[:5]
|
||||
most_delayed_heartbeats = {
|
||||
ip: (now - t)
|
||||
|
||||
@@ -88,17 +88,12 @@ def teardown_cluster(config_file, yes, workers_only, override_cluster_name):
|
||||
if workers_only:
|
||||
A = []
|
||||
else:
|
||||
A = [
|
||||
node_id for node_id in provider.non_terminated_nodes({
|
||||
TAG_RAY_NODE_TYPE: NODE_TYPE_HEAD
|
||||
})
|
||||
]
|
||||
|
||||
A += [
|
||||
node_id for node_id in provider.non_terminated_nodes({
|
||||
TAG_RAY_NODE_TYPE: NODE_TYPE_WORKER
|
||||
A = provider.non_terminated_nodes({
|
||||
TAG_RAY_NODE_TYPE: NODE_TYPE_HEAD
|
||||
})
|
||||
]
|
||||
A += provider.non_terminated_nodes({
|
||||
TAG_RAY_NODE_TYPE: NODE_TYPE_WORKER
|
||||
})
|
||||
return A
|
||||
|
||||
# Loop here to check that both the head and worker nodes are actually
|
||||
|
||||
@@ -139,7 +139,7 @@ def receive(sources, timeout=None):
|
||||
# redis expects ms.
|
||||
query += str(timeout_ms)
|
||||
query += " STREAMS "
|
||||
query += " ".join([task_id for task_id in task_id_to_sources])
|
||||
query += " ".join(task_id_to_sources)
|
||||
query += " "
|
||||
query += " ".join([
|
||||
ray.utils.decode(signal_counters[ray.utils.hex_to_binary(task_id)])
|
||||
|
||||
@@ -2523,7 +2523,7 @@ def test_checkpointing_on_node_failure(ray_start_cluster_2_nodes,
|
||||
"""Test actor checkpointing on a remote node."""
|
||||
# Place the actor on the remote node.
|
||||
cluster = ray_start_cluster_2_nodes
|
||||
remote_node = [node for node in cluster.worker_nodes]
|
||||
remote_node = list(cluster.worker_nodes)
|
||||
actor_cls = ray.remote(max_reconstructions=1)(ray_checkpointable_actor_cls)
|
||||
actor = actor_cls.remote()
|
||||
while (ray.get(actor.node_id.remote()) != remote_node[0].unique_id):
|
||||
|
||||
@@ -59,7 +59,7 @@ class AutoMLSearcherTest(unittest.TestCase):
|
||||
|
||||
self.assertEqual(len(searcher.next_trials()), 0)
|
||||
for i, trial in enumerate(trials):
|
||||
rewards = [x for x in range(i, i + 10)]
|
||||
rewards = list(range(i, i + 10))
|
||||
random.shuffle(rewards)
|
||||
for reward in rewards:
|
||||
searcher.on_trial_result(trial.trial_id, {"reward": reward})
|
||||
|
||||
@@ -590,7 +590,7 @@ class HyperbandSuite(unittest.TestCase):
|
||||
def testRemove(self):
|
||||
"""Test with 4: start 1, remove 1 pending, add 2, remove 1 pending."""
|
||||
sched, runner = self.schedulerSetup(4)
|
||||
trials = sorted(list(sched._trial_info), key=lambda t: t.trial_id)
|
||||
trials = sorted(sched._trial_info, key=lambda t: t.trial_id)
|
||||
runner._launch_trial(trials[0])
|
||||
sched.on_trial_result(runner, trials[0], result(1, 5))
|
||||
self.assertEqual(trials[0].status, Trial.RUNNING)
|
||||
|
||||
@@ -202,7 +202,7 @@ def RunnerHandler(runner):
|
||||
path = parts.path
|
||||
|
||||
if path == "/trials":
|
||||
return [t for t in runner.get_trials()]
|
||||
return list(runner.get_trials())
|
||||
else:
|
||||
trial_id = path.split("/")[-1]
|
||||
return runner.get_trial(trial_id)
|
||||
|
||||
Reference in New Issue
Block a user