Skip to content

ci(unit): run the two slowest shards on 4 workers - #46743

Merged
klu-berri merged 1 commit into
mainfrom
litellm_unit_shards_use_4_workers
Oct 15, 2026
Merged

klu-berri merged 1 commit into
mainfrom
litellm_unit_shards_use_4_workers

Conversation

@klu-berri

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • unit takes ~19 min wall, set by two 11.5 min shards
  • mcp-elicitation and enterprise-repositories-secrets run workers: 2 on a 4 vCPU runner
  • loadscope pins the 182-test test_secret_detection.py to one worker for 9+ min

How it solves it:

  • workers: 2 -> workers: 4 on both shards, like the other 34 shards
  • dist: loadscope -> dist: load on enterprise-repositories-secrets so that one file spreads over all 4 workers
  • No new shards, no test changes

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Screenshots / Proof of Fix

Shard wall time from the unit workflow, Run tests step plus setup, taken from the GitHub Actions jobs API

Before (fac0135, main run 38790388063)

  1. gh api repos/BerriAI/litellm/actions/runs/38790388063/jobs --paginate --jq '.jobs[]|[.name, .started_at, .completed_at]'
  2. mcp-elicitation 11.8 min, enterprise-repositories-secrets 11.6 min, enterprise-routing 9.6 min, median shard ~3.5 min, unit passed at 19.0 min after the run started
  3. In the enterprise-repositories-secrets log, test_secret_detection.py ran on one worker from first to last test for 556 s

After (aff3892)

Filled in once this PR's own unit run finishes

Type

🚄 Infrastructure

Caveats (if any)

Low

  • dist: load runs tests from one file on different workers, so the secrets shard no longer keeps a file's tests together
    • test_secret_detection.py passed 182/182 locally with -n 4 --dist load, and its only shared state is a per-test autouse contextvar reset
  • The 3.7 s per-test setup in that shard comes from tests/unit/enterprise/conftest.py reloading litellm under --cov before every test, this PR spreads it rather than removing it

Link to Devin session: https://app.devin.ai/sessions/37bced2a0a84442db236be528fd89ec6
Open in Devin Desktop: https://app.devin.ai/desktop/session/37bced2a0a84442db236be528fd89ec6?variant=devin
Requested by: @kerrylu-berri

@klu-berri
klu-berri requested a review from a team October 15, 2026 19:28
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@greptile-apps

greptile-apps Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Automatic reviews are disabled for this repository.

@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@klu-berri

Copy link
Copy Markdown
Contributor Author

@litellm-stampbot

@litellm-stampbot

Copy link
Copy Markdown

litellm-stampbot: risk low

Approved at aff3892.

Rules (stampbot/risk_rules.yml):

  • low: no rule flagged it

Judge (gpt-6-luna): low, probability of high 0.10 (high at or above 0.90)

  • risk: low (probability of high 0.10)

Pushes do not re-run this check. Comment @litellm-stampbot again to re-check the new head.

@litellm-stampbot litellm-stampbot Bot added the risk:low Small, isolated, low-risk change label Oct 15, 2026

@kerry-berri kerry-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low risk by rule and by judgement at aff3892

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@klu-berri
klu-berri enabled auto-merge (squash) October 15, 2026 19:35
@klu-berri
klu-berri merged commit 1209895 into main Oct 15, 2026
86 checks passed
@klu-berri
klu-berri deleted the litellm_unit_shards_use_4_workers branch October 15, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Small, isolated, low-risk change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants