-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for autoscaler and its desired state (#2601)
* Add test for autoscaler and its desired state Signed-off-by: hjiang <[email protected]> * resolve linter issues Signed-off-by: hjiang <[email protected]> * simplify python list Signed-off-by: hjiang <[email protected]> * cleanup one wait group Signed-off-by: hjiang <[email protected]> * use scale down window Signed-off-by: hjiang <[email protected]> * prefer HaveLen Signed-off-by: hjiang <[email protected]> * fix replica count Signed-off-by: hjiang <[email protected]> --------- Signed-off-by: hjiang <[email protected]>
- Loading branch information
Showing
3 changed files
with
83 additions
and
5 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
ray-operator/test/e2eautoscaler/create_concurrent_tasks.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""This script create a number of tasks at roughly the same time, and wait for their completion.""" | ||
|
||
import ray | ||
import time | ||
import random | ||
|
||
# The task number should be large enough, so the autoscalar is triggered to scale to max replica. | ||
_TASK_NUM = 30 | ||
# The min task duration should be long enough, which passes the autoscaling stage of the test. | ||
_TASK_MIN_DUR_SEC = 5 | ||
# The max task duration should be reasonable to have a cap on overal test duration. | ||
_TASK_MAX_DUR_SEC = 10 | ||
|
||
@ray.remote(num_cpus=1) | ||
def f(): | ||
sleep_time_sec = random.randint(_TASK_MIN_DUR_SEC, _TASK_MAX_DUR_SEC) | ||
time.sleep(sleep_time_sec) | ||
|
||
ray.get([f.remote() for _ in range(_TASK_NUM)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters