[testing] making network tests more reliable
See original GitHub issueWe have a group of tests that require a reliable network, which is never 100% so they fail for many months.
I propose that those tests will be rewritten with unstable network in mind and include:
time.sleep(3)
- retry 3-5 times
e.g. one of the candidates is:
tests/test_hf_api.py::HfApiEndpointsTest::test_list_repos_objs
but also recent tests that push to hub.
Perhaps a simple retry context manager can be added to testing_utils.py
, which would trap exceptions and retry after a pause. And then simply wrap the content of existing tests into that context manager, e.g.:
with RetryAfterSleepTest():
# normal test code
it could accept the number of retries and sleep time between retries for optional arguments.
Of course, it’s probably even better to make it also a decorator. e.g. @unreliable_network_retry
Issue Analytics
- State:
- Created 2 years ago
- Comments:24 (24 by maintainers)
Top Results From Across the Web
5 Rules for a More Accurate Internet Speed Test - Lifewire
Internet speed tests are great for testing bandwidth, but they're notoriously inaccurate. Here are 5 things to do to help make that test ......
Read more >Why network testing is important | NetBeez
Network testing is important to test and validate your network design. Here's a list of handful of command line tools to do so....
Read more >Best Internet Speed Tests of 2022: Here's How Fast ... - CNET
Try out some of these recommended internet speed tests to make sure ... or Flash to run your test, which can make for...
Read more >How reliable are Internet Speed Test and why do speed ...
Checking our internet speed is one of the first ways we diagnose our internet speed issues and when we see those terrible results...
Read more >The Nitty Gritty Necessity of Network Testing - NETdepot
Network testing is a way to verify the stability of your network. One can do it on both hardware and software. But it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That sounds good, even if I’m a bit afraid that retrying in succession won’t solve much. When a test fails for server error, then usually other tests fail. I’m still open to trying it out to see if it improves these errors!
Would you like to give it a try? I’m guessing only this method needs to be modified: https://github.com/huggingface/transformers/blob/efea0f868bd381244e3cef51b388293e41a36d1e/src/transformers/file_utils.py#L1594
cc @julien-c as this is a safeguard against the server’s instabilities.
Thank you for handling the github bot - would love to make time for this this or next week.