Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 74 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ pydantic = {extras = ["email"], version = "^2.11.7"}
numpy = "^2.3.1"
simpy = "^4.1.1"
matplotlib = "^3.10.3"
pyyaml = "^6.0.2"

[tool.poetry.group.dev.dependencies]
pytest = "^8.4.1"
pytest-asyncio = "^1.0.0"
pytest-cov = "^6.2.1"
mypy = "^1.16.1"
ruff = "^0.12.1"
types-pyyaml = "^6.0.12.20250516"

[build-system]
requires = ["poetry-core"]
Expand Down
6 changes: 4 additions & 2 deletions src/app/metrics/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,11 @@ def get_latency_stats(self) -> dict[LatencyKey, float]:
return self.latency_stats or {}

def get_throughput_series(self) -> tuple[list[float], list[float]]:
"""Return throughput time series (timestamps, RPS)."""
"""Return (timestamps, RPS). Empty lists when no traffic."""
self.process_all_metrics()
assert self.throughput_series is not None
if self.throughput_series is None:
return [], []

return self.throughput_series

def get_sampled_metrics(self) -> dict[str, dict[str, list[float]]]:
Expand Down
2 changes: 1 addition & 1 deletion src/app/runtime/actors/rqs_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(
self,
*,
env: simpy.Environment,
out_edge: EdgeRuntime,
out_edge: EdgeRuntime | None,
rqs_generator_data: RqsGeneratorInput,
sim_settings: SimulationSettings,
rng: np.random.Generator | None = None,
Expand Down
22 changes: 17 additions & 5 deletions src/app/runtime/actors/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,30 @@
class ServerRuntime:
"""class to define the server during the simulation"""

def __init__( # noqa: PLR0913
def __init__( # noqa: PLR0913
self,
*,
env: simpy.Environment,
server_resources: ServerContainers,
server_config: Server,
out_edge: EdgeRuntime,
out_edge: EdgeRuntime | None,
server_box: simpy.Store,
settings: SimulationSettings,
rng: np.random.Generator | None = None,
) -> None:
"""Docstring to complete"""
) -> None:
"""
Definition of the instance attributes
Args:
env (simpy.Environment): simpy environment
server_resources (ServerContainers):resource defined in the
input for each server
server_config (Server): parameter to define the server from the input
out_edge (EdgeRuntime): edge connecting the server to the next node
server_box (simpy.Store): box with the states that the server
should elaborate
settings (SimulationSettings): general input settings for the simulation
rng (np.random.Generator | None, optional): random number generator.
"""
self.env = env
self.server_resources = server_resources
self.server_config = server_config
Expand Down Expand Up @@ -231,6 +243,7 @@ def _handle_request( # noqa: PLR0915, PLR0912, C901
self._ram_in_use -= total_ram
yield self.server_resources[ServerResourceName.RAM.value].put(total_ram)

assert self.out_edge is not None
self.out_edge.transport(state)


Expand Down Expand Up @@ -263,7 +276,6 @@ def _dispatcher(self) -> Generator[simpy.Event, None, None]:
The main dispatcher loop. It pulls requests from the inbox and
spawns a new '_handle_request' process for each one.
"""
assert self.out_edge is not None
while True:
# Wait for a request to arrive in the server's inbox
raw_state = yield self.server_box.get()
Expand Down
Loading