Re: [Freeipa-devel] [PATCH] 0236 Flush stream after writing service messages
On 06/11/2013 02:32 PM, Alexander Bokovoy wrote: On Tue, 11 Jun 2013, Alexander Bokovoy wrote: On Mon, 10 Jun 2013, Petr Viktorin wrote: Hello, This is related to testing but can be pushed independently. It will make testing master much more pleasant. sys.stdout is buffered by default if redirected to a file. This may cause automated installation to appear hung. Flush the stream so that messages are written immediately. Despite the fact that we have abstracted out output_fd in service class, in existing code it is only used against sys.stdout. Just in case it would be used against different output_fd, could you please make flush() conditional under output_fd.isatty() condition? On further thinking this conditioning is not really needed. So scratch it. ACK for the original patch. To elaborate why conditioning it's not needed: On a TTY, stdout is already unbuffered, so flush() is a no-op. In tests the stdout can be connected to Jenkins' console watcher or through a SSH channel to a controlling machine in integration tests. In these cases there's no TTY but we want the output flushed in case someone is tailing the output (or attaching timestamps to the lines). Also the messages are infrequent enough that performance isn't a concern. Pushed to master (as e8e88ed2084faeba7858f54c310e333b60513ed5) -- PetrĀ³ ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 0236 Flush stream after writing service messages
On Tue, 11 Jun 2013, Alexander Bokovoy wrote: On Mon, 10 Jun 2013, Petr Viktorin wrote: Hello, This is related to testing but can be pushed independently. It will make testing master much more pleasant. sys.stdout is buffered by default if redirected to a file. This may cause automated installation to appear hung. Flush the stream so that messages are written immediately. Despite the fact that we have abstracted out output_fd in service class, in existing code it is only used against sys.stdout. Just in case it would be used against different output_fd, could you please make flush() conditional under output_fd.isatty() condition? On further thinking this conditioning is not really needed. So scratch it. ACK for the original patch. -- / Alexander Bokovoy ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 0236 Flush stream after writing service messages
On Mon, 10 Jun 2013, Petr Viktorin wrote: Hello, This is related to testing but can be pushed independently. It will make testing master much more pleasant. sys.stdout is buffered by default if redirected to a file. This may cause automated installation to appear hung. Flush the stream so that messages are written immediately. Despite the fact that we have abstracted out output_fd in service class, in existing code it is only used against sys.stdout. Just in case it would be used against different output_fd, could you please make flush() conditional under output_fd.isatty() condition? -- / Alexander Bokovoy ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
[Freeipa-devel] [PATCH] 0236 Flush stream after writing service messages
Hello, This is related to testing but can be pushed independently. It will make testing master much more pleasant. sys.stdout is buffered by default if redirected to a file. This may cause automated installation to appear hung. Flush the stream so that messages are written immediately. -- PetrĀ³ From 58a2736e60015d59291bb941ae5b349c2f963f7b Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Mon, 10 Jun 2013 14:13:35 +0200 Subject: [PATCH] Flush stream after writing service messages sys.stdout is buffered by default if redirected to a file. This may causes automated installation to appear hung. Flush the stream so that messages are written immediately. --- ipaserver/install/service.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py index f3cd1897f114c1d3b5efce04290f8947b812fbda..4a244abb9135ae4c712abcb27456bc2436728215 100644 --- a/ipaserver/install/service.py +++ b/ipaserver/install/service.py @@ -55,6 +55,7 @@ def print_msg(message, output_fd=sys.stdout): root_logger.debug(message) output_fd.write(message) output_fd.write("\n") +output_fd.flush() class Service(object): -- 1.8.2.1 ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel