Skip to content

Commit

Permalink
fix pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeldaHuang committed Aug 28, 2024
1 parent 51924a1 commit 2089a31
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
3 changes: 1 addition & 2 deletions llumnix/backends/vllm/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ def output_len(self) -> int:
def inference_type(self) -> bool:
if self.is_prefill():
return RequestInferenceType.PREFILL
else:
return RequestInferenceType.DECODE
return RequestInferenceType.DECODE

# TODO(ZeldaHuang): adapt prefix cache and sliding window, now use v1 manager
class BlockManagerLlumnix(BlockSpaceManagerV1):
Expand Down
11 changes: 6 additions & 5 deletions llumnix/llumlet/local_migration_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import numpy as np
from typing import List, Optional
import numpy as np

from llumnix.llumlet.request import LlumnixRequest, RequestInferenceType
from llumnix.backends.backend_interface import BackendInterface

Expand All @@ -35,9 +36,9 @@ def get_migrate_out_request(self, min_request_len=0, max_request_len=np.inf) ->
def get_last_running_request(self, min_request_len, max_request_len):
running: List[LlumnixRequest] = self.backend_engine.get_running_queue()
for request in reversed(running):
if request.inference_type == RequestInferenceType.DECODE \
and min_request_len <= request.request_len <= max_request_len:
return request
if request.inference_type == RequestInferenceType.DECODE \
and min_request_len <= request.request_len <= max_request_len:
return request
return None
def get_longest_running_request(self, min_request_len, max_request_len):
running: List[LlumnixRequest] = self.backend_engine.get_running_queue()
Expand All @@ -55,4 +56,4 @@ def get_shortest_running_request(self, min_request_len, max_request_len):

shortest_seq_group = min((request for request in running if condition(request)), \
key=lambda request: request.request_len, default=None)
return shortest_seq_group
return shortest_seq_group
8 changes: 4 additions & 4 deletions llumnix/llumlet/migration_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ def migrate_out_multistage(self, migrate_in_ray_actor: "ray.actor.ActorHandle",
"""
state_count = 0
while state_count < self.max_stages:
state_count += 1
status = self.migrate_out_onestage(migrate_in_ray_actor, migrate_out_request)
if MigrationStatus.is_finished(status):
return status
state_count += 1
status = self.migrate_out_onestage(migrate_in_ray_actor, migrate_out_request)
if MigrationStatus.is_finished(status):
return status
# exceed max stages
return MigrationStatus.FINISHED_ABORTED

Expand Down
2 changes: 1 addition & 1 deletion llumnix/llumlet/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ def output_len(self) -> int:
def should_abort_migration(self) -> bool:
return self.output_len == 0 \
or (self.last_preemption_time and self.last_preemption_time > self.stage_timestamps[-1]) \
or self.inference_type == RequestInferenceType.PREFILL
or self.inference_type == RequestInferenceType.PREFILL

0 comments on commit 2089a31

Please sign in to comment.