| 1595 | } |
| 1596 | |
| 1597 | Scheduler::AssignmentCtx::AssignmentCtx(const ExecutorGroup& executor_group, |
| 1598 | IntCounter* total_assignments, IntCounter* total_local_assignments, std::mt19937* rng) |
| 1599 | : executor_group_(executor_group), |
| 1600 | first_unused_executor_idx_(0), |
| 1601 | total_assignments_(total_assignments), |
| 1602 | total_local_assignments_(total_local_assignments) { |
| 1603 | DCHECK_GT(executor_group.NumExecutors(), 0); |
| 1604 | random_executor_order_ = executor_group.GetAllExecutorIps(); |
| 1605 | std::shuffle(random_executor_order_.begin(), random_executor_order_.end(), *rng); |
| 1606 | // Initialize inverted map for executor rank lookups |
| 1607 | int i = 0; |
| 1608 | for (const IpAddr& ip : random_executor_order_) random_executor_rank_[ip] = i++; |
| 1609 | } |
| 1610 | |
| 1611 | const IpAddr* Scheduler::AssignmentCtx::SelectExecutorFromCandidates( |
| 1612 | const std::vector<IpAddr>& data_locations, bool break_ties_by_rank) { |
nothing calls this directly
no test coverage detected