Skip to content

Commit 144cee9

Browse files
AbhishekAbhishek9639
authored andcommitted
Update profile_tests.sh: add -n workers, --dist=load, remove -q
- Add -n flag for parallel workers (default: 4) - Add --dist=load to distribute tests across workers - Remove -q flag for full pytest output - Mimics exact pytest command used in CI
1 parent c8fd9a9 commit 144cee9

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

scripts/profile_tests.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,48 @@
77
# -m MARKER Pytest marker filter (default: "not production_server and not test_server")
88
# -d DURATION Number of slowest durations to show, 0 for all (default: 20)
99
# -t TIMEOUT Per-test timeout in seconds (default: 300)
10+
# -n WORKERS Number of parallel workers (default: 4)
1011
# -o OUTPUT Output file path for the report (default: test_durations_report.txt)
1112
#
1213
# Examples:
1314
# ./scripts/profile_tests.sh
1415
# ./scripts/profile_tests.sh -m "production_server" -d 0 -t 600
15-
# ./scripts/profile_tests.sh -m "sklearn" -o sklearn_report.txt
16+
# ./scripts/profile_tests.sh -m "sklearn" -n 2 -o sklearn_report.txt
1617

1718
set -euo pipefail
1819

1920
# Default values
2021
MARKER_FILTER="not production_server and not test_server"
2122
DURATIONS=20
2223
TIMEOUT=300
24+
NUM_WORKERS=4
2325
OUTPUT_FILE="test_durations_report.txt"
2426

2527
# Parse command line arguments
26-
while getopts "m:d:t:o:" opt; do
28+
while getopts "m:d:t:n:o:" opt; do
2729
case $opt in
2830
m) MARKER_FILTER="$OPTARG" ;;
2931
d) DURATIONS="$OPTARG" ;;
3032
t) TIMEOUT="$OPTARG" ;;
33+
n) NUM_WORKERS="$OPTARG" ;;
3134
o) OUTPUT_FILE="$OPTARG" ;;
32-
*) echo "Usage: $0 [-m marker] [-d durations] [-t timeout] [-o output_file]" && exit 1 ;;
35+
*) echo "Usage: $0 [-m marker] [-d durations] [-t timeout] [-n workers] [-o output_file]" && exit 1 ;;
3336
esac
3437
done
3538

3639
echo "=== OpenML Test Duration Profiler ==="
3740
echo "Marker filter: $MARKER_FILTER"
3841
echo "Durations to show: $DURATIONS"
3942
echo "Timeout per test: ${TIMEOUT}s"
43+
echo "Workers: $NUM_WORKERS"
4044
echo "Output file: $OUTPUT_FILE"
4145
echo ""
4246

4347
pytest \
48+
--dist=load \
49+
-n="$NUM_WORKERS" \
4450
--durations="$DURATIONS" \
4551
--timeout="$TIMEOUT" \
46-
-q \
4752
-m "$MARKER_FILTER" \
4853
2>&1 | tee "$OUTPUT_FILE"
4954

0 commit comments

Comments
 (0)