Skip to content

Commit 119a8c7

Browse files
authored
lazy loading of all modules in init (#405)
* lazy loading of all modules in init * cli reduce * lazy loading * updated cli tests * updated cli * updated cli * updated cli test * updated workflow
1 parent b42c27d commit 119a8c7

8 files changed

Lines changed: 717 additions & 193 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: EP CLI Benchmark
2+
3+
# Run daily at 6 AM UTC (10 PM PST / 11 PM PDT)
4+
on:
5+
schedule:
6+
- cron: '0 6 * * *'
7+
workflow_dispatch: # Allow manual triggering
8+
9+
jobs:
10+
benchmark:
11+
name: CLI Startup & Import Benchmark
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.10", "3.11", "3.12"]
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v6
32+
with:
33+
enable-cache: true
34+
35+
- name: Install the project
36+
run: uv sync --locked --all-extras --dev
37+
38+
- name: Run Benchmark Tests
39+
id: benchmark
40+
env:
41+
RUN_BENCHMARK_TESTS: "1"
42+
PYTHONWARNINGS: "ignore::DeprecationWarning,ignore::RuntimeWarning"
43+
run: |
44+
echo "Running EP CLI benchmark tests..."
45+
set +e
46+
47+
uv run pytest tests/test_cli_startup_benchmark.py -v --tb=short --durations=10 2>&1 | tee benchmark_output.log
48+
49+
BENCHMARK_EXIT_CODE=$?
50+
echo "benchmark_exit_code=$BENCHMARK_EXIT_CODE" >> $GITHUB_OUTPUT
51+
52+
if [ $BENCHMARK_EXIT_CODE -eq 0 ]; then
53+
echo "✅ Benchmark tests passed"
54+
else
55+
echo "❌ Benchmark tests failed"
56+
fi
57+
58+
exit $BENCHMARK_EXIT_CODE
59+
60+
- name: Upload benchmark results
61+
if: always()
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: benchmark-results-py${{ matrix.python-version }}-${{ github.run_number }}
65+
path: benchmark_output.log
66+
retention-days: 30
67+
68+
- name: Send failure notification to Slack
69+
uses: act10ns/slack@v1
70+
if: failure()
71+
with:
72+
status: failure
73+
message: |
74+
🐌 EP CLI Benchmark Failed (Python ${{ matrix.python-version }})
75+
CLI startup or import times exceeded thresholds.
76+
Check for new imports or heavy dependencies.
77+
Job: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
78+
env:
79+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)