-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from se1exin/get_dupes_refactor_and_bench
chore: get_dupes refactor and benchmarks
- Loading branch information
Showing
4 changed files
with
74 additions
and
24 deletions.
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# this file is meant for local development only. it expects a populated .env file | ||
# with connection details to a valid plex server. it can be run via pytest, which | ||
# will run multiple iterations and rounds of the get_dupe_content method, or can | ||
# be invoked directly with ./backend/benchmark.py to simply run get_dupe_content() | ||
# and print traces to stdout (note: traces only available if DEBUG=1 set) | ||
|
||
import pytest | ||
import time | ||
from plexwrapper import PlexWrapper | ||
from utils import print_top_traces | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
|
||
def get_dupe_content(): | ||
PlexWrapper().get_dupe_content() | ||
|
||
def test_get_dupe_content(benchmark): | ||
benchmark.pedantic(get_dupe_content, iterations=10, rounds=3) | ||
|
||
|
||
# allow for direct invocation, without pytest | ||
if __name__ == "__main__": | ||
get_dupe_content() | ||
print_top_traces(10) |
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