{"id":70,"date":"2015-12-18T23:23:52","date_gmt":"2015-12-18T22:23:52","guid":{"rendered":"http:\/\/188.166.119.205\/?p=70"},"modified":"2026-11-10T05:52:02","modified_gmt":"2026-11-10T05:52:02","slug":"continuous-feedback-from-jenkins-console-output","status":"publish","type":"post","link":"https:\/\/banyek.net\/?p=70&lang=en","title":{"rendered":"Continuous feedback from jenkins console output"},"content":{"rendered":"<p>This one really was a pain in the ass for a long time.<\/p>\n<p>Jenkins is great, not only for building projects, but I start the most of the ops related tasks here. All the projects have their own workspace, I can browse the previous outputs, see if a task failed or not, and I can easily share the results at the end of the task.<\/p>\n<p>I had only one problem with that: the long-running tasks weren\u2019t shown on console output until they finished. I tried to solve that, but it was only annoying, not a showstopper, so I let that go, because it didn\u2019t look like an easy win, and I didn\u2019t want to spend too much time on that.<\/p>\n<p>But last week I created a job for online altering the database and \u2013 surprise! \u2013 pt-online-schema-change was continuously updated the console log screen, so I started to google out what is happening.<\/p>\n<p><!--more--><\/p>\n<p>At the end, the keyword which needed to be google is the <strong>output buffering<\/strong>. Jenkins console will show the results continuously, if the output buffer is flushed, or the buffering is skipped.<\/p>\n<p>If you want to run Perl, you can use<\/p>\n<p><code>$|++;<\/code><\/p>\n<p>With python, you can invoke the interpreter with<\/p>\n<p><code>#\/usr\/bin\/env python -u<\/code><\/p>\n<p>Or you can use the <strong>PYTHONUNBUFFERED<\/strong> environment variable.<\/p>\n<p>With ruby scripts you can use:<\/p>\n<p><code>$stdout.sync = true<\/code><\/p>\n<p>If you use bash, you can use <strong>stdbuf<\/strong> utility for changing stdout\/stderr buffering.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This one really was a pain in the ass for a long time. Jenkins is great, not only for building projects, but I start the most of the ops related tasks here. All the projects have their own workspace, I can browse the previous outputs, see if a task failed or not, and I can [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[134],"tags":[186,188,198,126,200,202,204,206],"class_list":["post-70","post","type-post","status-publish","format-standard","hentry","category-tech-en","tag-cli-en","tag-command-line-en","tag-jenkins-en","tag-oldblog-en","tag-percona-toolkit-en","tag-python-en","tag-scripting-en","tag-shell-foo-en"],"_links":{"self":[{"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/posts\/70","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/banyek.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=70"}],"version-history":[{"count":1,"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/posts\/70\/revisions"}],"predecessor-version":[{"id":422,"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/posts\/70\/revisions\/422"}],"wp:attachment":[{"href":"https:\/\/banyek.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=70"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/banyek.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=70"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/banyek.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}