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

[serve] Use DeploymentID.__str__ to standardize log format. #43708

Merged
merged 12 commits into from Mar 5, 2024

Conversation

edoakes
Copy link
Contributor

@edoakes edoakes commented Mar 5, 2024

Why are these changes needed?

Uses a custom repr for DeploymentID instead of hand-writing long strings describing each deployment.

Before:

(ServeController pid=47618) INFO 2024-03-05 09:06:46,000 controller 47618 deployment_state.py:1634 - Deploying new version of deployment A in application 'default'. Setting initial target number of replicas to 1.
(ServeController pid=47618) INFO 2024-03-05 09:06:46,104 controller 47618 deployment_state.py:1944 - Adding 1 replica to deployment 'A' in application 'default'.

After:

(ServeController pid=52016) INFO 2024-03-05 09:39:17,679 controller 52016 deployment_state.py:1629 - Deploying new version of Deployment(name='A', app='default') (initial target replicas: 1).
(ServeController pid=52016) INFO 2024-03-05 09:39:17,781 controller 52016 deployment_state.py:1936 - Adding 1 replica to Deployment(name='A', app='default').

I will do the same thing for replicas in: #43557

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
@edoakes edoakes requested a review from a team March 5, 2024 15:41
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Copy link
Contributor

@GeneDer GeneDer left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -28,6 +28,15 @@ class DeploymentID:
name: str
app_name: str = SERVE_DEFAULT_APP_NAME

def __repr__(self):
s = f"Deployment(name='{self.name}'"
if not self.app_name or self.app_name == SERVE_DEFAULT_APP_NAME:
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocker: I kinda feel it's fine to print "default" as the app name just in case if the user doesn't know what's the default value we use. Also, in the case when the user explicitly set it to be "default", it won't be omitted and cause confusion.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, I also think it would be more clear if we print "default" as the app name. Also, now that 1.x deployments are fully deprecated, I think app_name should always be non-empty

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I will update it to include app='default'

python/ray/serve/_private/deployment_state.py Outdated Show resolved Hide resolved
@edoakes edoakes self-assigned this Mar 5, 2024
Copy link
Contributor

@zcin zcin left a comment

Choose a reason for hiding this comment

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

overall lgtm to me as well!

python/ray/serve/_private/deployment_state.py Outdated Show resolved Hide resolved
@@ -28,6 +28,15 @@ class DeploymentID:
name: str
app_name: str = SERVE_DEFAULT_APP_NAME

def __repr__(self):
s = f"Deployment(name='{self.name}'"
if not self.app_name or self.app_name == SERVE_DEFAULT_APP_NAME:
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, I also think it would be more clear if we print "default" as the app name. Also, now that 1.x deployments are fully deprecated, I think app_name should always be non-empty

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
@edoakes edoakes changed the title [serve] Use DeploymentID.__repr__ to standardize log format. [serve] Use DeploymentID.__str__ to standardize log format. Mar 5, 2024
Copy link
Contributor

@GeneDer GeneDer left a comment

Choose a reason for hiding this comment

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

:shipit:

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
@edoakes edoakes merged commit d4cc12a into ray-project:master Mar 5, 2024
9 checks passed
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