Reduce API call limit error#93
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #93 +/- ##
==========================================
- Coverage 89.08% 83.16% -5.92%
==========================================
Files 9 9
Lines 174 196 +22
==========================================
+ Hits 155 163 +8
- Misses 19 33 +14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@not522 Could you review this PR? |
not522
left a comment
There was a problem hiding this comment.
Thank you for your PR. Could you check my comments?
|
@gen740 Could you review this PR? |
nabenabe0928
left a comment
There was a problem hiding this comment.
I checked the PR except for _download_via_git:)
Co-authored-by: Naoto Mizuno <naotomizuno@preferred.jp>
| If ``auth`` is :obj:`None` and the ``git`` command is available, this should be the base URI for the remote repository. | ||
| In this case, specifying ``git@github.com`` allows access to private/internal repositories via SSH. | ||
| Otherwise, this should be the base URL for the GitHub API. |
There was a problem hiding this comment.
| If ``auth`` is :obj:`None` and the ``git`` command is available, this should be the base URI for the remote repository. | |
| In this case, specifying ``git@github.com`` allows access to private/internal repositories via SSH. | |
| Otherwise, this should be the base URL for the GitHub API. | |
| If ``auth`` is :obj:`None` and the ``git`` command is available, this should be the | |
| base URI, e.g., ``github.enterprise.com`` and ``gitlab.com``, for the remote | |
| repository. | |
| In this case, specifying ``git@github.com`` allows access to private/internal repositories via SSH. | |
| Otherwise, this should be the base URL for the GitHub API. |
There was a problem hiding this comment.
Thank you for your suggestion! However, the examples you suggested are actually the opposite, and the URL is incorrect---https://api.github.com, https://github.enterprise.com/api/v3, and https://gitlab.com/api/v4 are the examples for the GitHub API. Also, the endpoints for GitHub Enterprise, GitLab, and other services are not limited to this, since they support custom domains.12
So let me update the docstring with modifications.
Footnotes
|
I confirmed that the change worked nicely! $ pip install git+https://github.com/kAIto47802/optunahub.git@reduce-api-call-limit
$ python -c "import optunahub; optunahub.load_module("samplers/ctpe")"
$ ls .cache/optunahub/github.com/optuna/optunahub-registry/main/package/samplers/
ctpe |
nabenabe0928
left a comment
There was a problem hiding this comment.
Unit tests also look good to me!
not522
left a comment
There was a problem hiding this comment.
Thank you for update! It's almost LGTM. Please check my comment for _download_via_github_api.
|
I merged the main branch and verified that the merged version also works nicely:) |
@kAIto47802 |
Co-authored-by: Naoto Mizuno <naotomizuno@preferred.jp>
|
@nabenabe0928 Footnotes |
not522
left a comment
There was a problem hiding this comment.
LGTM!
@nabenabe0928 Please merge this PR after your concern is resolved.
Motivation
Currently, the
load_modulefunction often gets stuck due to the rate limit for the GitHub REST API.The rate limit for unauthenticated requests is 60 requests per hour, which is very strict.
The error message looks like this:
Description of the changes
gitcommand when available to avoid the rate limit.Benchmarking results
I benchmarked:
samplers/auto_samplercan be loaded within one minute; andSetups
The benchmark code I used here is as follows:
The benchmarks were run five times for both the original and the new implementation.
I used a different Google Colaboratory notebook for each benchmarking run to ensure a different IP address was used every time. (Also, I confirmed the attached VM's IP address is certainly different by using the command
curl ifconfig.me.)Results
The average number of times
load_modulewas successfully executed without hitting the API rate limit is as follows:With the new implementation, running continuous downloads for one minute does not hit a rate limit across all five runs. (Therefore, it is indicated with a dash (–) in the table.)
The average time for downloading once is as follows: