You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Workspace environment persisted in the network volume (#10)
* chore: make clean and make upgrade
* ci: make test|test-unit|test-integration|test-coverage|test-fast
* ci: make lint|lint-fix|format|format-check
* build: updated dependencies to latest
* chore: update tetra-rp
* ci: simplified CI workflow + manual deploy action
* test: sample unit and integration tests
Coverage fails when at below 50%. We can increase this later.
* chore: make lint-fix
* chore: make dev as default when running `make`
* chore: `make` shows help list of all available commands
* chore: forgot to include python 3.10 in the tests
* chore: ruff should exclude tetra-rp sub-module
* ci: test coverage fails at <35% (temp)
* test: auto-mark unit and integration tests appropriately
* ci: make typecheck with mypy as quality-check
* chore: reset uv.lock
* test: add comprehensive test foundation for volume workspace TDD
Establish testing infrastructure and protocol validation tests. Create shared fixtures and validates the FunctionRequest/FunctionResponse data models that will be extended for volume workspace functionality.
* test: volume detection and workspace initialization
Tests volume detection, virtual environment creation, file-based locking for concurrency, and timeout handling mechanisms.
* test: volume-aware execution context
Validates that functions execute in volume workspace, can access persistent packages, and fallback gracefully when volume is unavailable.
* test: integration tests for end-to-end workflows
Tests complete request workflows, concurrent access safety, mixed execution scenarios, and realistic error handling patterns.
* feat: implement core volume workspace detection and initialization
Adds volume detection logic, workspace initialization with file-based locking, virtual environment creation, and timeout handling to make some tests pass.
* feat: add differential dependency management for volume persistence
Implement smart dependency installation that only installs missing packages. Optimizes performance by leveraging persistent volume storage and avoiding redundant package installations.
* feat: implement volume-aware execution context and environment configuration
Enable functions to execute in volume workspace with access to persistent packages. Configures Python path, environment variables, and UV cache to utilize volume storage effectively.
* test: enhance existing test suites for volume workspace compatibility
Update existing tests to work with new volume workspace functionality. Ensures backward compatibility and validates that all existing functionality continues to work with the new volume-aware implementation.
* build: make update + cleanup
* chore: update tetra-rp submodule
* chore: updated CLAUDE.md
* chore: update CLAUDE.md
* chore: break out the large handler into modules also their tests
* refactor: constants for the magic values
* refactor: move Python files to src/ directory
- Move all Python modules to src/ for better organization
- Update Docker files to copy from src/ directory
- Update pyproject.toml with src/ in pythonpath
- Update Makefile to copy remote_execution.py to src/
- All tests pass with new structure
* feat: add virtual environment validation and repair
- Add _validate_virtual_environment() method to WorkspaceManager with symlink chain resolution using os.path.realpath()
- Add _remove_broken_virtual_environment() cleanup method
- Enhance initialize_workspace() with validation checks and automatic repair
- Add validation calls in setup_python_path() and dependency installer
- Update Docker files to work with src/ directory structure
- Update tests to mock new validation methods
- Fix pyproject.toml pythonpath configuration for tests
This resolves broken virtual environment symlinks when different endpoints
create venvs with different Python interpreter paths on shared volumes.
* feat: implement per-endpoint workspace isolation for shared volumes
- Add RUNPOD_ENDPOINT_ID environment variable support for endpoint isolation
- Workspace paths now: /runpod-volume/runtimes/{endpoint_id}
- Shared UV cache at volume root: /runpod-volume/.uv-cache
- Add RUNTIMES_DIR_NAME constant for endpoint workspace organization
- Update WorkspaceManager to create endpoint-specific workspace paths
- Add comprehensive endpoint isolation tests
- Update integration tests for new workspace structure
- Resolve merge conflicts from virtual environment validation features
* feat: configure Hugging Face cache to use persistent volume storage
- Add HF_CACHE_DIR_NAME constant for .hf-cache directory
- Implement _configure_huggingface_cache() method in WorkspaceManager
- Set HF environment variables (HF_HOME, TRANSFORMERS_CACHE, etc.) to use volume paths
- Update unit and integration tests to mock os.makedirs calls
- Fix "No space left on device" errors when downloading HF models
* fix: Test local handler execution should test all test_*.json
* feat: add comprehensive handler testing with make test-handler command
- Add make test-handler command that tests all test_*.json files locally
- Update CI to use make test-handler for consistency between local and CI testing
- Ensure local development environment matches CI testing exactly
- Remove code duplication between Makefile and CI configuration
- Support cross-platform testing (handles timeout command availability)
- Update CLAUDE.md documentation with new testing commands
* feat: enhance concurrency safety implementation for workspace initialization
- Add configurable timeout constants (WORKSPACE_INIT_TIMEOUT, WORKSPACE_LOCK_POLL_INTERVAL)
- Implement atomic lock file operations with proper file descriptor management
- Enhance lock file cleanup with comprehensive error handling
- Add workspace directory validation before lock acquisition
- Fix race condition in workspace functionality checks by making them atomic
- Add comprehensive timeout and edge case tests for concurrency scenarios
- Improve error messages and fallback behavior for various failure modes
- Maintain backward compatibility while significantly improving reliability
* Revert "feat: enhance concurrency safety implementation for workspace initialization"
This reverts commit a411bfe.
* refactor: introduce BaseExecutor base class for executor inheritance
- Add BaseExecutor abstract base class with common functionality
- Update FunctionExecutor and ClassExecutor to inherit from BaseExecutor
- Standardize execution environment setup via _setup_execution_environment
- Update ClassExecutor constructor to accept workspace_manager parameter
- Fix ClassExecutor tests to mock workspace_manager dependency
* refactor: replace print statements with structured logging
- Add logging support to DependencyInstaller and WorkspaceManager
- Replace print calls with appropriate log levels (info, warning, error)
- Improve debugging and monitoring capabilities
* chore: update submodule and dependencies
* fix: vLLM ignored the volume runtime
The fix will resolve the vLLM subprocess errors encountered while maintaining full compatibility with existing functionality. When deployed to RunPod with volumes, libraries like vLLM that hardcode /app/.venv paths will seamlessly use the volume's virtual environment.
* fix: resolve vLLM subprocess failures with volume virtual environments
- Add symlink from /app/.venv to volume venv to handle hardcoded paths
- Configure PYTHONPATH environment variable for subprocess compatibility
- Ensure libraries like vLLM can spawn subprocesses that find installed packages
- Add comprehensive test coverage for symlink functionality
- Maintain backward compatibility when no volume is present
@@ -4,18 +4,20 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4
4
5
5
## Project Overview
6
6
7
-
This is `worker-tetra`, a RunPod Serverless worker template that provides dynamic GPU provisioning for ML workloads with transparent execution. The project consists of two main components:
7
+
This is `worker-tetra`, a RunPod Serverless worker template that provides dynamic GPU provisioning for ML workloads with transparent execution and persistent workspace management. The project consists of two main components:
8
8
9
-
1.**RunPod Worker Handler** (`handler.py`) - A serverless function that executes remote Python functions with dependency management
9
+
1.**RunPod Worker Handler** (`handler.py`) - A serverless function that executes remote Python functions with dependency management and persistent volume workspace support
10
10
2.**Tetra SDK** (`tetra-rp/` submodule) - Python library for distributed inference and serving of ML models
11
11
12
12
## Architecture
13
13
14
14
### Core Components
15
15
16
16
-**`handler.py`**: Main RunPod serverless handler implementing `RemoteExecutor` class
17
-
- Executes arbitrary Python functions remotely
18
-
- Handles dynamic installation of Python and system dependencies
17
+
- Executes arbitrary Python functions remotely with persistent workspace support
18
+
- Handles dynamic installation of Python and system dependencies with differential updates
19
+
- Manages `/runpod-volume` workspace with virtual environment and shared package cache
20
+
- Implements concurrency-safe workspace initialization with file-based locking
19
21
- Serializes/deserializes function arguments and results using cloudpickle
20
22
- Captures stdout, stderr, and logs from remote execution
21
23
@@ -32,16 +34,29 @@ This is `worker-tetra`, a RunPod Serverless worker template that provides dynami
32
34
### Key Patterns
33
35
34
36
1.**Remote Function Execution**: Functions decorated with `@remote` are automatically executed on RunPod GPU workers
35
-
2.**Dynamic Dependency Management**: Dependencies specified in decorators are installed at runtime
36
-
3.**Serialization**: Uses cloudpickle + base64 encoding for function arguments and results
0 commit comments