biocore / biocore/LabControl

connection often times out on `test_download` and `test_get_download_normalization_process_handler`

Open
#588 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2
Forks
15
PR merge metrics
No merged PRs in 30d

Description

> Something potentially gnarly, but likely out of the scope of this PR... I ran [ea536f3](https://github.com/biocore/LabControl/commit/ea536f3faf559bce9b7c440b5ac6b493fce40de6)'s build twice ([this one](https://travis-ci.org/biocore/LabControl/builds/581932706)), and it passed the first time but failed on the two "download" tests (`test_download` and `test_get_download_normalization_process_handler`) when run again.
>
> Since these failures were both caused by `AssertionError: Async operation timed out after 10 seconds`, it seems like this is an intermittent error due to network problems (???). Not sure how best to handle this, but as a brute-force solution using `travis_retry` with the python tests might work.

You're right, this has been a recurrent problem I've noticed in the past couple weeks. I think there are a couple things we can do to try to reduce this.
* Increase the `timeout` limit in the line below:
https://github.com/biocore/LabControl/blob/1427ad163682ff11b1086e0e3b1010ba1a2166ee/labcontrol/gui/testing.py#L71
* add retry functionality _within_ the test, e.g. something like [this](https://stackoverflow.com/questions/31529151/python-3-urllib-urlretrieve-retry-on-download-fail):
```
class TestDownloadLibraryPrepShotgunProcessHandler(TestHandlerBase):
def test_download(self):
retries = 0
response = None
while retries < 5:
try:
response = self.get(
'/process/library_prep_shotgun/%d/echo_pick_list' % 1)
except AssertionError:
print("Error downloading on try {}.".format(retries))
else:
break
if response is None:
raise AssertionError("Async operation timed out after maximum number of retries.")

self.assertNotEqual(response.body, '')
self.assertTrue(response.body.startswith(
b'Sample ID\tSource Plate Name\t'))
self.assertEqual(response.headers['Content-Disposition'],
"attachment; filename=2017-10-25_"
"Test_compressed_gDNA_plates_1-4_indices.txt")

```

_Originally posted by @gwarmstrong in https://github.com/biocore/LabControl/pull/585#issuecomment-529705330_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.