Merge ~pwlars/testflinger-agent:wait-for-status into testflinger-agent:master
- Git
- lp:~pwlars/testflinger-agent
- wait-for-status
- Merge into master
Status: | Merged |
---|---|
Approved by: | Paul Larson |
Approved revision: | 320bbff5b8f4524b9c6f5a760b8c3175562ceed4 |
Merged at revision: | 59703fee6e23b09f0ac63a3038b38acbb635a8d3 |
Proposed branch: | ~pwlars/testflinger-agent:wait-for-status |
Merge into: | testflinger-agent:master |
Diff against target: |
29 lines (+6/-2) 2 files modified
.pmr-merge-hook (+1/-1) testflinger_agent/job.py (+5/-1) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Devices Certification Bot | Needs Fixing | ||
Sheila Miguez (community) | Approve | ||
Paul Larson | Needs Resubmitting | ||
Review via email: mp+395747@code.launchpad.net |
Commit message
Description of the change
Fix for a small corner-case where we might get no exit status when a job times out.
Sheila Miguez (codersquid) wrote : | # |
Paul Larson (pwlars) wrote : | # |
That's a good question. You're right, it's not real clear about how much output would cause this, but to be on the safe side, I'll call communicate() first, and also add a timeout to the wait.
Sheila Miguez (codersquid) wrote : | # |
I guess adding the timeout is sufficient. From what I can tell in the docs, if it got blocked beyond the timeout it would throw an exception.
Paul Larson (pwlars) wrote : | # |
Good point. There's already a paranoid default exit of 99 for the calling function, but it doesn't account for the possibility of an exception in a nice way. I'll handle it here and have it use that default as well.
Devices Certification Bot (ce-certification-qa) wrote : | # |
The merge was fine but running tests failed.
Already using interpreter /usr/bin/python3
running pytest
Searching for voluptuous
Reading https:/
Downloading https:/
Best match: voluptuous 0.12.1
Processing voluptuous-
Installing voluptuous-
Installed /tmp/tmpk35BGu/
Searching for requests
Reading https:/
Downloading https:/
Best match: requests 2.25.1
Processing requests-
Installing requests-
Installed /tmp/tmpk35BGu/
Searching for PyYAML
Reading https:/
Downloading https:/
Best match: PyYAML 5.3.1
Processing PyYAML-5.3.1.tar.gz
Writing /tmp/easy_
Running PyYAML-
Moving PyYAML-
Installed /tmp/tmpk35BGu/
Searching for urllib3<
Reading https:/
Downloading https:/
Best match: urllib3 1.26.2
Processing urllib3-
Installing urllib3-
Installed /tmp/tmpk35BGu/
Searching for idna<3,>=2.5
Reading https:/
Downloading https:/
Best match: idna 2.10
Processing idna-2.
Installing idna-2.
Installed /tmp/tmpk35BGu/
Searching for chardet<5,>=3.0.2
Reading https:/
Downloading https:/
Best match: chardet 4.0.0
Processing chardet-
Installing chardet-
Installed /tmp/tmpk35BGu/
Devices Certification Bot (ce-certification-qa) wrote : | # |
The merge was fine but running tests failed.
Already using interpreter /usr/bin/python3
running pytest
Searching for voluptuous
Reading https:/
Downloading https:/
Best match: voluptuous 0.12.1
Processing voluptuous-
Installing voluptuous-
Installed /tmp/tmp0Z6R_
Searching for requests
Reading https:/
Downloading https:/
Best match: requests 2.25.1
Processing requests-
Installing requests-
Installed /tmp/tmp0Z6R_
Searching for PyYAML
Reading https:/
Downloading https:/
Best match: PyYAML 5.3.1
Processing PyYAML-5.3.1.tar.gz
Writing /tmp/easy_
Running PyYAML-
Moving PyYAML-
Installed /tmp/tmp0Z6R_
Searching for urllib3<
Reading https:/
Downloading https:/
Best match: urllib3 1.26.2
Processing urllib3-
Installing urllib3-
Installed /tmp/tmp0Z6R_
Searching for idna<3,>=2.5
Reading https:/
Downloading https:/
Best match: idna 2.10
Processing idna-2.
Installing idna-2.
Installed /tmp/tmp0Z6R_
Searching for chardet<5,>=3.0.2
Reading https:/
Downloading https:/
Best match: chardet 4.0.0
Processing chardet-
Installing chardet-
Installed /tmp/tmp0Z6R_
Devices Certification Bot (ce-certification-qa) wrote : | # |
The merge was fine but running tests failed.
Already using interpreter /usr/bin/python3
running pytest
Searching for voluptuous
Reading https:/
Downloading https:/
Best match: voluptuous 0.12.1
Processing voluptuous-
Installing voluptuous-
Installed /tmp/tmp54If7g/
Searching for requests
Reading https:/
Downloading https:/
Best match: requests 2.25.1
Processing requests-
Installing requests-
Installed /tmp/tmp54If7g/
Searching for PyYAML
Reading https:/
Downloading https:/
Best match: PyYAML 5.3.1
Processing PyYAML-5.3.1.tar.gz
Writing /tmp/easy_
Running PyYAML-
Moving PyYAML-
Installed /tmp/tmp54If7g/
Searching for urllib3<
Reading https:/
Downloading https:/
Best match: urllib3 1.26.2
Processing urllib3-
Installing urllib3-
Installed /tmp/tmp54If7g/
Searching for idna<3,>=2.5
Reading https:/
Downloading https:/
Best match: idna 2.10
Processing idna-2.
Installing idna-2.
Installed /tmp/tmp54If7g/
Searching for chardet<5,>=3.0.2
Reading https:/
Downloading https:/
Best match: chardet 4.0.0
Processing chardet-
Installing chardet-
Installed /tmp/tmp54If7g/
Devices Certification Bot (ce-certification-qa) wrote : | # |
The merge was fine but running tests failed.
Already using interpreter /usr/bin/python3
running pytest
Searching for voluptuous
Reading https:/
Downloading https:/
Best match: voluptuous 0.12.1
Processing voluptuous-
Installing voluptuous-
Installed /tmp/tmpgg7OpS/
Searching for requests
Reading https:/
Downloading https:/
Best match: requests 2.25.1
Processing requests-
Installing requests-
Installed /tmp/tmpgg7OpS/
Searching for PyYAML
Reading https:/
Downloading https:/
Best match: PyYAML 5.3.1
Processing PyYAML-5.3.1.tar.gz
Writing /tmp/easy_
Running PyYAML-
Moving PyYAML-
Installed /tmp/tmpgg7OpS/
Searching for urllib3<
Reading https:/
Downloading https:/
Best match: urllib3 1.26.2
Processing urllib3-
Installing urllib3-
Installed /tmp/tmpgg7OpS/
Searching for idna<3,>=2.5
Reading https:/
Downloading https:/
Best match: idna 2.10
Processing idna-2.
Installing idna-2.
Installed /tmp/tmpgg7OpS/
Searching for chardet<5,>=3.0.2
Reading https:/
Downloading https:/
Best match: chardet 4.0.0
Processing chardet-
Installing chardet-
Installed /tmp/tmpgg7OpS/
Preview Diff
1 | diff --git a/.pmr-merge-hook b/.pmr-merge-hook |
2 | index c1ce1ee..394df16 100755 |
3 | --- a/.pmr-merge-hook |
4 | +++ b/.pmr-merge-hook |
5 | @@ -3,6 +3,6 @@ |
6 | set -e |
7 | |
8 | rm -rf tfenv |
9 | -virtualenv -qp python3 tfenv |
10 | +virtualenv -q -p python3 tfenv |
11 | . tfenv/bin/activate |
12 | ./setup.py test |
13 | diff --git a/testflinger_agent/job.py b/testflinger_agent/job.py |
14 | index 7c0cd73..b76dfdc 100644 |
15 | --- a/testflinger_agent/job.py |
16 | +++ b/testflinger_agent/job.py |
17 | @@ -187,7 +187,11 @@ class TestflingerJob: |
18 | f.write(buf) |
19 | if live_output_buffer: |
20 | self.client.post_live_output(self.job_id, live_output_buffer) |
21 | - return process.returncode |
22 | + try: |
23 | + status = process.wait(10) # process.returncode |
24 | + except TimeoutError: |
25 | + status = 99 # Default in case something goes wrong |
26 | + return status |
27 | |
28 | def get_global_timeout(self): |
29 | """Get the global timeout for the test run in seconds |
I had to go look up docs for Popen to check exactly what wait does. There's a note about a potential deadlock, "Note This will deadlock when using stdout=PIPE or stderr=PIPE and the child process generates enough output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data. Use Popen.communicate() when using pipes to avoid that."
Is that a concern here? The note is vague on what is 'enough' output.