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

[Autoscaler] Match autoscaler image to Ray head image for Ray >= 2.0.0 #423

Merged

Conversation

DmitriGekhtman
Copy link
Collaborator

Why are these changes needed?

This PR updates the logic that selects a default autoscaler image.

For Ray versions at least 2.0.0, use the same image for the autoscaler as for the Ray container.
This eliminates the possibility of autoscaler/Ray incompatibility and reduces docker pull time.

For earlier Ray versions, use rayproject/ray:2.0.0 to guarantee up-to-date autoscaler functionality.
As of the Ray 2.0.0 branch cut earlier today, an image tagged rayproject/ray:2.0.0 exists on Dockerhub.
Until the official Ray release in two weeks, this image is unofficial and its actual contents are a moving target -- but I think we can live with the inconsistency in the short term. (I'm open to other opinions on this choice.)

Related issue number

Closes #360

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

Signed-off-by: Dmitri Gekhtman <[email protected]>
Signed-off-by: Dmitri Gekhtman <[email protected]>
Signed-off-by: Dmitri Gekhtman <[email protected]>
Signed-off-by: Dmitri Gekhtman <[email protected]>
Signed-off-by: Dmitri Gekhtman <[email protected]>
Signed-off-by: Dmitri Gekhtman <[email protected]>
Signed-off-by: Dmitri Gekhtman <[email protected]>
@Jeffwan
Copy link
Collaborator

Jeffwan commented Jul 27, 2022

so rayproject/ray:2.0.0 will be overridden once the office image is out?

@Jeffwan
Copy link
Collaborator

Jeffwan commented Jul 27, 2022

/cc @akanso to take a look, ali use autoscaler a lot

@DmitriGekhtman
Copy link
Collaborator Author

so rayproject/ray:2.0.0 will be overridden once the office image is out?

rayproject/ray:2.0.0 is updated each time we push to the Ray 2.0.0 release branch

The "official image is out" after the last commit is made to the release branch and we announce the release.

Maybe not the best way of doing things but that's the way it is at the moment.

@@ -92,6 +92,9 @@ const (
// Ray health check related configurations
RayAgentRayletHealthPath = "api/local_raylet_healthz"
RayDashboardGCSHealthPath = "api/gcs_healthz"

// Default autoscaler image when running Ray at versions older than 2.0.0
FallbackDefaultAutoscalerImage = "rayproject/ray:2.0.0"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This image exists but is unofficial at the moment.
Its contents may change slightly over the course of the Ray 2.0.0 release process.

// Example inputs that return false: "1.13.0", "1.12", "1".
func autoscalerSupportIsStable(rayVersion string) bool {
// Try to determine major version by extracting everything that comes before the first "."
firstDotIndex := strings.Index(rayVersion, ".")
Copy link
Collaborator

Choose a reason for hiding this comment

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

minor: In our downstream code, we have similar version specific configuration. for those cases, we use hashicorp/go-version to directly compare versions if the version follow semantic versioning.

import "github.com/hashicorp/go-version"

// LessThanVersion tests if version1 is less than version2.
func LessThanVersion(version1 string, version2 string) (bool, error) {
	v1, err := version.NewVersion(version1)
	if err != nil {
		return false, err
	}
	v2, err := version.NewVersion(version2)
	if err != nil {
		return false, err
	}

	return v1.LessThan(v2), nil
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the tip! I'll keep it in mind to use that library for version comparisons in the future.

For now, I prefer to implement the logic directly, as I'd like to be super explicit with what we're doing with ill-formatted version strings.

Copy link
Collaborator

@Jeffwan Jeffwan left a comment

Choose a reason for hiding this comment

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

Overall looks good to me and I leave a minor comment which may help simplify the version comparison

@Jeffwan
Copy link
Collaborator

Jeffwan commented Jul 28, 2022

#424 is merged to help improve test stability. You can rebase the change to see if nightly version pass

@Jeffwan
Copy link
Collaborator

Jeffwan commented Jul 28, 2022

Let's merge this one and it's time to cut rc.0 release. If other reviewers have further feedback, feel free to leave it here.

@Jeffwan Jeffwan merged commit eaa75fa into ray-project:master Jul 28, 2022
@DmitriGekhtman DmitriGekhtman deleted the dmitri/autoscaler-image-matching branch July 28, 2022 20:26
lowang-bh pushed a commit to lowang-bh/kuberay that referenced this pull request Sep 24, 2023
ray-project#423)

* Implement the logic.

Signed-off-by: Dmitri Gekhtman <[email protected]>

* Fix function call.

Signed-off-by: Dmitri Gekhtman <[email protected]>

* Test.

Signed-off-by: Dmitri Gekhtman <[email protected]>

* Update example.

Signed-off-by: Dmitri Gekhtman <[email protected]>

* lowercase

Signed-off-by: Dmitri Gekhtman <[email protected]>

* lint

Signed-off-by: Dmitri Gekhtman <[email protected]>

* wording

Signed-off-by: Dmitri Gekhtman <[email protected]>
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.

Use the same image in Ray container and autoscaler container in Ray 2.0.0
3 participants