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

[Refactor] Make port name variables consistent and meaningful #1389

Merged
merged 11 commits into from
Sep 16, 2023

Conversation

evalaiyc98
Copy link
Contributor

@evalaiyc98 evalaiyc98 commented Sep 5, 2023

Why are these changes needed?

According to @akanso's style suggestion, use constants to replace string literals and put them in separate file.
Therefore, if they change, we only need to modify them once.
#328 (comment)

Related issue number

#337

Checks

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

Add constants to replace string literals in pod.go
Put constants in constant.go
@@ -125,6 +125,16 @@ const (

// Finalizers for RayJob
RayJobStopJobFinalizer = "ray.io/rayjob-finalizer"

DefaultAddressName = "address"
Copy link
Contributor

Choose a reason for hiding this comment

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

We can add a comment to indicate that these are the parameter names for ray start: https://docs.ray.io/en/latest/cluster/cli.html?highlight=dashboard-host#ray-start.

DefaultMetricsName = "metrics"
DefaultDashboardAgentListenPortName = "dashboard-agent"
DefaultServingPortName = "serve"
DefaultClientPortName = "client"
Copy link
Member

Choose a reason for hiding this comment

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

It would be beneficial to maintain consistency in port names. As an example, we could update DefaultMetricsName to DefaultMetricsPortName.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for guidance. I've updated the branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

However, I have an idea that want to discuss:
Concerning the prefix 'Default' in the name, it might potentially create confusion for developers. In this context, 'Default' implies that the value can be modified and configured, which may not be suitable. Moreover, it could be confused for new contributors who are trying to follow along.

Copy link
Member

Choose a reason for hiding this comment

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

Good point. Maybe we can remove "Default" here.

ray-operator/controllers/ray/common/constant.go Outdated Show resolved Hide resolved
@kevin85421 kevin85421 changed the title [Style] Use constants to replace string literals in pod.go [Refactor] Make port name variables consistent and meaningful Sep 16, 2023
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

@kevin85421 kevin85421 merged commit 4492fe2 into ray-project:master Sep 16, 2023
20 of 21 checks passed
@evalaiyc98 evalaiyc98 deleted the cleanUp branch September 16, 2023 12:31
lowang-bh pushed a commit to lowang-bh/kuberay that referenced this pull request Sep 24, 2023
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.

None yet

3 participants