-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Add PREPARED state for placement groups. (#46858)
Ray Placement Groups use 2pc protocol to reserve resources. However we don't track PREPARED state; we only had PENDING (before any prepare) and CREATED (after all committed). This means when the GCS restarts, it does not know any Commits ever happened. Indeed, it instructs all raylets to return all bundles prepared or committed. If the GCS restart happens when a PG has finished all Prepare and is doing Commit, the already-Committed bundles may have scheduled actors/tasks, and those actors/tasks may be killed by the GCS restart, making the GCS restart user-visible. This PR introduces a PREPARED state between PENDING and CREATED. Rules: - (New!) On a PG received all Prepare replies successfully: state change PENDING -> PREPARED, and persist to Redis. This also persists all bundle locations (node IDs). - After the persist: send all Commit calls. - On a PG received all Commit replies successfully: state change PREPARED -> CREATED, and persist to Redis. - On GCS Restart, if a PG is PENDING: return any bundles, reschedule from zero. - (New!) On GCS Restart, if a PG is PREPARED, continue to send all Commit calls. In order to do this cleanly, did a bunch of refactoring. The idea is to keep all interface changes to the `GcsPlacementGroupScheduler` but not to `GcsPlacementGroupManager`. Specifically: - `GcsPlacementGroupScheduler::ScheduleUnplacedBundles` now accepts an aggregated arg struct `SchedulePgRequest`. - `GcsPlacementGroupScheduler::Initialize` accepts one more vector of arg struct `SchedulePreparedPgRequest`, which is the regular `SchedulePgRequest` plus the prepared bundle information. - `GcsPlacementGroupManager::Initialize` now distinguishes PREPARED PGs by creating requests and send them to the Scheduler. They are also kept in `used_bundles` to restrain from being removed (<- actual fix). - Unit test for the original issue. Failing on master and passing on this PR. - Quality of life changes: `RAY_LOG().WithField(PlacementGroupID)`. Signed-off-by: Ruiyang Wang <rywang014@gmail.com> Signed-off-by: Ruiyang Wang <56065503+rynewang@users.noreply.github.com> Co-authored-by: SangBin Cho <rkooo567@gmail.com>
- Loading branch information
Showing
13 changed files
with
421 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.