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

Fix exception handler for proxy server #2901

Merged
merged 13 commits into from
Dec 26, 2024
Merged

Conversation

AllentDan
Copy link
Collaborator

No description provided.

@AllentDan AllentDan reopened this Dec 16, 2024
@lvhan028
Copy link
Collaborator

lvhan028 commented Dec 23, 2024

We'd better log each request, include add, remove, v1/chat/completions, v1/compeltions
Logging key events within the lifecycle of a request is extremely beneficial for our debugging process.

@app.post('/nodes/add', dependencies=[Depends(check_api_key)])
def add_node(node: Node, raw_request: Request = None):
    """Add a node to the manager.

    - url (str): A http url. Can be the url generated by
        `lmdeploy serve api_server`.
    - status (Dict): The description of the node. An example:
        {models: ['internlm-chat-7b],  speed: 1}. The speed here can be
        RPM or other metric. All the values of nodes should be the same metric.
    """
    try:
        logger.info(f'try to add node {node.url}, {node.status}')
        res = node_manager.add(node.url, node.status)
        if res is not None:
            logger.error(f'add node {node.url} failed, {res}'
            return res
        logger.info(f'add node {node.url} successfully')
        return f'add node {node.url} successfully'
    except:  # noqa
        return f'Failed to add, node {node.url} please check the input url.'

@lvhan028 lvhan028 requested a review from RunningLeon December 25, 2024 11:54
Copy link
Collaborator

@RunningLeon RunningLeon left a comment

Choose a reason for hiding this comment

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

LGTM

@lvhan028 lvhan028 merged commit f62b544 into InternLM:main Dec 26, 2024
4 of 5 checks passed
lvhan028 pushed a commit that referenced this pull request Dec 27, 2024
* Fix exception handle for proxy server

* fix

* fix exception handler

* Add more logs

* fix typo

* logger.warn -> logger.warning

* logger info

* add error log for exception

* better log

* rename varaibles & reset timeout to

* update docstring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants