Skip to content

Commit eb03706

Browse files
committed
combine constanct and poisson Profile creation
1 parent d8469cb commit eb03706

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/guidellm/executor/profile_generator.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
"SweepProfileGenerator",
1717
]
1818

19+
RateTypeLoadGenModeMap = {
20+
"constant": LoadGenerationModes.CONSTANT,
21+
"poisson": LoadGenerationModes.POISSON,
22+
}
1923

2024
class ProfileGenerationModes(Enum):
2125
FIXED = "fixed_rate"
@@ -79,19 +83,15 @@ def next_profile(
7983
current_rate = self._rates[self._rate_index]
8084
self._rate_index += 1
8185

82-
if self._rate_type == "constant":
83-
return Profile(
84-
load_gen_mode=LoadGenerationModes.CONSTANT, load_gen_rate=current_rate
85-
)
86-
8786
if self._rate_type == "synchronous":
8887
return Profile(
8988
load_gen_mode=LoadGenerationModes.SYNCHRONOUS, load_gen_rate=None
9089
)
91-
92-
if self._rate_type == "poisson":
90+
91+
if self._rate_type in {"constant", "poisson"}:
92+
load_gen_mode = RateTypeLoadGenModeMap[self._rate_type]
9393
return Profile(
94-
load_gen_mode=LoadGenerationModes.POISSON, load_gen_rate=current_rate
94+
load_gen_mode=load_gen_mode, load_gen_rate=current_rate
9595
)
9696

9797
raise ValueError(f"Invalid rate type: {self._rate_type}")

0 commit comments

Comments
 (0)