-
Notifications
You must be signed in to change notification settings - Fork 9
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
dependency caching #10
Closed
+190
−11
Closed
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
57c8e53
dependency caching
AndreSlavescu 4737c28
local test workflow
AndreSlavescu 4597336
local test update with uv
AndreSlavescu 696dda4
end to end test
AndreSlavescu e6a7153
Merge main into dep-cache branch to sync changes
AndreSlavescu 0384a3c
using uv and added pytorch example
AndreSlavescu 76969f4
make venv
AndreSlavescu a520f19
pip caching
AndreSlavescu 8434013
cache uv deps
AndreSlavescu e7ba478
testing
AndreSlavescu 8185012
typing extensions
AndreSlavescu 1bcbfb0
remove no-deps
AndreSlavescu 044609d
speed up cache
AndreSlavescu e878a9f
speed up caching
AndreSlavescu bd8b462
fix
AndreSlavescu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
PyGithub | ||
aiohttp | ||
discord.py | ||
audioop-lts # discord.py imports using * syntax | ||
python-dotenv | ||
requests | ||
requests | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import subprocess | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the github action should report how long it takes to run which will be more indicative of actual performance. see my caching prs i noticed caching would be slower than without |
||
import time | ||
import os | ||
import logging | ||
|
||
logging.basicConfig( | ||
level=logging.INFO, | ||
format='%(asctime)s - %(levelname)s - %(message)s', | ||
datefmt='%Y-%m-%d %H:%M:%S' | ||
) | ||
logger = logging.getLogger(__name__) | ||
|
||
def test_pytorch_install(): | ||
cache_dir = os.path.expanduser("~/.cache/pip") | ||
|
||
if os.path.exists(cache_dir): | ||
subprocess.run(["rm", "-rf", cache_dir]) | ||
|
||
start_time = time.time() | ||
result = subprocess.run( | ||
["pip", "install", "-r", "requirements.txt"], | ||
capture_output=True, | ||
text=True | ||
) | ||
|
||
if result.returncode != 0: | ||
logger.error(f"pip install failed with output:\n{result.stdout}\n{result.stderr}") | ||
raise AssertionError("First pip install failed") | ||
|
||
first_run_time = time.time() - start_time | ||
logger.info(f"First run (no cache) took: {first_run_time:.2f} seconds") | ||
|
||
start_time = time.time() | ||
result = subprocess.run( | ||
["pip", "install", "-r", "requirements.txt"], | ||
capture_output=True, | ||
text=True | ||
) | ||
|
||
if result.returncode != 0: | ||
logger.error(f"Second pip install failed with output:\n{result.stdout}\n{result.stderr}") | ||
raise AssertionError("Second pip install failed") | ||
|
||
second_run_time = time.time() - start_time | ||
logger.info(f"Second run (with cache) took: {second_run_time:.2f} seconds") | ||
|
||
improvement = (first_run_time - second_run_time) / first_run_time * 100 | ||
logger.info(f"Cache improved installation time by {improvement:.1f}%") | ||
|
||
assert improvement > 0, "Cache did not improve installation time" | ||
assert improvement > 10, f"Cache improvement ({improvement:.1f}%) was less than 10%" | ||
|
||
if __name__ == "__main__": | ||
try: | ||
import pytest | ||
pytest.main([__file__]) | ||
except ImportError: | ||
test_pytorch_install() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need most these requirements to run the file, we mostly need them to run the bot which is not yet properly tested in CI