question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[testing] making network tests more reliable

See original GitHub issue

We 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:

  1. time.sleep(3)
  2. 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

@LysandreJik

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:24 (24 by maintainers)

github_iconTop GitHub Comments

2reactions
LysandreJikcommented, Nov 19, 2021

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.

1reaction
LysandreJikcommented, Jan 17, 2022

Thank you for handling the github bot - would love to make time for this this or next week.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found