Skip to content

Commit

Permalink
Fix unit test of dispatch scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
s5u13b committed Oct 21, 2024
1 parent 6f7e433 commit e9ed0cf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/unit_test/global_scheduler/test_dispatch_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def test_add_instance_and_remove_instance(dispatch_scheduler):

dispatch_scheduler.remove_instance('instance_2')
assert dispatch_scheduler.num_instances == 1
assert len(dispatch_scheduler.available_dispatch_instance_set) == 1
if dispatch_scheduler.num_dispatch_instances >= 2:
assert len(dispatch_scheduler.available_dispatch_instance_set) == 1
else:
assert len(dispatch_scheduler.available_dispatch_instance_set) == 0
dispatch_scheduler.remove_instance('instance_3')
assert dispatch_scheduler.num_instances == 0

Expand Down Expand Up @@ -99,7 +102,7 @@ def test_dispatch_queue():
instance_info.instance_id = instance_id
instance_info.num_waiting_requests = random.randint(1, 10)
instance_info_dict[instance_id] = instance_info
if len(dispatch_scheduler.available_dispatch_instance_set) < dispatch_scheduler.num_dispatch_instances:
if len(dispatch_scheduler.available_dispatch_instance_set) < dispatch_scheduler.num_dispatch_instances:
dispatch_scheduler.available_dispatch_instance_set.add(instance_id)
instance_num_requests[instance_id] = 0
dispatch_scheduler.instance_num_requests = instance_num_requests
Expand Down

0 comments on commit e9ed0cf

Please sign in to comment.