verl icon indicating copy to clipboard operation
verl copied to clipboard

how to flush logs in the terminal in real time when using ray?

Open llkn-2 opened this issue 1 year ago • 5 comments

Great job! When I run it, the logs do not display in real-time in the terminal, even though I used print(..., flush=True). I suspect this is due to Ray. Is there a way to refresh the logs in real time?

llkn-2 avatar Mar 04 '25 11:03 llkn-2

Try adding this environment variable export PYTHONUNBUFFERED=1

xffxff avatar Mar 04 '25 12:03 xffxff

the logs do not display in real-time in the terminal, even though I used print(..., flush=True)

Where is the print function? Is it in a Ray task or actor?

kevin85421 avatar Mar 04 '25 22:03 kevin85421

@eric-haibin-lin would you mind adding a label ray? Thanks

kevin85421 avatar Mar 04 '25 22:03 kevin85421

Try adding this environment variable export PYTHONUNBUFFERED=1

It works. Thanks for the quick reply!

llkn-2 avatar Mar 05 '25 02:03 llkn-2

the logs do not display in real-time in the terminal, even though I used print(..., flush=True)

Where is the print function? Is it in a Ray task or actor?

@kevin85421 in the main task

llkn-2 avatar Mar 05 '25 02:03 llkn-2

I don't know what the main task refers to, but I guess it's in the driver process. I'll close this issue since it has been resolved.

kevin85421 avatar Mar 06 '25 01:03 kevin85421