Merge ~pwlars/testflinger-cli:unbuffer-poll-only into testflinger-cli:master

Proposed by Paul Larson
Status: Merged
Approved by: Maciej Kisielewski
Approved revision: dffb7f7eec4decb0a76071bf1001663e98f7bb83
Merged at revision: dffb7f7eec4decb0a76071bf1001663e98f7bb83
Proposed branch: ~pwlars/testflinger-cli:unbuffer-poll-only
Merge into: testflinger-cli:master
Diff against target: 19 lines (+2/-2)
1 file modified
testflinger-cli (+2/-2)
Reviewer Review Type Date Requested Status
Maciej Kisielewski (community) Approve
Review via email: mp+316474@code.launchpad.net

Description of the change

python -u was causing some problems, and it looks like re-opening sys.stdout doesn't work well with python3. However, I think we are really only concerned about making sure we don't buffer output when running with poll. That way Jenkins jobs and things like that don't get buffered in the output stream from this.

To post a comment you must log in.
Revision history for this message
Maciej Kisielewski (kissiel) wrote :

awesome sauce

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/testflinger-cli b/testflinger-cli
index 126332e..b0e8f0e 100755
--- a/testflinger-cli
+++ b/testflinger-cli
@@ -1,4 +1,4 @@
1#!/usr/bin/env python3 -u1#!/usr/bin/env python3
2# Copyright (C) 2017 Canonical2# Copyright (C) 2017 Canonical
3#3#
4# This program is free software: you can redistribute it and/or modify4# This program is free software: you can redistribute it and/or modify
@@ -143,7 +143,7 @@ def poll(ctx, job_id):
143 # We are still waiting for the job to start143 # We are still waiting for the job to start
144 pass144 pass
145 if output:145 if output:
146 print(output, end='')146 print(output, end='', flush=True)
147 job_state = conn.get_status(job_id)147 job_state = conn.get_status(job_id)
148 if job_state == 'complete':148 if job_state == 'complete':
149 break149 break

Subscribers

People subscribed via source and target branches