Skip to content

fog_volumes: refuse a --jobs below 1 instead of silently scanning single-threaded (EGEN-FOGVOL-JOBS) - #6321

Open
evilclanker9000 wants to merge 2 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/3-fogvol-jobs
Open

evilclanker9000 wants to merge 2 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/3-fogvol-jobs

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

tools/fog_volumes.py --jobs 0 (or --jobs -4) was accepted and silently ran with one worker:
summarize(a.path, jobs=max(1, a.jobs)) at tools/fog_volumes.py:425 clamped the count with no
diagnostic, so a run that asked for parallelism got none and exited 0. The sibling tools refuse a
non-positive --jobs (tools/awc_shorts.py:100 prints error: --jobs must be at least 1 and exits 2),
and the other argument guards in this tool already report a usage error through ap.error.

The tool now refuses a --jobs below 1 with --jobs must be at least 1: <n> and exit status 2, and
its --help text states the range.

Test

Synthetic 64-byte input, standard library only, no game files, no GPU:

python -I tests\test_fog_volumes.py

Before the change (AssertionError: SystemExit not raised on the new assertion):

F....
FAIL: test_cli_validation_guards
AssertionError: SystemExit not raised
Ran 5 tests in 0.106s
FAILED (failures=1)

After:

test_fog_volumes.py: error: --jobs must be at least 1: -4
.....
Ran 5 tests in 0.519s
OK

python -m compileall -q tools/fog_volumes.py tests/test_fog_volumes.py is clean, and
python -I tools/fog_volumes.py --help now prints worker processes for RPF9 scanning (at least 1).

GPU and driver

No GPU needed; CPU-only argument handling.

Notes

  • The clamp in _scan_rpf_offsets (max(1, jobs)) is left in place: summarize() and
    iter_fog_resources() are also called from code with their own jobs argument, and the new guard
    only covers the command line.
  • --jobs 0 could have been read as "auto", but the default already picks
    min(16, os.cpu_count() or 4), and a silent single-threaded run is the behaviour the other tools in
    tools/ reject, so this follows them instead.

AI-assisted.

…gle-threaded

max(1, a.jobs) turned --jobs 0 and --jobs -4 into one worker with no diagnostic, while awc_shorts and the other worker-count tools reject a non-positive count. Report it as a usage error, the way the other argument guards in this tool do.
Red on the tree before the guard: AssertionError: SystemExit not raised (Ran 5 tests, FAILED failures=1); green after it (Ran 5 tests, OK). Synthetic 64-byte input, no game files.
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