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

Capture stdout/log messages #11

Open
JoshKImperial opened this issue Feb 24, 2022 · 4 comments
Open

Capture stdout/log messages #11

JoshKImperial opened this issue Feb 24, 2022 · 4 comments

Comments

@JoshKImperial
Copy link

When using the wandb Python api it captures log messages which can then be viewed live in the log tab of wandb.ai. It would be helpful if Julia log messages could be captured in the same way, although I cannot find how the Python API captures these messages so I'm unsure how to implement it here. Wandb.log seem to the specifically for logging data which doesn't seem appropriate.

Interestingly, I have found wandb captures the logs from both Gurobi and Ipopt, but again, I'm unsure how they write their logs.

I'm using LoggingExtras.TeeLogger to setup a FileLogger, ConsoleLogger, and Wandb.WandbLogger

@avik-pal
Copy link
Owner

Yeah, I am not sure how they do it and that's why I did not implement it in the first place. If someone can point me towards how it is implemented, I might be able to take out some time and incorporate it here.

@vanpelt
Copy link

vanpelt commented Feb 25, 2022

@avik-pal I left some comments in the ticket @JoshKImperial just logged. It's complicated, but we might be able to implement a basic solution that doesn't handle all the edge cases that our python console logger does. I would be happy to pair or answer specific questions.

Looking at your implementation if this is actually calling wandb.init in a python process, we can probably just mirror Julia's stdout to that python processes stdout / stderr.

This Julia project is awesome and we would love to help you make it even more so 🤩

@JoshKImperial
Copy link
Author

@vanpelt while my knowledge here may be more limited than @avik-pal, I'm happy to help where possible. After reading both of your replies, mirroring Julia's stdout seems like a sensible quick solution. It is my understanding that wandb python is imported here and then initialised here with PyCall.jl handling the interface between Python and Julia. So presumably mirroring the stdout should be viable.

@avik-pal
Copy link
Owner

avik-pal commented Mar 1, 2022

@JoshKImperial I agree. If anyone can work out the version, I am happy to quickly review and merge it. (Unfortunately, I have some tight upcoming deadlines to personally implement it rn). From a quick search, JuliaPy/pyjulia#49 might be relevant.

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

No branches or pull requests

3 participants