Skip to content

Commit 4394654

Browse files
committed
minor bug fixed
1 parent df79400 commit 4394654

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/app/core/runtime/edge.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
waits the sampled delay (and any resource wait) before delivering the
77
message to the target node's inbox.
88
"""
9-
109
from collections.abc import Generator
10+
from typing import TYPE_CHECKING
1111

1212
import numpy as np
1313
import simpy
@@ -17,6 +17,10 @@
1717
from app.core.event_samplers.common_helpers import general_sampler
1818
from app.schemas.system_topology_schema.full_system_topology_schema import Edge
1919

20+
if TYPE_CHECKING:
21+
from app.schemas.random_variables_config import RVConfig
22+
23+
2024

2125
class EdgeRuntime:
2226
"""definining the logic to handle the edges during the simulation"""
@@ -37,16 +41,16 @@ def __init__(
3741

3842
def _deliver(self, state: RequestState) -> Generator[simpy.Event, None, None]:
3943
"""Function to deliver the state to the next node"""
40-
# assign a probability that the network will drop the request
41-
distribution = self.edge_config.latency.distribution
44+
# extract the random variables defining the latency of the edge
45+
random_variable: RVConfig = self.edge_config.latency
4246

4347
uniform_variable = self.rng.uniform()
4448
if uniform_variable < NetworkParameters.DROPOUT_RATE:
4549
state.finish_time = self.env.now
4650
state.record_hop(f"{self.edge_config.id}-dropped")
4751
return
4852

49-
transit_time = general_sampler(distribution, self.rng)
53+
transit_time = general_sampler(random_variable, self.rng)
5054
yield self.env.timeout(transit_time)
5155
state.record_hop(self.edge_config.id, self.env.now)
5256
self.target_box.put(state)

tests/unit/input_sructure/test_full_topology_input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
from app.config.constants import (
1818
EndpointStepCPU,
19-
StepOperation,
2019
ServerResourcesDefaults,
20+
StepOperation,
2121
SystemEdges,
2222
SystemNodes,
2323
)

0 commit comments

Comments
 (0)