Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
galipremsagar committed Sep 12, 2024
1 parent 695bf30 commit 264a444
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/cudf/cudf/pandas/scripts/conftest-patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def pytest_runtest_teardown(item, nextitem):
):
# Write the function call counts to a file
worker_id = os.getenv("PYTEST_XDIST_WORKER", "master")
output_file = f'function_call_counts_{os.path.basename(item.nodeid.split("::")[0])}_{worker_id}.json'
output_file = f'{item.nodeid.split("::")[0].replace("/", "__")}_{worker_id}_metrics.json'
with open(output_file, "w") as f:
json.dump(dict(function_call_counts), f, indent=4)
print(f"Function call counts have been written to {output_file}")
Expand Down
7 changes: 6 additions & 1 deletion python/cudf/cudf/pandas/scripts/run-pandas-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ TEST_THAT_CRASH_PYTEST_WORKERS="not test_bitmasks_pyarrow \
and not test_large_string_pyarrow \
and not test_interchange_from_corrected_buffer_dtypes \
and not test_eof_states \
and not test_array_tz"
and not test_array_tz \
and not test_groupby_raises_category"

# TODO: Remove "not db" once a postgres & mysql container is set up on the CI
PANDAS_CI="1" timeout 600m python -m pytest -p cudf.pandas \
Expand All @@ -145,9 +146,13 @@ PANDAS_CI="1" timeout 600m python -m pytest -p cudf.pandas \
"$@" || [ $? = 1 ] # Exit success if exit code was 1 (permit test failures but not other errors)

mv *.json ..
pwd
ls -al
pwd
ls -al tests/
cd ..
pwd
ls -al
pwd
ls -al pandas-tests/
rm -rf pandas-testing/pandas-tests/
23 changes: 23 additions & 0 deletions python/cudf/cudf/pandas/scripts/summarize-test-results.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"""

import argparse
import glob
import json
import os

from rich.console import Console
from rich.table import Table
Expand Down Expand Up @@ -57,6 +59,27 @@ def get_per_module_results(log_file_name):
per_module_results[module_name].setdefault(outcome, 0)
per_module_results[module_name]["total"] += 1
per_module_results[module_name][outcome] += 1

for key, value in per_module_results.items():
processed_name = key.replace("/", "__") + "_*_metrics.json"
# Assuming the directory is the same as the module name's directory
# directory = os.path.dirname(os.getcwd())
pattern = os.path.join(
"/nvme/0/pgali/cudf/pandas-testing", processed_name
)
matching_files = glob.glob(pattern)
for file in matching_files:
with open(file) as f:
function_call_counts = json.load(f)
per_module_results[key]["_slow_function_call"] = (
per_module_results[key].get("_slow_function_call", 0)
+ function_call_counts.get("_slow_function_call", 0)
)
per_module_results[key]["_fast_function_call"] = (
per_module_results[key].get("_fast_function_call", 0)
+ function_call_counts.get("_fast_function_call", 0)
)
# value["function_call_counts"] = function_call_counts
return per_module_results


Expand Down
2 changes: 1 addition & 1 deletion python/cudf/cudf_pandas_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def pytest_runtest_teardown(item, nextitem):
):
# Write the function call counts to a file
worker_id = os.getenv("PYTEST_XDIST_WORKER", "master")
output_file = f'function_call_counts_{os.path.basename(item.nodeid.split("::")[0])}_{worker_id}.json'
output_file = f'{item.nodeid.split("::")[0].replace("/", "__")}_{worker_id}_metrics.json'
with open(output_file, "w") as f:
json.dump(dict(function_call_counts), f)
# for func, count in function_call_counts.items():
Expand Down

0 comments on commit 264a444

Please sign in to comment.