Fix DataAnalyzer.run_map crashing when specific_threads is set (#8758)
`DataAnalyzer.run_map` fills the process list in the order of
`threads_to_run` but starts and joins with `p[thread]`, so
`specific_threads` only works when it is `[0, 1, ..., k]`. Anything
else, like `[2, 3]` to rerun two failed threads, raises `IndexError:
list index out of range`.
Fix: start the process that was just appended (`p[-1]`) and join over
`p` directly. Two lines.
Test: `test_data_analyzer_runs_only_the_specific_threads` runs `run_map`
with `num_threads=4, specific_threads=[2, 3]` and checks that only
`worker0_thread2` and `worker0_thread3` are written, holding samples 10
to 14 and 15 to 19. It fails on master with the IndexError and passes
with the fix. `pytest tests/unit/runtime/test_data_efficiency.py`: 15
passed, 2 skipped (the two-GPU curriculum tests). Run on an M-series
Mac, CPU only, torch 2.14.0. pre-commit passes on both changed files.
This doesn't touch the `len(data)` sample counting in the same file,
which #8505 already covers.
Fixes #8757
Signed-off-by: rakshit-gen <sisodiarakshit456@gmail.com>
Co-authored-by: Olatunji Ruwase <tunji.ruwase@snowflake.com>