Skip to content

Commit 41e3895

Browse files
committed
latest updates and working state
1 parent c7f6dc3 commit 41e3895

File tree

16 files changed

+1236
-746
lines changed

16 files changed

+1236
-746
lines changed

src/guidellm/__main__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@
3232

3333
import click
3434

35+
try:
36+
import uvloop
37+
38+
HAS_UVLOOP: Annotated[
39+
bool, "Flag indicating if uvloop is available for event loop optimization"
40+
] = True
41+
except ImportError:
42+
uvloop = None
43+
44+
HAS_UVLOOP: Annotated[
45+
bool, "Flag indicating if uvloop is available for event loop optimization"
46+
] = False
47+
3548
from guidellm.backend import BackendType
3649
from guidellm.benchmark import (
3750
GenerativeConsoleBenchmarkerProgress,
@@ -401,6 +414,8 @@ def run(
401414
Supports multiple backends, data sources, output formats, and constraint types
402415
for flexible benchmark configuration.
403416
"""
417+
if HAS_UVLOOP:
418+
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
404419
asyncio.run(
405420
benchmark_generative_text(
406421
target=target,

src/guidellm/benchmark/progress.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,11 @@ def start(self, strategy: SchedulingStrategy):
802802
def update(
803803
self, aggregator_update: AggregatorState, scheduler_state: SchedulerState
804804
):
805-
self.progress = scheduler_state.remaining_fraction
805+
self.progress = (
806+
(1.0 - scheduler_state.remaining_fraction)
807+
if scheduler_state.remaining_fraction is not None
808+
else 0.0
809+
)
806810
status: Literal["in_warmup", "in_progress", "in_cooldown"] | None = (
807811
"in_progress" # Need to handle requests_in_* isn't in aggregator_update
808812
)

src/guidellm/scheduler/constraints.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,8 @@ def __call__(
456456

457457
create_exceeded = state.created_requests >= max_num
458458
processed_exceeded = state.processed_requests >= max_num
459-
remaining_fraction = min(
460-
max(0.0, 1.0 - state.processed_requests / float(max_num)), 1.0
461-
)
462-
remaining_requests = max(0, max_num - state.processed_requests)
459+
remaining_requests = min(max(0, max_num - state.processed_requests), max_num)
460+
remaining_fraction = remaining_requests / float(max_num)
463461

464462
return SchedulerUpdateAction(
465463
request_queuing="stop" if create_exceeded else "continue",
@@ -577,6 +575,8 @@ def __call__(
577575
current_time = time.time()
578576
elapsed = current_time - state.start_time
579577
duration_exceeded = elapsed >= max_duration
578+
remaining_duration = min(max(0.0, max_duration - elapsed), max_duration)
579+
remaining_fraction = remaining_duration / float(max_duration)
580580

581581
return SchedulerUpdateAction(
582582
request_queuing="stop" if duration_exceeded else "continue",
@@ -589,8 +589,8 @@ def __call__(
589589
"current_time": current_time,
590590
},
591591
progress=SchedulerUpdateActionProgress(
592-
remaining_fraction=max(0.0, 1.0 - elapsed / float(max_duration)),
593-
remaining_duration=max(0.0, max_duration - elapsed),
592+
remaining_fraction=remaining_fraction,
593+
remaining_duration=remaining_duration,
594594
),
595595
)
596596

src/guidellm/scheduler/objects.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def __pydantic_schema_base_type__(cls) -> type[MeasuredRequestTimings]:
122122
schema_discriminator: ClassVar[str] = "timings_type"
123123

124124
timings_type: Literal["measured_request_timings"] = Field(
125+
default="measured_request_timings",
125126
description="Type identifier for the timing measurement",
126127
)
127128
request_start: float | None = Field(
@@ -414,7 +415,7 @@ class SchedulerState(StandardBaseModel):
414415
)
415416
end_processing_constraints: dict[str, SchedulerUpdateAction] = Field(
416417
default_factory=dict,
417-
description="Constraints that triggered processing termination",
418+
description="Constraints that triggered process ing termination",
418419
)
419420
scheduler_constraints: dict[str, SchedulerUpdateAction] = Field(
420421
default_factory=dict,
@@ -429,7 +430,7 @@ class SchedulerState(StandardBaseModel):
429430
"Estimated fraction for the remaining progress of the run, if known"
430431
),
431432
)
432-
remaining_requests: int | None = Field(
433+
remaining_requests: float | None = Field(
433434
default=None,
434435
description="Estimated number of requests remaining to be processed, if known",
435436
)
@@ -447,7 +448,8 @@ class SchedulerState(StandardBaseModel):
447448
default=0, description="Total number of requests queued for processing"
448449
)
449450
pending_requests: int = Field(
450-
default=0, description="Number of requests currently pending processing"
451+
default=0,
452+
description="Total number of requests pending processing within a worker",
451453
)
452454
processing_requests: int = Field(
453455
default=0, description="Number of requests currently being processed"

0 commit comments

Comments
 (0)