Skip to content

[core][refactor] Always use SetTaskStatus for task status transitions #52637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 28, 2025

Conversation

kevin85421
Copy link
Member

@kevin85421 kevin85421 commented Apr 28, 2025

Why are these changes needed?

I am looking into #52530. I found that there are multiple places where the task status transitions. This PR unifies all task status transitions to use SetTaskStatus and adds a log, making it easier to track the status transitions with grep.

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Kai-Hsun Chen <[email protected]>
Signed-off-by: Kai-Hsun Chen <[email protected]>
@kevin85421 kevin85421 requested a review from Copilot April 28, 2025 01:27
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors task status transitions to always use the SetTaskStatus function rather than directly setting the task status.

  • Updates the SetTaskStatus signature in the header to accept a state update, task info inclusion flag, and attempt number.
  • Revises all call sites in task_manager.cc to pass the appropriate parameters, replacing any direct status updates.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/ray/core_worker/task_manager.h Updated SetTaskStatus function signature and corresponding documentation comments.
src/ray/core_worker/task_manager.cc Adjusted all invocations of SetTaskStatus to match the new signature and behavior.

@kevin85421 kevin85421 added the go add ONLY when ready to merge, run all tests label Apr 28, 2025
@kevin85421 kevin85421 marked this pull request as ready for review April 28, 2025 06:19
@kevin85421
Copy link
Member Author

@jjyao this PR is related to #52530

rpc::TaskStatus::PENDING_ARGS_AVAIL,
/* state_update */ std::nullopt,
/* include_task_info */ true,
task_entry.spec.AttemptNumber() + 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a follow-up PR: let's move the logic to retry_task_callback so that we don't need to manually +1 to the AttemptNumber().

Signed-off-by: Kai-Hsun Chen <[email protected]>
Signed-off-by: Kai-Hsun Chen <[email protected]>
@jjyao jjyao enabled auto-merge (squash) April 28, 2025 20:51
@jjyao jjyao merged commit 9d6a960 into ray-project:master Apr 28, 2025
6 checks passed
ktyxx pushed a commit to ktyxx/ray that referenced this pull request Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants