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

Create ray cluster with ssa #778

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

Conversation

akram
Copy link
Contributor

@akram akram commented Dec 9, 2024

Issue link

What changes have been made

Adding apply function.

Verification steps

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • Testing is not required for this change

Copy link

codecov bot commented Dec 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.45%. Comparing base (6936c2c) to head (34b0e86).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #778      +/-   ##
==========================================
+ Coverage   90.33%   92.45%   +2.11%     
==========================================
  Files          23       23              
  Lines        1345     1378      +33     
==========================================
+ Hits         1215     1274      +59     
+ Misses        130      104      -26     

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

@akram akram force-pushed the create-ray-cluster-with-ssa branch 13 times, most recently from 658779c to 11dd0cb Compare December 10, 2024 22:28
src/codeflare_sdk/ray/cluster/cluster.py Outdated Show resolved Hide resolved
src/codeflare_sdk/ray/cluster/cluster.py Outdated Show resolved Hide resolved
src/codeflare_sdk/ray/cluster/cluster.py Outdated Show resolved Hide resolved
src/codeflare_sdk/ray/cluster/cluster.py Outdated Show resolved Hide resolved
src/codeflare_sdk/ray/cluster/cluster.py Outdated Show resolved Hide resolved
@akram akram force-pushed the create-ray-cluster-with-ssa branch 2 times, most recently from 9d8295d to 73987d6 Compare December 11, 2024 13:07
Copy link
Contributor

openshift-ci bot commented Dec 12, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from bobbins228. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@akram akram force-pushed the create-ray-cluster-with-ssa branch 9 times, most recently from d02ec50 to 73cbb2c Compare December 16, 2024 12:52
@akram akram force-pushed the create-ray-cluster-with-ssa branch 8 times, most recently from 43fb625 to 6c8f3db Compare December 16, 2024 15:25
Copy link
Contributor

@Bobbins228 Bobbins228 left a comment

Choose a reason for hiding this comment

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

- Adds  RayCluster.apply() implementation
- Adds e2e tests for apply
- Adds unit tests for apply
- Exclude unit tests code from coverage
- Add coverage to cluster.py
- Adding coverage for the case of an openshift cluster
@akram akram force-pushed the create-ray-cluster-with-ssa branch from 4c07b0b to 352c26c Compare January 2, 2025 14:41
@akram akram force-pushed the create-ray-cluster-with-ssa branch from 352c26c to 34b0e86 Compare January 2, 2025 14:43
Copy link
Contributor

@Bobbins228 Bobbins228 left a comment

Choose a reason for hiding this comment

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

Began testing this again on both Kind and OpenShift.
It seems that Appwrapper is not working with the new changes when creating a cluster via apply().

TypeError: Discoverer.get() takes 1 positional argument but 2 were given

crds = self.get_dynamic_client().resources
if self.config.appwrapper:
api_version = "workload.codeflare.dev/v1beta2"
api_instance = crds.get(api_version, kind="AppWrapper")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
api_instance = crds.get(api_version, kind="AppWrapper")
api_instance = crds.get(api_version=api_version, kind="AppWrapper")

This should prevent a TypeError when trying to create an AppWrapper via apply()

Copy link
Contributor

Choose a reason for hiding this comment

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

Even with the update to the api_instance there are still errors when trying to apply AppWrappers.

Response: b'{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"PatchOptions.meta.k8s.io \\"\\" is invalid: fieldManager: Required value: is required for apply patch","reason":"Invalid","details":{"group":"meta.k8s.io","kind":"PatchOptions","causes":[{"reason":"FieldValueRequired","message":"Required value: is required for apply patch","field":"fieldManager"}]},"code":422}\n'

yamls, namespace: str, api_instance: client.CustomObjectsApi, force=False
):
api_instance.server_side_apply(
field_manager="cluster-manager",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably be cf-sdk or something similar and pulled out into a variable, used both here and for the AppWrapper

return DynamicClient(get_api_client())

def config_check(self):
"""Return a dynamic client, optionally mocked in tests."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this doc string intended here?

@@ -744,6 +802,20 @@ def _create_resources(yamls, namespace: str, api_instance: client.CustomObjectsA
)


def _apply_resources(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you just use a partial instead of pulling this into it's own function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants