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

Add support for affinity and tolerations, refactor unit tests #6232

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Sovietaced
Copy link
Contributor

@Sovietaced Sovietaced commented Feb 8, 2025

Tracking issue

Closes #6229

Why are the changes needed?

If you are using ray to do distributed training on GPUs you may want to use tolerations and node affinity to ensure GPU workloads land on GPU nodes.

What changes were proposed in this pull request?

Updates the ray plugin to cherry pick tolerations and affinity if they are non-null or non-empty in the customized head/worker pod specs.

I also changed how assertions are made in the unit tests since they were becoming cumbersome in the previous style.

How was this patch tested?

Unit tests

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Summary by Bito

This PR enhances the Ray plugin by implementing pod tolerations, node affinity configurations, and resource requirements for Ray head and worker pods. The changes enable custom scheduling requirements particularly for GPU workloads and include merging tolerations and affinity settings from custom pod specifications. The implementation includes refactoring of affinity configurations to ensure proper handling of resource specifications in Ray clusters, along with improved test suite organization and comprehensive test coverage.

Unit tests added: True

Estimated effort to review (1-5, lower is better): 2

Signed-off-by: Jason Parraga <sovietaced@gmail.com>
@Sovietaced Sovietaced added the added Merged changes that add new functionality label Feb 8, 2025
@flyte-bot
Copy link
Collaborator

Code Review Agent Run Status

  • Limitations and other issues: ❌ Failure - The AI Code Review Agent skipped reviewing this change because it is configured to exclude certain pull requests based on the source/target branch or the pull request status. You can change the settings here, or contact the agent instance creator at eduardo@union.ai.

Copy link

codecov bot commented Feb 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.87%. Comparing base (34205dd) to head (408624e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6232   +/-   ##
=======================================
  Coverage   36.87%   36.87%           
=======================================
  Files        1318     1318           
  Lines      134647   134653    +6     
=======================================
+ Hits        49647    49657   +10     
+ Misses      80679    80676    -3     
+ Partials     4321     4320    -1     
Flag Coverage Δ
unittests-datacatalog 51.58% <ø> (ø)
unittests-flyteadmin 51.96% <ø> (ø)
unittests-flytecopilot 30.99% <ø> (ø)
unittests-flytectl 62.29% <ø> (ø)
unittests-flyteidl 7.22% <ø> (ø)
unittests-flyteplugins 54.05% <100.00%> (+0.03%) ⬆️
unittests-flytepropeller 42.78% <ø> (ø)
unittests-flytestdlib 55.35% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Sovietaced Sovietaced marked this pull request as ready for review February 8, 2025 03:31
@flyte-bot
Copy link
Collaborator

flyte-bot commented Feb 8, 2025

Code Review Agent Run #d27a94

Actionable Suggestions - 4
  • flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go - 3
    • Consider extracting node affinity configuration · Line 485-507
    • Consider keeping resource requirement assertions · Line 512-514
    • Possible missing submitter pod resource validation · Line 556-561
  • flyteplugins/go/tasks/plugins/k8s/ray/ray.go - 1
    • Consider adding nil check for customPodSpec · Line 552-558
Review Details
  • Files reviewed - 2 · Commit Range: 6b06ff6..6b06ff6
    • flyteplugins/go/tasks/plugins/k8s/ray/ray.go
    • flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go
  • Files skipped - 0
  • Tools
    • Golangci-lint (Linter) - ✖︎ Failed
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

AI Code Review powered by Bito Logo

@flyte-bot
Copy link
Collaborator

flyte-bot commented Feb 8, 2025

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
Feature Improvement - Ray Plugin Pod Scheduling Enhancement

ray.go - Added support for tolerations and affinity in Ray pod specifications

ray_test.go - Refactored test structure and added test cases for tolerations and affinity

Signed-off-by: Jason Parraga <sovietaced@gmail.com>
@flyte-bot
Copy link
Collaborator

flyte-bot commented Feb 8, 2025

Code Review Agent Run #3fcfcf

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 6b06ff6..408624e
    • flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go
  • Files skipped - 0
  • Tools
    • Golangci-lint (Linter) - ✖︎ Failed
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
added Merged changes that add new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Ray plugin should support setting tolerations and node affinity from head/worker pod specs
2 participants