cestercian opened a new pull request, #2617: URL: https://github.com/apache/datafusion-ballista/pull/2617
## Which issue does this PR close? - Closes #2600. ## Rationale for this change `bind_task_bias` and `bind_task_round_robin` copied the same scaffolding (all-zero early return, vcores sort, running job loop, graph lock, skip/blacklist handling, `bind_one` call). Only the executor pick was different, and the round robin version had a hand-rolled circular scan with a `scanned` counter nested pretty deep. ## What changes are included in this PR? - New private `bind_tasks_with(budgets, running_jobs, if_skip, strategy)` that owns all the shared parts. - A small `BindStrategy` enum (`Bias`, `RoundRobin`) with `pick` (which executor gets the next task) and `advance` (where the next search starts). Bias keeps packing the same executor and only moves forward, round robin moves to the next one and wraps. - `next_with_capacity(budgets, start)` for the circular scan. It returns `None` for an empty list or when everything is drained, so it no longer relies on the earlier all-zero check to avoid indexing an empty vec. - `bind_task_bias` and `bind_task_round_robin` keep their signatures and are now thin wrappers, so callers in `memory.rs` and `grpc.rs` are untouched. The skip log message keeps the same wording per strategy. ## Are these changes tested? Yes. The existing `test_bind_task_bias` / `test_bind_task_round_robin` tests still pass unchanged, and I added unit tests for `next_with_capacity` (empty, all zero, wraparound, single executor) and for the bias vs round robin `pick`/`advance` behaviour. ``` cargo test -p ballista-scheduler --lib cluster:: # 24 passed cargo clippy -p ballista-scheduler --all-targets -- -D warnings cargo fmt --all ``` ## Are there any user-facing changes? No, scheduling behaviour is the same. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
