[Serve] remove constants shorthands in tests (#24053)

This commit is contained in:
iasoon 2022-04-21 01:05:19 +02:00 committed by GitHub
parent 47243ace7c
commit 22a6fafbb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -144,15 +144,8 @@ def test_replica_startup_status_transitions(ray_cluster):
wait_for_condition(lambda: len(get_replicas(ReplicaState.STARTING)) > 0)
replica = get_replicas(ReplicaState.STARTING)[0]
# FIXME: We switched our code formatter from YAPF to Black. Check whether we still
# need shorthands and update the comment below. See issue #21318.
# declare shorthands as yapf doesn't like long lambdas
PENDING_ALLOCATION = ReplicaStartupStatus.PENDING_ALLOCATION
PENDING_INITIALIZATION = ReplicaStartupStatus.PENDING_INITIALIZATION
SUCCEEDED = ReplicaStartupStatus.SUCCEEDED
# currently there are no resources to allocate the replica
assert replica.check_started() == PENDING_ALLOCATION
assert replica.check_started() == ReplicaStartupStatus.PENDING_ALLOCATION
# add the necessary resources to allocate the replica
cluster.add_node(num_cpus=4)
@ -162,13 +155,15 @@ def test_replica_startup_status_transitions(ray_cluster):
def is_replica_pending_initialization():
status = replica.check_started()
print(status)
return status == PENDING_INITIALIZATION
return status == ReplicaStartupStatus.PENDING_INITIALIZATION
wait_for_condition(is_replica_pending_initialization, timeout=25)
# send signal to complete replica intialization
signal.send.remote()
wait_for_condition(lambda: replica.check_started() == SUCCEEDED)
wait_for_condition(
lambda: replica.check_started() == ReplicaStartupStatus.SUCCEEDED
)
def test_intelligent_scale_down(ray_cluster):