Commit 0801048
authored
linux: follow up on cpulist parsing (#2973)
`_get_eligible_cpus()` was only parsing a single `N-M` range, so a value
like `0-3,8` would fall back to all CPUs instead of returning the actual
eligible CPU list.
This adds `_parse_cpulist()` returning the expanded CPU IDs and uses it
in `_get_eligible_cpus()`.
For example:
`0-3,8` -> `[0, 1, 2, 3, 8]`
Also added parser coverage and a regression test for the non-contiguous
`Cpus_allowed_list` case.
Tested with:
* `tests/test_linux.py`: 131 passed, 4 skipped
* Ruff
* Black
* `git diff --check`1 parent 10325a9 commit 0801048
2 files changed
Lines changed: 45 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
496 | 519 | | |
497 | 520 | | |
498 | 521 | | |
| |||
2117 | 2140 | | |
2118 | 2141 | | |
2119 | 2142 | | |
2120 | | - | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
2121 | 2147 | | |
2122 | 2148 | | |
2123 | 2149 | | |
2124 | | - | |
2125 | | - | |
2126 | | - | |
2127 | | - | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
2128 | 2158 | | |
2129 | 2159 | | |
2130 | 2160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
2507 | 2508 | | |
2508 | 2509 | | |
2509 | 2510 | | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + | |
| 2514 | + | |
| 2515 | + | |
| 2516 | + | |
2510 | 2517 | | |
2511 | 2518 | | |
2512 | 2519 | | |
| |||
2620 | 2627 | | |
2621 | 2628 | | |
2622 | 2629 | | |
2623 | | - | |
2624 | | - | |
2625 | | - | |
2626 | | - | |
2627 | | - | |
| 2630 | + | |
| 2631 | + | |
| 2632 | + | |
2628 | 2633 | | |
2629 | 2634 | | |
2630 | 2635 | | |
| |||
0 commit comments