-
Notifications
You must be signed in to change notification settings - Fork 47
Log improvements in pebblo-server. #124
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
Conversation
Kindly review. |
logs:
|
from io import StringIO | ||
from tqdm import tqdm |
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 suppose, all three libraries are either present by default in python 3.9+ or already present as dependency of some other package and no need to add them to requirements.txt/pyproject.toml.
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.
Yes thats right.
io is part of standard library and tqdm come as a dependency in current environment. So we should be good.
pebblo/app/daemon.py
Outdated
|
||
# running local server | ||
uvicorn.run(app, host="localhost", port=8000, log_level="info") | ||
p_bar.write("Pebblo server Stopped. BYE!") |
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 see overall 4 sections of logs - Downloading model, Topic Classifier Initialization, Entity Classifier Initialization and starting pebblo server. Is it possible to move these sections in separate function? so that code is more readable. We have some changes in this file coming soon.
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.
Hi @shreyas-damle
I am not able to think of a way how can we move scattered logging into a common function, they are all stdouts. We are steering progress bar and screen message one by one, hence we have this many logs.
But I think we can have a common function to update progress bar
and stdout text messages
with both to be passed as an argument. This way we can make the code a bit readable.
What do you think, please suggest.
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.
Hi @shreyas-damle
made changes in the daemon file as per our recent discussion.
@rahul-trip Overall logs are better now, API info logs missing though. |
Signed-off-by: Rahul Tripathi <[email protected]>
c902012
to
64370d5
Compare
Latest output:
|
Screencast.from.09-02-24.12.08.02.AM.IST.webmWe need to suppress logs from router initialisation because it is printing torch package's warnings (See below) as it is importing TopicClassifier class which is importing something from presedio and so on.. If we dont suppress stdout and stderr of router initialisation, we get following logs:
|
Signed-off-by: Rahul Tripathi <[email protected]>
Hi @shreyas-damle We can simply send the logs to uvicorn logging instance as it has a context of its own. 🙌 cc: @srics |
Another option to print our logs would be to create another context with stdout and stderr restored whenever we need to print the logs. |
Rahul quick fix
Signed-off-by: Rahul Tripathi <[email protected]>
Latest video.: Screencast.from.13-02-24.01.34.45.PM.IST.webm |
Signed-off-by: Rahul Tripathi <[email protected]>
5f7a0c8
to
e918c1a
Compare
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.
Changes look good to me.
No description provided.