-
-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sleep commands to avoid HTTP 429 error #906
Conversation
Apparently the format of the JSON files from the UN have changed. Using cc @rickecon |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #906 +/- ##
==========================================
- Coverage 80.72% 79.84% -0.88%
==========================================
Files 19 19
Lines 4499 4506 +7
==========================================
- Hits 3632 3598 -34
- Misses 867 908 +41
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@SeaCelo asked a good question -- why download in JSON format as opposed to CSV? That solved it -- no more "too many requests" because you get in one page of CSV data what 15+ pages of JSON was giving you. This PR now makes the switch to retrieve the UN data in CSV format and adds an option to download data from any of the functions which retrieve data from the UN portal. It's easy to use these retrieved data in the I'd noticed some odd issues in the GH Actions tests (e.g., a failure in |
3.9 test failure is the UN API throwing an HTTP code 403 -- a denial of access. We will see if this is specific to calls coming from 3.9 (at least one of the 3.10 tests has passed without such an error. |
@jdebacker. I ran all the OG-Core tests locally yesterday and last night (11 hrs, 33 min) and I only got three errors. And the three errors were
|
@jdebacker. The three |
@jdebacker. I think we should merge this PR with the errors. Then create an issue documenting the errors. Then I would propose opening a new PR that makes all tests that access the |
@rickecon Thanks for your review! Latest commits make your proposed changes (I think) -- I marked all tests that I think talk to the data portal as "local" and use cached data for that other tests. I hope to have all CI tests passing before merging this PR. |
Tests of demographics.py ok now. But still getting weird failures in TPI: FAILED tests/test_TPI.py::test_run_TPI[Baseline] - concurrent.futures._base.CancelledError: root-3e362076-3158-4fe9-a38a-2cbd498c2091 Any ideas @rickecon ? |
@jdebacker. The error in all three cases is |
@jdebacker. The two TPI tests that are failing, I think are failing because they require the new demographic data files to already be in the repository master file folder. With this hypothesis, I am going to open and merge PR #907 that puts these files in the |
@jdebacker. By adding the demographics data files to the In the meantime, you should update the version in |
That's all odd - given I had added those data in this PR, I think the tests should be pulling the cached demographic data from this branch just fine for the test. I did see a failure with an HTTP 429 error as I forgot to mark a test that does ping the UN. Just fixed that. The error in
|
@jdebacker. I am still re-running tests one-by-one, although both Mac OS Python 3.10 and Python 3.11 have now failed. I don't know what the issue is, and I can't find any related GitHub issues, Dask issues, or StackOverflow threads that are related to this (e.g., "GitHub Action Dask concurrent.futures._base.CancelledError"). This problem seems to have arisen with this most recent pull request. And I don't think it is related to the content of this PR, although iI guess it could still be some rogue calls to the UN API. I recommend we try the following changes.
NUM_WORKERS = min(multiprocessing.cpu_count(), 4)
|
@rickecon @jdebacker We are in touch with the API developers to see what is causing the errors. They are asking for some code that replicates it. Can you share something that they can run in python to test? cc: @sezdi0810 |
@jdebacker. We know this passes tests locally. We can make an issue about these tests not passing. Merging. |
This PR adds sleep commands to avoid HTTP 429 error from accessing the UN data portal for demographics data.