Speed up test/component_failures_test.py::test_actor_creation_node_failure. (#4056)

This commit is contained in:
Robert Nishihara 2019-02-17 15:35:54 -08:00 committed by Philipp Moritz
parent 5a9098891f
commit b78d77257b

View file

@ -27,17 +27,17 @@ def shutdown_only():
@pytest.fixture @pytest.fixture
def ray_start_cluster(): def ray_start_cluster():
node_args = { node_args = {
"num_cpus": 8, "num_cpus": 4,
"_internal_config": json.dumps({ "_internal_config": json.dumps({
"initial_reconstruction_timeout_milliseconds": 1000, "initial_reconstruction_timeout_milliseconds": 1000,
"num_heartbeats_timeout": 10 "num_heartbeats_timeout": 10
}) })
} }
# Start with 4 worker nodes and 8 cores each. # Start with 3 worker nodes and 4 cores each.
cluster = Cluster( cluster = Cluster(
initialize_head=True, connect=True, head_node_args=node_args) initialize_head=True, connect=True, head_node_args=node_args)
workers = [] workers = []
for _ in range(4): for _ in range(3):
workers.append(cluster.add_node(**node_args)) workers.append(cluster.add_node(**node_args))
cluster.wait_for_nodes() cluster.wait_for_nodes()
yield cluster yield cluster
@ -403,13 +403,13 @@ def test_actor_creation_node_failure(ray_start_cluster):
if exit_chance < self.death_probability: if exit_chance < self.death_probability:
sys.exit(-1) sys.exit(-1)
num_children = 100 num_children = 50
# Children actors will die about half the time. # Children actors will die about half the time.
death_probability = 0.5 death_probability = 0.5
children = [Child.remote(death_probability) for _ in range(num_children)] children = [Child.remote(death_probability) for _ in range(num_children)]
while len(cluster.list_all_nodes()) > 1: while len(cluster.list_all_nodes()) > 1:
for j in range(3): for j in range(2):
# Submit some tasks on the actors. About half of the actors will # Submit some tasks on the actors. About half of the actors will
# fail. # fail.
children_out = [child.ping.remote() for child in children] children_out = [child.ping.remote() for child in children]