Jenkins console output not in realtime

Viewed 46434

Pretty new to Jenkins and I have simple yet annoying problem. When I run job (Build) on Jenkins I am triggering ruby command to execute my test script.

Problem is Jenkins is not displaying output in real time from console. Here is trigger log.

Building in workspace /var/lib/jenkins/workspace/foo_bar
No emails were triggered.
[foo_bar] $ /bin/sh -xe /tmp/hudson4042436272524123595.sh
+ ruby /var/lib/jenkins/test-script.rb

Basically it hangs on this output until build is complete than it just shows full output. Funny thing is this is not consistent behavior, sometimes it works as it should. But most of the time there is no real time console output.

Jenkins version: 1.461

9 Answers

Python buffered its output traces and print it at the end of script to minimize writing on console as writing to console is slow.

You can use following command after your traces. It will flush all traces to console, which are queued before that command.

sys.stdout.flush()

Related