Skip to content

Ctrl-C generation menu: apply event and thread count changes promptly - #534

Open
theoheimel wants to merge 2 commits into
mainfrom
fix-ctrl-c-interactive
Open

theoheimel wants to merge 2 commits into
mainfrom
fix-ctrl-c-interactive

Conversation

@theoheimel

Copy link
Copy Markdown
Contributor

Fixes two issues of the Ctrl-C menu during event generation, plus review follow-ups.

Changes

Changing the number of events took effect much later or never. The new target was only applied between rounds, and a round of a large target kept dispatching batches sized for the old one. Now, once a target change is pending, the batches not dispatched yet are dropped (EventGenerator::drop_ready_jobs, which also resets the per-channel flags so channels get new batches next round). The round ends once the jobs in flight commit, and the new target applies. A changed target breaks reproducibility either way; re-entering the current value drops nothing.

Changing the number of CPU threads stays reproducible. Instead of dropping batches, the dispatch pauses until no job is in flight, the thread pools are resized, and the round resumes from its unchanged queue. Job ids, seeds and commit order are the same as without the change. Thread changes now also apply during optimize() / fix_max_weights().

Log lines no longer break the interactive display. The C++ "requested events changed" / "CPU thread count set" messages are only printed with Verbosity::log. In Python, GenerationControl logs the change except from the menu in pretty mode (the menu shows it). Commands from <run dir>/control are still logged, and the progress boxes are redrawn below them.

Testing

  • Driving EventGenerator with a real SIGINT whose handler calls set_target_count / set_thread_count (3-channel e+e- -> d d~ g setup of the madspace tests):
    • 20M -> 50k: stops right after the batches in flight (~370k events at the change), keeps exactly 50k
    • 1M -> 3M: reaches exactly 3M, no channel stuck
    • thread change 4 -> 2 and 4 -> 8 mid-run: combined events identical to the run without a change
  • GenerationControl with a stub generator: control-file changes logged and redrawn in pretty mode, menu changes silent
  • madspace/tests: test_weighting_steps, test_survey_job_failure, test_event_stream, test_flavor_switch_step (36 passed)
  • Not tested: a full interactive launch with the menu

🤖 Generated with Claude Code

theoheimel and others added 2 commits November 23, 2026 13:34
Changing the requested events from the generation menu only took effect
after the current round of batches, which for large targets came much
later or never. The batches not dispatched yet are now dropped, so the
round ends once the jobs in flight commit and the new target applies.

A thread count change instead pauses the dispatch until no job is in
flight, applies the new count and resumes the round from its queue, so
the events stay identical to a run without the change.

The "requested events" and "CPU thread count" messages are only logged
in log mode; in pretty mode they broke the progress boxes and the menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…anged target

Review follow-up. In pretty mode, nevents/nb_core from <run dir>/control
were applied silently, as only the menu shows the changes: they are
logged again outside the menu, and the progress boxes redrawn below.

Re-entering the current number of events no longer drops the batches
not dispatched yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

How CI reacts to this PR

  • Not a draft: the full CI runs automatically when the PR is opened and on every push.
  • Draft: only the unittest and IOtest workflows run. Mark the PR "Ready for review" to start the full CI.
  • run-ci label: while this label is on the PR, every job keeps running after a failure, so you see all failures. Without it, the first failing job cancels the other runs of that commit.
  • Closing or merging: the unfinished CI runs of this PR are cancelled. A merge gets its own run on main.
  • Pushes to main: the full CI runs after each merge.
  • Other branches: run CI only through workflow_dispatch.
  • Forks: the runs use a read-only token, so they cannot cancel each other.
  • Merge: a green CI and one approval are required to merge.

This branch has not been deployed

No deployments
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