Commit fe223e29 authored by Hejing Li's avatar Hejing Li
Browse files

some error fixes

parent eb611e2c
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
from __future__ import annotations from __future__ import annotations
import abc import abc
import itertools
import time import time
import typing as tp import typing as tp
import simbricks.orchestration.system as sys_conf import simbricks.orchestration.system as sys_conf
...@@ -51,7 +52,7 @@ class Simulator(utils_base.IdObj): ...@@ -51,7 +52,7 @@ class Simulator(utils_base.IdObj):
self.extra_deps: list[Simulator] = [] self.extra_deps: list[Simulator] = []
self.name: str = "" self.name: str = ""
self.experiment: sim_base.Simulation = simulation self.experiment: sim_base.Simulation = simulation
self._components: set[sys_conf.Component] = [] self._components: set[sys_conf.Component] = set()
self._relative_executable_path: str = relative_executable_path self._relative_executable_path: str = relative_executable_path
@staticmethod @staticmethod
...@@ -311,8 +312,6 @@ class Simulation(utils_base.IdObj): ...@@ -311,8 +312,6 @@ class Simulation(utils_base.IdObj):
def all_simulators(self) -> tp.Iterable[Simulator]: def all_simulators(self) -> tp.Iterable[Simulator]:
"""Returns all simulators defined to run in this experiment.""" """Returns all simulators defined to run in this experiment."""
# TODO: FIXME
raise Exception("needs fixed implementation")
return itertools.chain( return itertools.chain(
self.hosts, self.pcidevs, self.memdevs, self.netmems, self.networks self.hosts, self.pcidevs, self.memdevs, self.netmems, self.networks
) )
......
...@@ -37,7 +37,7 @@ class HostSim(sim_base.Simulator): ...@@ -37,7 +37,7 @@ class HostSim(sim_base.Simulator):
def __init__(self, e: sim_base.Simulation): def __init__(self, e: sim_base.Simulation):
super().__init__(e) super().__init__(e)
self.hosts: tp.List['Host'] self.hosts: tp.List['Host'] = []
self.wait = True self.wait = True
def full_name(self) -> str: def full_name(self) -> str:
...@@ -54,7 +54,7 @@ class HostSim(sim_base.Simulator): ...@@ -54,7 +54,7 @@ class HostSim(sim_base.Simulator):
def add(self, host: 'Host'): def add(self, host: 'Host'):
self.hosts.append(host) self.hosts.append(host)
self.name = f'{self.hosts.id}' self.name = f'{self._id}'
self.experiment.add_host(self) self.experiment.add_host(self)
self.experiment.sys_sim_map[host] = self self.experiment.sys_sim_map[host] = self
......
...@@ -59,14 +59,15 @@ class NICSim(PCIDevSim): ...@@ -59,14 +59,15 @@ class NICSim(PCIDevSim):
def __init__(self, e: base.Simulation) -> None: def __init__(self, e: base.Simulation) -> None:
super().__init__(e) super().__init__(e)
self.experiment = e self.experiment = e
self.nics: tp.List[PCIDevSim] = [] self.nics: tp.List[sys_conf.SimplePCIeNIC] = []
self.start_tick = 0 self.start_tick = 0
def add(self, nic: PCIDevSim): def add(self, nic: sys_conf.SimplePCIeNIC):
self.nics.append(nic) self.nics.append(nic)
# nic.sim = self # nic.sim = self
self.experiment.add_nic(self) self.experiment.add_nic(self)
self.name = f'{nic.id}' self.experiment.sys_sim_map[nic] = self
self.name = f'{nic._id}'
def basic_args(self, env: ExpEnv, extra: tp.Optional[str] = None) -> str: def basic_args(self, env: ExpEnv, extra: tp.Optional[str] = None) -> str:
cmd = ( cmd = (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment