-
Notifications
You must be signed in to change notification settings - Fork 143
ci: Add codspeed for performance monitoring #2516
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
Draft
FBruzzesi
wants to merge
13
commits into
main
Choose a base branch
from
ci/add-codspeed-for-perf-monitoring
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8d0199d
ci: Add codspeed for performance monitoring
FBruzzesi d130a87
simplify
FBruzzesi b9e8ff4
typo
FBruzzesi 4a4c47a
need to use proper action
FBruzzesi 44234d2
Merge branch 'main' into ci/add-codspeed-for-perf-monitoring
FBruzzesi dfac302
refactor in the wild
FBruzzesi 5d3a598
try with binding
FBruzzesi f8c4bd2
try to simplify
FBruzzesi 12bdeed
parametrize backend
FBruzzesi f698e7a
something is off with dask
FBruzzesi 04b13e2
one more
FBruzzesi 6a62144
numpy<2
FBruzzesi cda5ee0
ok I think we are there
FBruzzesi 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,25 +1,51 @@ | ||
from __future__ import annotations | ||
|
||
import subprocess | ||
import sys | ||
from pathlib import Path | ||
from typing import TYPE_CHECKING | ||
from typing import Any | ||
|
||
import pytest | ||
|
||
from tpch.execute import BACKEND_NAMESPACE_KWARGS_MAP | ||
from tpch.execute import DUCKDB_SKIPS | ||
from tpch.execute import _execute_query_single_backend | ||
from tpch.execute import execute_query | ||
|
||
if TYPE_CHECKING: | ||
from types import ModuleType | ||
|
||
from pytest_codspeed.plugin import BenchmarkFixture | ||
|
||
|
||
ROOT_PATH = Path(__file__).resolve().parent.parent | ||
# Directory containing all the query scripts | ||
QUERIES_DIR = ROOT_PATH / "queries" | ||
|
||
|
||
@pytest.mark.parametrize("query_path", QUERIES_DIR.glob("q[1-9]*.py")) | ||
def test_execute_scripts(query_path: Path) -> None: | ||
def test_execute_query(query_path: Path) -> None: | ||
print(f"executing query {query_path.stem}") # noqa: T201 | ||
result = subprocess.run( # noqa: S603 | ||
[sys.executable, "-m", "execute", str(query_path.stem)], | ||
capture_output=True, | ||
text=True, | ||
check=False, | ||
) | ||
assert result.returncode == 0, ( | ||
f"Script {query_path} failed with error: {result.stderr}" | ||
_ = execute_query(query_id=query_path.stem) | ||
|
||
|
||
@pytest.mark.parametrize("query_path", QUERIES_DIR.glob("q[1-9]*.py")) | ||
@pytest.mark.parametrize( | ||
("backend", "namespace_and_kwargs"), BACKEND_NAMESPACE_KWARGS_MAP.items() | ||
) | ||
def test_benchmark_query( | ||
benchmark: BenchmarkFixture, | ||
query_path: Path, | ||
backend: str, | ||
namespace_and_kwargs: tuple[ModuleType, dict[str, Any]], | ||
) -> None: | ||
query_id = query_path.stem | ||
native_namespace, kwargs = namespace_and_kwargs | ||
|
||
if backend in {"duckdb", "sqlframe"} and query_id in DUCKDB_SKIPS: | ||
pytest.skip() | ||
|
||
_ = benchmark( | ||
lambda: _execute_query_single_backend( | ||
query_id=query_id, native_namespace=native_namespace, **kwargs | ||
) | ||
) |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
@FBruzzesi (#805 (comment))
I found the bit in the docs that used
0.01
(https://duckdb.org/docs/0.10/extensions/tpch#listing-expected-answers)If we can run these with 10x less data, surely we should right?
The current run has been going for almost 2 hours π
(https://github.com/narwhals-dev/narwhals/actions/runs/15098359607/job/42436026213?pr=2516)
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.
Yes I have been monitoring it - it's a bit odd, isn't it? I am not fully sure what's going on π€