-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[2/2][Serve] Support dynamic log #40735
[2/2][Serve] Support dynamic log #40735
Conversation
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
eeceda0
to
41eb578
Compare
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Update PR description please |
# When there is no deployment entries and app logging config is set, | ||
# apply app logging config to all existing deployment logging config. | ||
if not deployment_override_options and app_logging_config: | ||
for deployment in list(deployment_infos.values()): | ||
deployment.deployment_config.logging_config = app_logging_config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this logic is not comprehensive. If there are deployment_override_options
, but the list is not complete, then the deployments not in the list will not have their logging config overridden. Am I correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated logic:
- if application logging config is set, apply to all existing deployment config.
- if deployment logging config is set, will rely on existing for loop to update the logging config for each deployment.
logger.debug( | ||
"Configure the serve controller logger " | ||
f"with logging config: {self.logging_config}" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would make sure this only logs when the config is changed then make it info-level (it's useful)
logger.debug( | |
"Configure the serve controller logger " | |
f"with logging config: {self.logging_config}" | |
) | |
logger.debug( | |
f"Serve controller logging config updated to: {self.logging_config}." | |
) |
python/ray/serve/tests/test_api.py
Outdated
resp = requests.get("http:https://127.0.0.1:8000/") | ||
assert resp.status_code == 200 | ||
|
||
def test_application_logging_overwrite(self, serve_instance): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also add a test for overwriting per-deployment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done! Check test_application_logging_overwrite
python/ray/serve/_private/api.py
Outdated
@@ -110,6 +111,7 @@ def _check_http_options( | |||
def _start_controller( | |||
http_options: Union[None, dict, HTTPOptions] = None, | |||
grpc_options: Union[None, dict, gRPCOptions] = None, | |||
logging_config: Union[None, dict, LoggingConfig] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this to system_logging_config
just like how we have update_system_logging_config
in the client? It's a bit confusing to see logging_config
in three different places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also change the config option in ServeDeploySchema
? There's the same issue of the same option name being used in 3 places. Aware this is an API change, will leave it up to the team to decide.
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one clarification then lgtm
# If application loggin config is set, apply to all existing deployment config | ||
if app_logging_config: | ||
for _, info in deployment_infos.items(): | ||
info.deployment_config.logging_config = LoggingConfig( | ||
**app_logging_config | ||
).dict() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this override all deployments' logging config, even if there is one specified for the deployment? The desired behavior is being able to override deployment > application > system (this is standard practice, finest granularity should take precedence).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm from the tests it looks like what I'm saying is already the case. I'm not following how this works because it looks like you're overriding all deployments' logging config here with the application one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apply the application logging config here.
And then we have the for loop to override the deployment config if set. https://github.com/ray-project/ray/blob/master/python/ray/serve/_private/application_state.py#L1020
So that deployment logging config will always be set lastly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the user set logging_config in the code? It will always be overridden by the application level logging config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my confusion as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
synced with Cindy offline, we apply the application config out of the function. So that we don't need to track whether setting in the deployment code or yaml file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. So this works as-is? Can you leave a comment describing this btw it's pretty hard to see from the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to write a unit test to cover this case. Yeah, I will leave comments too!
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments + 1 pending comment from above, otherwise LGTM
# If application loggin config is set, apply to all existing deployment config | ||
if app_logging_config: | ||
for _, info in deployment_infos.items(): | ||
info.deployment_config.logging_config = LoggingConfig( | ||
**app_logging_config | ||
).dict() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the user set logging_config in the code? It will always be overridden by the application level logging config.
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
Signed-off-by: Sihan Wang <[email protected]>
@@ -572,7 +573,18 @@ def _reconcile_target_deployments(self) -> None: | |||
|
|||
# Set target state for each deployment | |||
for deployment_name, info in self._target_state.deployment_infos.items(): | |||
self.apply_deployment_info(deployment_name, info) | |||
deploy_info = deepcopy(info) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the logic itself looks good, just flagging that we will execute a deepcopy once per deployment for every control loop iteration. I think it would be more efficient to store a copy of this info object since it doesn't change between control loop iterations.
Signed-off-by: Sihan Wang <[email protected]>
@architkulkarni ready to merge, windows telemetry is flacky in master. |
Follow up with the pr to implement the dynamic logging. --------- Signed-off-by: Sihan Wang <[email protected]>
Why are these changes needed?
Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.