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

Python debug logs to be seen from java console execution #578

Open
Serwios opened this issue Dec 10, 2024 · 2 comments
Open

Python debug logs to be seen from java console execution #578

Serwios opened this issue Dec 10, 2024 · 2 comments

Comments

@Serwios
Copy link

Serwios commented Dec 10, 2024

Is your feature request related to a problem? Please describe.
Currently I'm trying to find a way how to execute python from java faster. I pass arguments from java to python, python makes it calculation and then I have result. Execution time of python is very different, from 2500 millis to 3500 millis and execution time is very important in my case. So I want to get all needed debug logs about python in java by using some config etc. Like GC cycle execution, memory/cpu usage of python process etc.

Describe the solution you'd like
I want to have this cpu/memory/gc logs from python in java console

Describe alternatives you've considered
I can output python logs inside python file and store it in some file but it's I/o operations are time consuming and not comfortable

Additional context

@bsteffensmeier
Copy link
Member

To get output into Java you can redirect the Python stdout/stderr to java by using JepConfig.redirectStdErr() and JepConfig.setStdOut() when you set up the Interpreter. Setting these to System.out and System.err can redirect to the java console or you can use custom OutputStreams to do more advanced things.

Jep does not have anything outside the normal Python API for monitoring cpu/memory/gc usage so you will have to use standard python APIs(gc, tracemalloc) to enable whatever debugging is available in python.

@Serwios
Copy link
Author

Serwios commented Dec 10, 2024

It's not totally covers my needs but at least I can use it, thanks

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

2 participants