diff --git a/smarts/core/agent_manager.py b/smarts/core/agent_manager.py index 167fc45f9c..8cd07b3116 100644 --- a/smarts/core/agent_manager.py +++ b/smarts/core/agent_manager.py @@ -200,7 +200,6 @@ def observe( } sim_frame = sim.cached_frame - print(f"{self.active_agents=}-{sim_frame.agent_ids=}") for agent_id in self.active_agents: # An agent may be pointing to its own vehicle or observing a social vehicle vehicle_ids = self._vehicle_index.vehicle_ids_by_actor_id( diff --git a/smarts/core/sensors.py b/smarts/core/sensors.py index 47b87306d4..f8cc211796 100644 --- a/smarts/core/sensors.py +++ b/smarts/core/sensors.py @@ -365,7 +365,7 @@ def observe_parallel( ) used_workers: List[SensorsWorker] = [] with timeit( - f"parallizable observations with {len(agent_ids)=} and {len(workers)=}", + f"parallizable observations with {len(agent_ids)} and {len(workers)}", print, ): if len(workers) >= 1: diff --git a/smarts/core/tests/test_parallel_sensors.py b/smarts/core/tests/test_parallel_sensors.py index d2f6a2d48f..fc39a14153 100644 --- a/smarts/core/tests/test_parallel_sensors.py +++ b/smarts/core/tests/test_parallel_sensors.py @@ -30,7 +30,7 @@ from smarts.core.plan import Mission from smarts.core.road_map import RoadMap from smarts.core.scenario import Scenario -from smarts.core.sensors import Observation, Sensors, SensorState, SensorsWorker +from smarts.core.sensors import Observation, Sensors, SensorState, SensorsWorker, WorkerKwargs from smarts.core.simulation_frame import SimulationFrame from smarts.core.simulation_local_constants import SimulationLocalConstants from smarts.core.smarts import SMARTS @@ -152,24 +152,26 @@ def observe_with_processes(processes): serial_total > parallel_1_total or serial_total > parallel_2_total or serial_total > parallel_3_total - ), f"{serial_total=}, {parallel_1_total=}, {parallel_2_total=}, {parallel_3_total=} {parallel_4_total=}" + ), f"{serial_total}, {parallel_1_total}, {parallel_2_total}, {parallel_3_total} {parallel_4_total}" def test_sensor_worker( - simulation_frame: SimulationState, + sim: SMARTS, ): - return + del sim.cached_frame + simulation_frame: SimulationFrame = sim.cached_frame agent_ids = set(AGENT_IDS) worker = SensorsWorker() - worker.run() - worker.send_to_process(simulation_frame, agent_ids) - observations, dones = SensorsWorker.local(simulation_frame, agent_ids) - other_observations, other_dones = worker.result(block=True) + worker.run(sim_local_constants=sim.local_constants) + worker_args = WorkerKwargs(sim_frame=simulation_frame) + worker.send_to_process(worker_args=worker_args, agent_ids=agent_ids) + observations, dones = SensorsWorker.local(simulation_frame, sim.local_constants, agent_ids) + other_observations, other_dones = worker.result(block=True, timeout=5) assert isinstance(observations, dict) assert all( [isinstance(obs, Observation) for obs in observations.values()] - ), f"{observations=}" + ), f"{observations}" assert isinstance(dones, dict) assert all([isinstance(obs, bool) for obs in dones.values()]) assert isinstance(other_observations, dict)