This message was deleted.
# ask-for-help
s
This message was deleted.
🍱 1
💾 1
a
Hey @Adam Alpire Do you have a copy of the request you made, is it possible to share? The json you are sending is not serializable without the request can't answer. If not for debugging try serializing the request in a test script using
json
a
Hi Ashish, thanks for helping. supporting. I think that is more on the return side, how can I activate DEBUG logs within a containerized bento?
So potentially my return is not serializable, but I don’t have too much control over the code inside.
a
Hey @Adam Alpire 👋 Well that is more around the lines of debugging code inside docker, pycharm and vscode both supports it. Pycharm - https://www.jetbrains.com/help/pycharm/using-docker-compose-as-a-remote-interpreter.html vscode - https://code.visualstudio.com/docs/containers/docker-compose I personally prefer pycharm, Other option is to just print the json output before it tries to serialize and then use that as input in a local script.
a
Hey thank you, I was trying something like this: https://medium.com/@nhduy88/setup-debugger-for-your-fastapi-project-with-vscode-and-docker-compose-bc4f61702b69 But this requires a python script. Is there a way to run
bentoml serve …
using the python debugger?
a
So one thing I learned while using bentoml is since its build on starlette, you can convert your bentoml service into asgi_service and use it with fastapi or uvicorn command
Copy code
def start_server(*, port=80):
    """Function to start uvicorn server for development."""
    uvicorn.run(
        svc.asgi_app,
        host="0.0.0.0",
        port=port,
    )
Then you can just run the this code like any other python module using
Copy code
if __name__=="__main__":
    start_server()
svc.asgi_app
is only recommended for debugging and should not be used for production use case.
a
This is really cool, and exactly what I was looking for, thank you!
a
Happy to be of help 🙏