Skip to content
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

ray-operator: Reuse contexts across ray operator reconcilers #1126

Merged
merged 1 commit into from
Jun 5, 2023

Conversation

anishasthana
Copy link
Contributor

@anishasthana anishasthana commented May 30, 2023

cc @kevin85421

Why are these changes needed?

Related issue number

Closes #1089

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests

I deployed using the instructions in development.md. I tested with the smallest sample: https://raw.githubusercontent.com/ray-project/kuberay/master/ray-operator/config/samples/ray-cluster.mini.yaml

@anishasthana anishasthana changed the title WIP: Reuse contexts for across ray operator reconcilers WIP: Reuse contexts facross ray operator reconcilers May 30, 2023
@anishasthana anishasthana changed the title WIP: Reuse contexts facross ray operator reconcilers WIP: Reuse contexts across ray operator reconcilers May 30, 2023
@anishasthana anishasthana changed the title WIP: Reuse contexts across ray operator reconcilers Reuse contexts across ray operator reconcilers May 30, 2023
@anishasthana anishasthana changed the title Reuse contexts across ray operator reconcilers ray-operator: Reuse contexts across ray operator reconcilers May 31, 2023
@blublinsky
Copy link
Contributor

Thanks @anishasthana

Signed-off-by: Anish Asthana <anishasthana1@gmail.com>
@kevin85421
Copy link
Member

Thank you, @anishasthana, for this pull request, and thank you, @blublinsky, for raising this issue! It is a bit embarrassing, but I do not know much about context.

  • Will this change (replace context.TODO with the existing one) make operator have different behaviors?
  • Would you mind adding more details about the advantages of using the existing context?

Thanks!

@blublinsky
Copy link
Contributor

@kevin85421 A good description of context is here https://betterprogramming.pub/how-and-when-to-use-context-in-go-b365ddf42ae2. In a nutshell, propagating a context, instead of creating a new one every time conserves resources and allows an operator to better control the execution of the operator's sub/co routines

Copy link
Member

@kevin85421 kevin85421 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank @anishasthana for this contribution and @blublinsky for the review! The article is very helpful.

@kevin85421 kevin85421 merged commit 4b6f1df into ray-project:master Jun 5, 2023
19 checks passed
@anishasthana anishasthana deleted the reuse_contexts branch June 5, 2023 20:40
lowang-bh pushed a commit to lowang-bh/kuberay that referenced this pull request Sep 24, 2023
Reuse contexts across ray operator controllers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants