Skip to content

fix(simulation): let API-started runs exit naturally (--no-wait) - #784

Open
Xshunzi wants to merge 1 commit into
666ghj:mainfrom
Xshunzi:fix/no-wait-simulation-exit
Open

fix(simulation): let API-started runs exit naturally (--no-wait)#784
Xshunzi wants to merge 1 commit into
666ghj:mainfrom
Xshunzi:fix/no-wait-simulation-exit

Conversation

@Xshunzi

@Xshunzi Xshunzi commented Aug 20, 2026

Copy link
Copy Markdown

Summary

SimulationRunner.start_simulation spawns the platform scripts without --no-wait, so wait_for_commands stays True and the subprocess keeps the whole OASIS environment resident after the simulation finishes. API-started runs only end via an explicit POST /api/simulation/stop.

This PR adds --no-wait to the spawn command so processes exit naturally once the main loop completes.

Changes

  • backend/app/services/simulation_runner.py: append --no-wait to the spawned command.

Why it is safe

All three runners already support --no-wait:

  • run_twitter_simulation.py (wait_for_commands=not args.no_wait)
  • run_reddit_simulation.py (same)
  • run_parallel_simulation.py (same)

The flag only changes post-completion behavior (process exits instead of idling forever); simulation output is unchanged.

Related

Refs #779 (reported there as a separate defect from the six config fields).

Test plan

  • --help on each runner lists --no-wait.
  • Manual: start a simulation via the API, let it complete; the spawned process now exits and the monitor thread reaches its finalization block.

SimulationRunner spawns simulation scripts without --no-wait, so
wait_for_commands stays True and the process keeps the whole OASIS
environment resident after the simulation finishes. Only an explicit
POST /api/simulation/stop can end it.

Add --no-wait to the spawn command; all three runners
(twitter/reddit/parallel) support the flag and exit promptly after
the main loop completes.

Refs 666ghj#779
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant