Skip to content

[Serve] Improve logs for new Serve REST API - #25610

Merged
simon-mo merged 2 commits into
ray-project:masterfrom
shrekris-anyscale:silent_error
Jun 10, 2022
Merged

simon-mo merged 2 commits into
ray-project:masterfrom
shrekris-anyscale:silent_error

Conversation

@shrekris-anyscale

@shrekris-anyscale shrekris-anyscale commented Jun 9, 2022 •

Copy link
Copy Markdown
Contributor

Why are these changes needed?

The Serve REST API logs scary messages when Serve is operating normally. For example, this is in the traceback when a new deployment graph is deployed:

(ServeController pid=7252) 2022-06-08 17:21:55,088	ERROR worker.py:289 -- Unhandled error (suppress with 'RAY_IGNORE_UNHANDLED_ERRORS=1'): ray::run_graph() (pid=8036, ip=127.0.0.1)
--
  | (ServeController pid=7252)   File "c:\install\ray\python\ray\serve\controller.py", line 589, in run_graph
  | (ServeController pid=7252)     serve.run(app)
  | (ServeController pid=7252)   File "c:\install\ray\python\ray\serve\api.py", line 634, in run
  | (ServeController pid=7252)     client.deploy_group(
  | (ServeController pid=7252)   File "c:\install\ray\python\ray\serve\client.py", line 58, in check
  | (ServeController pid=7252)     return f(self, *args, **kwargs)
  | (ServeController pid=7252)   File "c:\install\ray\python\ray\serve\client.py", line 314, in deploy_group
  | (ServeController pid=7252)     self._wait_for_deployment_healthy(name)
  | (ServeController pid=7252)   File "c:\install\ray\python\ray\serve\client.py", line 216, in _wait_for_deployment_healthy
  | (ServeController pid=7252)     time.sleep(CLIENT_POLLING_INTERVAL_S)
  | (ServeController pid=7252) KeyboardInterrupt
  | (ServeController pid=7252)
  | (ServeController pid=7252) During handling of the above exception, another exception occurred:
  | (ServeController pid=7252)
  | (ServeController pid=7252) ray::run_graph() (pid=8036, ip=127.0.0.1)
  | (ServeController pid=7252)   File "python\ray\_raylet.pyx", line 660, in ray._raylet.execute_task
  | (ServeController pid=7252)   File "python\ray\_raylet.pyx", line 692, in ray._raylet.execute_task
  | (ServeController pid=7252) ray.exceptions.TaskCancelledError: Task: TaskID(8394b964f7a642cdffffffffffffffffffffffff06000000) was cancelled

...

(ServeController pid=7252) WARNING 2022-06-08 17:21:57,146 controller 7252 endpoint_state.py:67 - route_prefix "/" is currently registered to deployment "BasicDriver". Re-registering route_prefix "/" to deployment "DAGDriver".

However, Serve is working normally in this traceback.

This change improves the logging by:

  • Silently swallowing the KeyboardInterrupt exception.
  • Changing the route_prefix re-registration message to a debug message instead of a warning.
  • Always logging a message when a new REST API deploy request is received.

Related issue number

N/A

Checks

existing_route_endpoint = self._get_endpoint_for_route(endpoint_info.route)
if existing_route_endpoint is not None and existing_route_endpoint != endpoint:
logger.warn(
logger.debug(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This isn't ideal since generally users should be warned when they're overwriting existing route_prefixes. However, this message always gets logged when a new driver is submitted through the REST API, since it'll replace the old driver's "/" prefix. That prints an unnecessary WARNING log, even though nothing's wrong.

Comment thread python/ray/serve/controller.py Outdated
serve.run(app)
except KeyboardInterrupt:
logger.debug("Existing config deployment request terminated.")
pass

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

extra line

# Run the graph locally on the cluster
serve.start(_override_controller_namespace="serve")
serve.run(app)
except KeyboardInterrupt:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

comment about when this can happen ("ray.cancel" called)

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.

2 participants