75dfae84e40d62124b3622da07f06ff1cc26d496,python/ray/serve/tests/test_backend_state.py,,test_force_kill,#Any#,205

Before Change


    // Create and delete the backend.
    backend_state.deploy_backend("tag1", b_config_1, r_config_1)
    backend_state.update()
    replicas(backend_state)[0]._actor.set_ready()
    backend_state.update()
    delete_goal = backend_state.delete_backend("tag1")
    backend_state.update()

After Change


    b_config_1.experimental_graceful_shutdown_timeout_s = grace_period_s

    // Create and delete the backend.
    tag = "tag"
    backend_state.deploy_backend(tag, b_config_1, r_config_1)
    backend_state.update()
    backend_state._replicas[tag].get()[0]._actor.set_ready()
    backend_state.update()
    delete_goal = backend_state.delete_backend(tag)
    backend_state.update()

    // Replica should remain in STOPPING until it finishes.
    assert len(backend_state._replicas[tag].get()) == 1
    assert len(
        backend_state._replicas[tag].get(states=[ReplicaState.STOPPING])) == 1
    assert backend_state._replicas[tag].get()[0]._actor.stopped

    backend_state.update()
    backend_state.update()

    // force_stop shouldn"t be called until after the timer.
    assert not backend_state._replicas[tag].get(
    )[0]._actor.force_stopped_counter
    assert not backend_state._replicas[tag].get()[0]._actor.cleaned_up
    assert len(backend_state._replicas[tag].get()) == 1
    assert len(
        backend_state._replicas[tag].get(states=[ReplicaState.STOPPING])) == 1

    // Advance the timer, now the replica should be force stopped.
    timer.advance(grace_period_s + 0.1)
    backend_state.update()
    assert backend_state._replicas[tag].get()[
        0]._actor.force_stopped_counter == 1
    assert not backend_state._replicas[tag].get()[0]._actor.cleaned_up
    assert len(backend_state._replicas[tag].get()) == 1
    assert len(
        backend_state._replicas[tag].get(states=[ReplicaState.STOPPING])) == 1
    assert not goal_manager.check_complete(delete_goal)

    // Force stop should be called repeatedly until the replica stops.
    backend_state.update()
    assert backend_state._replicas[tag].get()[
        0]._actor.force_stopped_counter == 2
    assert not backend_state._replicas[tag].get()[0]._actor.cleaned_up
    assert len(backend_state._replicas[tag].get()) == 1
    assert len(
        backend_state._replicas[tag].get(states=[ReplicaState.STOPPING])) == 1
    assert not goal_manager.check_complete(delete_goal)

    // Once the replica is done stopping, it should be removed.
    replica = backend_state._replicas[tag].get()[0]
    replica._actor.set_done_stopping()
    backend_state.update()
    assert len(backend_state._replicas[tag].get()) == 0
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: ray-project/ray
Commit Name: 75dfae84e40d62124b3622da07f06ff1cc26d496
Time: 2021-03-19
Author: ed.nmi.oakes@gmail.com
File Name: python/ray/serve/tests/test_backend_state.py
Class Name:
Method Name: test_force_kill


Project Name: ray-project/ray
Commit Name: 75dfae84e40d62124b3622da07f06ff1cc26d496
Time: 2021-03-19
Author: ed.nmi.oakes@gmail.com
File Name: python/ray/serve/tests/test_backend_state.py
Class Name:
Method Name: test_create_delete_single_replica


Project Name: ray-project/ray
Commit Name: 75dfae84e40d62124b3622da07f06ff1cc26d496
Time: 2021-03-19
Author: ed.nmi.oakes@gmail.com
File Name: python/ray/serve/tests/test_backend_state.py
Class Name:
Method Name: test_force_kill


Project Name: ray-project/ray
Commit Name: 75dfae84e40d62124b3622da07f06ff1cc26d496
Time: 2021-03-19
Author: ed.nmi.oakes@gmail.com
File Name: python/ray/serve/tests/test_backend_state.py
Class Name:
Method Name: test_deploy_new_config_new_version