Skip to content

Fix excessive disk usage from redundant .cache dirs in local provider runs#1610

Merged
aliasaria merged 3 commits intomainfrom
fix/local-provider-shared-cache
Mar 23, 2026
Merged

Fix excessive disk usage from redundant .cache dirs in local provider runs#1610
aliasaria merged 3 commits intomainfrom
fix/local-provider-shared-cache

Conversation

@aliasaria
Copy link
Copy Markdown
Member

Summary

  • Set HF_HOME and XDG_CACHE_HOME to the real user's cache directories when launching local provider jobs, so Hugging Face models and other cached assets are shared across runs instead of being re-downloaded into each job's remapped HOME.
  • UV_CACHE_DIR was already shared; this closes the gap for HF and XDG caches.
  • Uses setdefault so explicit user overrides via config.env_vars still take precedence.

Fixes #1604

Test plan

  • Trigger multiple local provider runs and verify that local_provider_runs/<job_id>/workspace/.cache is no longer created with large HF model files
  • Confirm HF models are read from the host's ~/.cache/huggingface
  • Verify that setting HF_HOME explicitly in env_vars still overrides the default

… runs

Set HF_HOME and XDG_CACHE_HOME to the real user's cache directories so
that Hugging Face models and other cached assets are shared across job
runs instead of being re-downloaded into each job's remapped HOME.

Fixes #1604
@sentry
Copy link
Copy Markdown

sentry bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
api/transformerlab/compute_providers/local.py 0.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@paragon-review
Copy link
Copy Markdown

Paragon Summary

This pull request review analyzed 1 file and found no issues. The review examined code changes, potential bugs, security vulnerabilities, performance issues, and code quality concerns using automated analysis tools.

Paragon did not detect any problems in the current diff. Proceed with merge after your normal checks.

This PR fixes excessive disk usage by configuring local provider jobs to share the host user's Hugging Face and XDG cache directories instead of creating redundant per-job caches that require re-downloading large model files for each run.

Key changes:

  • Sets HF_HOME and XDG_CACHE_HOME to user's real cache directories for local provider jobs
  • Prevents redundant downloads by sharing cached HF models across runs instead of per-job isolation
  • Uses setdefault to preserve user overrides from config.env_vars
  • Changes only in api/transformerlab/compute_providers/local.py

Confidence score: 5/5

  • This PR has low risk with no critical or high-priority issues identified
  • Score reflects clean code review with only minor suggestions or no issues found
  • Code quality checks passed - safe to proceed with merge

1 file reviewed, 0 comments


Tip: @paragon-run <instructions> to chat with our agent or push fixes!

Dashboard

Copy link
Copy Markdown
Member

@deep1401 deep1401 left a comment

Choose a reason for hiding this comment

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

Maybe UV_CACHE_DIR can also just point to the .cache/uv thing?

@aliasaria aliasaria merged commit 542e0cb into main Mar 23, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Excessive disk usage in local_provider_runs due to redundant .cache directories

2 participants