@@ -461,77 +461,72 @@ class MinMaxResourceUsageBoundsTestCase:
461
461
min_size : int
462
462
max_size : int
463
463
obj_store_mem_max_pending_output_per_task : int
464
- max_tasks_in_flight : int
465
464
expected_min_resource_usage_bound : ExecutionResources
466
465
expected_max_resource_usage_bound : ExecutionResources
467
- num_gpus : int = 0
466
+ max_tasks_in_flight : int = 4
467
+ max_concurrency : int = 1
468
468
469
469
470
470
@pytest .mark .parametrize (
471
471
"case" ,
472
472
[
473
- # Fixed-size CPU pool.
473
+ # Fixed-size pool.
474
474
MinMaxResourceUsageBoundsTestCase (
475
475
min_size = 2 ,
476
476
max_size = 2 ,
477
477
obj_store_mem_max_pending_output_per_task = 1 ,
478
- max_tasks_in_flight = 4 ,
479
478
expected_min_resource_usage_bound = ExecutionResources (
480
- cpu = 2 , object_store_memory = 1
479
+ cpu = 2 , object_store_memory = 2
481
480
),
482
481
expected_max_resource_usage_bound = ExecutionResources (
483
- cpu = 2 , object_store_memory = 2 * 4
482
+ cpu = 2 , object_store_memory = 2
484
483
),
485
484
),
486
- # Fixed-size GPU pool.
485
+ # Autoscaling pool.
487
486
MinMaxResourceUsageBoundsTestCase (
488
- min_size = 2 ,
487
+ min_size = 1 ,
489
488
max_size = 2 ,
490
- num_gpus = 1 ,
491
- max_tasks_in_flight = 4 ,
492
489
obj_store_mem_max_pending_output_per_task = 1 ,
493
- # Unlike CPU pools, we should reserve enough object store memory so that
494
- # all actors can launch a task.
495
490
expected_min_resource_usage_bound = ExecutionResources (
496
- cpu = 2 , gpu = 2 , object_store_memory = 2
491
+ cpu = 1 , object_store_memory = 1
497
492
),
498
493
expected_max_resource_usage_bound = ExecutionResources (
499
- cpu = 2 , gpu = 2 , object_store_memory = 2 * 4
494
+ cpu = 2 , object_store_memory = 2
500
495
),
501
496
),
502
- # Autoscaling CPU pool.
497
+ # Unbounded pool.
503
498
MinMaxResourceUsageBoundsTestCase (
504
499
min_size = 1 ,
505
- max_size = 2 ,
506
- max_tasks_in_flight = 4 ,
500
+ max_size = None ,
507
501
obj_store_mem_max_pending_output_per_task = 1 ,
508
502
expected_min_resource_usage_bound = ExecutionResources (
509
503
cpu = 1 , object_store_memory = 1
510
504
),
511
- expected_max_resource_usage_bound = ExecutionResources (
512
- cpu = 2 , object_store_memory = 2 * 4
513
- ),
505
+ expected_max_resource_usage_bound = ExecutionResources .for_limits (),
514
506
),
515
- # Unbounded CPU pool.
507
+ # Multi-threaded pool.
516
508
MinMaxResourceUsageBoundsTestCase (
517
509
min_size = 1 ,
518
- max_size = None ,
519
- max_tasks_in_flight = 4 ,
510
+ max_size = 1 ,
520
511
obj_store_mem_max_pending_output_per_task = 1 ,
512
+ max_concurrency = 2 ,
513
+ max_tasks_in_flight = 4 ,
521
514
expected_min_resource_usage_bound = ExecutionResources (
522
515
cpu = 1 , object_store_memory = 1
523
516
),
524
- expected_max_resource_usage_bound = ExecutionResources .for_limits (),
517
+ expected_max_resource_usage_bound = ExecutionResources (
518
+ cpu = 1 , object_store_memory = 1 * 2
519
+ ),
525
520
),
526
521
],
527
522
ids = [
528
- "fixed-size-cpu- pool" ,
529
- "fixed-size-gpu -pool" ,
530
- "autoscaling-cpu -pool" ,
531
- "unbounded-cpu -pool" ,
523
+ "fixed-size-pool" ,
524
+ "autoscaling -pool" ,
525
+ "unbounded -pool" ,
526
+ "multi-threaded -pool" ,
532
527
],
533
528
)
534
- def test_min_max_resource_usage_bounds (
529
+ def test_min_max_resource_requirements (
535
530
case , ray_start_regular_shared , restore_data_context
536
531
):
537
532
data_context = ray .data .DataContext .get_current ()
@@ -545,7 +540,10 @@ def test_min_max_resource_usage_bounds(
545
540
max_size = case .max_size ,
546
541
max_tasks_in_flight_per_actor = case .max_tasks_in_flight ,
547
542
),
548
- ray_remote_args = {"num_cpus" : 1 , "num_gpus" : case .num_gpus },
543
+ ray_remote_args = {
544
+ "num_cpus" : 1 ,
545
+ "max_concurrency" : case .max_concurrency ,
546
+ },
549
547
)
550
548
op ._metrics = MagicMock (
551
549
obj_store_mem_max_pending_output_per_task = case .obj_store_mem_max_pending_output_per_task
@@ -554,10 +552,12 @@ def test_min_max_resource_usage_bounds(
554
552
(
555
553
min_resource_usage_bound ,
556
554
max_resource_usage_bound ,
557
- ) = op .min_max_resource_usage_bounds ()
555
+ ) = op .min_max_resource_requirements ()
558
556
559
- assert min_resource_usage_bound == case .expected_min_resource_usage_bound
560
- assert max_resource_usage_bound == case .expected_max_resource_usage_bound
557
+ assert (
558
+ min_resource_usage_bound == case .expected_min_resource_usage_bound
559
+ and max_resource_usage_bound == case .expected_max_resource_usage_bound
560
+ )
561
561
562
562
563
563
def test_start_actor_timeout (ray_start_regular_shared , restore_data_context ):
0 commit comments