Add optional rich-based alternate dashboard
This commit is contained in:
@@ -95,6 +95,7 @@ def main() -> None:
|
||||
log_file = os.getenv("FISSION_LOG_FILE")
|
||||
configure_logging(log_level, log_file)
|
||||
realtime = os.getenv("FISSION_REALTIME", "0") == "1"
|
||||
alternate_dashboard = os.getenv("ALTERNATE_DASHBOARD", "0") == "1"
|
||||
duration_env = os.getenv("FISSION_SIM_DURATION")
|
||||
if duration_env:
|
||||
duration = None if duration_env.lower() in {"none", "infinite"} else float(duration_env)
|
||||
@@ -117,16 +118,31 @@ def main() -> None:
|
||||
if load_path:
|
||||
sim.start_state = reactor.load_state(load_path)
|
||||
if dashboard_mode:
|
||||
from .dashboard import ReactorDashboard
|
||||
if alternate_dashboard:
|
||||
try:
|
||||
from .rich_dashboard import RichDashboard
|
||||
except ImportError as exc: # pragma: no cover - optional dependency
|
||||
LOGGER.error("Rich dashboard requested but 'rich' is not installed: %s", exc)
|
||||
return
|
||||
dashboard = RichDashboard(
|
||||
reactor,
|
||||
start_state=sim.start_state,
|
||||
timestep=sim.timestep,
|
||||
save_path=save_path,
|
||||
)
|
||||
dashboard.run()
|
||||
return
|
||||
else:
|
||||
from .dashboard import ReactorDashboard
|
||||
|
||||
dashboard = ReactorDashboard(
|
||||
reactor,
|
||||
start_state=sim.start_state,
|
||||
timestep=sim.timestep,
|
||||
save_path=save_path,
|
||||
)
|
||||
dashboard.run()
|
||||
return
|
||||
dashboard = ReactorDashboard(
|
||||
reactor,
|
||||
start_state=sim.start_state,
|
||||
timestep=sim.timestep,
|
||||
save_path=save_path,
|
||||
)
|
||||
dashboard.run()
|
||||
return
|
||||
try:
|
||||
if realtime:
|
||||
LOGGER.info("Running in real-time mode (Ctrl+C to stop)...")
|
||||
|
||||
Reference in New Issue
Block a user