Skip to content

Commit ee7067f

Browse files
committed
Fix error when trying to use a network_config argument with the run_applications method that is not a string.
1 parent 705c377 commit ee7067f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

simulaqron/run/run.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import os
33
from concurrent.futures import ProcessPoolExecutor as Pool
44
from importlib import reload
5+
from os import PathLike
6+
from pathlib import Path
57
from time import sleep
68
from typing import Callable, Optional, Any, Dict, List
79

@@ -140,11 +142,17 @@ def run_applications(
140142
app_instance.logging_cfg.comm_log_dir = timed_log_dir
141143

142144
results: List[Dict[str, Any]] = []
145+
if isinstance(network_cfg, str) or isinstance(network_cfg, PathLike):
146+
net_cfg = str(network_cfg)
147+
elif isinstance(network_cfg, Path):
148+
net_cfg = str(network_cfg.resolve())
149+
else:
150+
net_cfg = None
143151

144152
for _ in range(num_rounds):
145153
with Pool(len(app_names)) as executor:
146154
# Start the backend process
147-
network = run_sim_backend(app_names, sim_backend, network_cfg)
155+
network = run_sim_backend(app_names, sim_backend, net_cfg)
148156

149157
# Start the application processes
150158
app_futures = []

0 commit comments

Comments
 (0)