Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,8 @@ cython_debug/
.pypirc
.DS_Store

# Runpod Flash state
.runpod/
.flash/logs/
# Flash state
.flash/

# Code intelligence
.code-intel/
Expand Down
2 changes: 1 addition & 1 deletion src/runpod_flash/cli/commands/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
console = Console()

# Container archive mount path - expected location where containers unpack the archive
CONTAINER_ARCHIVE_PATH = "/root/.runpod/artifact.tar.gz"
CONTAINER_ARCHIVE_PATH = "/root/.flash/artifact.tar.gz"


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion src/runpod_flash/cli/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, **_kw):
console = Console()

# Resource state file written by ResourceManager in the uvicorn subprocess.
_RESOURCE_STATE_FILE = Path(".runpod") / "resources.pkl"
_RESOURCE_STATE_FILE = Path(".flash") / "resources.pkl"

_MAX_PORT_ATTEMPTS = 20

Expand Down
2 changes: 1 addition & 1 deletion src/runpod_flash/cli/commands/undeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _get_resource_type(resource) -> str:


def list_command():
"""List all deployed endpoints tracked in .runpod/resources.pkl."""
"""List all deployed endpoints tracked in .flash/resources.pkl."""
manager = _get_resource_manager()
all_resources = manager.list_all_resources()
resources = _get_serverless_resources(all_resources)
Expand Down
4 changes: 2 additions & 2 deletions src/runpod_flash/cli/docs/flash-run.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Auto-provisioning discovers and deploys Serverless endpoints before the Flash de
1. **Resource Discovery**: Scans project files for `Endpoint` definitions
2. **Parallel Deployment**: Deploys resources concurrently (up to 3 at a time)
3. **Confirmation**: Asks for confirmation if deploying more than 5 endpoints
4. **Caching**: Stores deployed resources in `.runpod/resources.pkl` for reuse across runs
4. **Caching**: Stores deployed resources in `.flash/resources.pkl` for reuse across runs
5. **Smart Updates**: Recognizes when endpoints already exist and updates them if configuration changed

### Using Auto-Provisioning
Expand Down Expand Up @@ -156,7 +156,7 @@ flash run --auto-provision
flash run --auto-provision
```

Resources persist in `.runpod/resources.pkl` and survive server restarts. Configuration changes are detected automatically and trigger re-deployment only when needed.
Resources persist in `.flash/resources.pkl` and survive server restarts. Configuration changes are detected automatically and trigger re-deployment only when needed.

## Testing

Expand Down
18 changes: 9 additions & 9 deletions src/runpod_flash/cli/docs/flash-undeploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Manage and delete Runpod serverless endpoints deployed via Flash.

## Overview

The `flash undeploy` command helps you clean up Serverless endpoints that Flash has created when you deployed `Endpoint` functions using `flash run` or `flash deploy`. It manages endpoints recorded in `.runpod/resources.pkl` and ensures both the cloud resources and local tracking state stay in sync.
The `flash undeploy` command helps you clean up Serverless endpoints that Flash has created when you ran/deployed a `@remote` function using `flash run` or `flash deploy`. It manages endpoints recorded in `.flash/resources.pkl` and ensures both the cloud resources and local tracking state stay in sync.

### When To Use This Command

Expand All @@ -22,7 +22,7 @@ For production deployments, use `flash env delete` to remove the entire environm

### How Endpoint Tracking Works

Flash tracks deployed endpoints in `.runpod/resources.pkl`. Endpoints get added to this file when you:
Flash tracks deployed endpoints in `.flash/resources.pkl`. Endpoints get added to this file when you:
- Run `flash run --auto-provision` (local development)
- Run `flash deploy` (production deployment)

Expand Down Expand Up @@ -191,34 +191,34 @@ The Status column performs a health check API call for each endpoint. This:

## Tracking File

Endpoints are tracked in `.runpod/resources.pkl`.
Endpoints are tracked in `.flash/resources.pkl`.

**Important:**
- This file is in `.gitignore` (never commit)
- Contains local deployment state
- Use `flash undeploy --cleanup-stale` to maintain accuracy
- `make clean` no longer deletes this file (use flash undeploy instead)

## Integration with Endpoint
## Integration with @remote

When you use the `Endpoint` class:
When you use the `@remote` decorator:

```python
from runpod_flash import Endpoint, GpuGroup
from runpod_flash import remote, LiveServerless

@Endpoint(name="my-worker", gpu=GpuGroup.ANY)
@remote(resource_config=LiveServerless(name="my-api"))
def my_function(data):
return {"result": data}
```

Flash automatically:
1. Deploys endpoint to Runpod
2. Tracks in `.runpod/resources.pkl`
2. Tracks in `.flash/resources.pkl`
3. Reuses endpoint on subsequent calls

To clean up:
```bash
flash undeploy my-worker
flash undeploy my-api
```

## Troubleshooting
Expand Down
1 change: 0 additions & 1 deletion src/runpod_flash/cli/utils/ignore.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def load_ignore_patterns(project_dir: Path) -> pathspec.PathSpec:
always_ignore = [
".build/",
".flash/",
".runpod/",
".venv/",
"venv/",
"*.tar.gz",
Expand Down
2 changes: 1 addition & 1 deletion src/runpod_flash/cli/utils/skeleton_template/.flashignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ build/
*.egg-info/

# Flash resources
.runpod/
.flash/

# Tests
tests/
Expand Down
1 change: 0 additions & 1 deletion src/runpod_flash/cli/utils/skeleton_template/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ wheels/

# Flash
.flash/
.runpod/
dist/

# OS
Expand Down
2 changes: 1 addition & 1 deletion src/runpod_flash/core/resources/resource_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
log = logging.getLogger(__name__)

# Directory and file to persist state of resources
RUNPOD_FLASH_DIR = Path(".runpod")
RUNPOD_FLASH_DIR = Path(".flash")
RESOURCE_STATE_FILE = RUNPOD_FLASH_DIR / "resources.pkl"


Expand Down
20 changes: 10 additions & 10 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,23 +253,23 @@ def worker_temp_dir(


@pytest.fixture(scope="session")
def worker_runpod_dir(worker_temp_dir: Path) -> Path:
"""Provide worker-specific .runpod directory for state file isolation.
def worker_flash_dir(worker_temp_dir: Path) -> Path:
"""Provide worker-specific .flash directory for state file isolation.

Args:
worker_temp_dir: Worker-specific temporary directory.

Returns:
Path to worker-specific .runpod directory.
Path to worker-specific .flash directory.
"""
runpod_dir = worker_temp_dir / ".runpod"
runpod_dir.mkdir(parents=True, exist_ok=True)
return runpod_dir
flash_dir = worker_temp_dir / ".flash"
flash_dir.mkdir(parents=True, exist_ok=True)
return flash_dir


@pytest.fixture(autouse=True)
def isolate_resource_state_file(
monkeypatch: pytest.MonkeyPatch, worker_runpod_dir: Path
monkeypatch: pytest.MonkeyPatch, worker_flash_dir: Path
) -> Path:
"""Automatically isolate RESOURCE_STATE_FILE per worker.

Expand All @@ -278,16 +278,16 @@ def isolate_resource_state_file(

Args:
monkeypatch: Pytest's monkeypatch fixture.
worker_runpod_dir: Worker-specific .runpod directory.
worker_flash_dir: Worker-specific .flash directory.

Returns:
Path to worker-specific state file.
"""
from runpod_flash.core.resources import resource_manager

worker_state_file = worker_runpod_dir / "resources.pkl"
worker_state_file = worker_flash_dir / "resources.pkl"
monkeypatch.setattr(resource_manager, "RESOURCE_STATE_FILE", worker_state_file)
monkeypatch.setattr(resource_manager, "RUNPOD_FLASH_DIR", worker_runpod_dir)
monkeypatch.setattr(resource_manager, "RUNPOD_FLASH_DIR", worker_flash_dir)

return worker_state_file

Expand Down
43 changes: 0 additions & 43 deletions tests/unit/cli/commands/build_utils/test_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,49 +314,6 @@ async def project_function(data):
assert functions[0].resource_config_name == "project_config"


def test_exclude_runpod_directory():
"""Test that .runpod directory is excluded from scanning."""
with tempfile.TemporaryDirectory() as tmpdir:
project_dir = Path(tmpdir)

# Create .runpod directory with Python files
runpod_dir = project_dir / ".runpod" / "cache"
runpod_dir.mkdir(parents=True)
runpod_file = runpod_dir / "cached.py"
runpod_file.write_text(
"""
from runpod_flash import LiveServerless, remote

config = LiveServerless(name="runpod_config")

@remote(config)
async def runpod_function(data):
return data
"""
)

# Create legitimate project file
project_file = project_dir / "main.py"
project_file.write_text(
"""
from runpod_flash import LiveServerless, remote

config = LiveServerless(name="project_config")

@remote(config)
async def project_function(data):
return data
"""
)

scanner = RemoteDecoratorScanner(project_dir)
functions = scanner.discover_remote_functions()

# Should only find the project function, not the runpod one
assert len(functions) == 1
assert functions[0].resource_config_name == "project_config"


def test_exclude_nested_venv_directory():
"""Test that nested .venv directories (not just root-level) are excluded."""
with tempfile.TemporaryDirectory() as tmpdir:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/resources/test_resource_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def reset_singleton(self):
@pytest.fixture
def mock_resource_file(self, tmp_path):
"""Mock the resource state file path."""
resource_file = tmp_path / ".runpod" / "resources.pkl"
resource_file = tmp_path / ".flash" / "resources.pkl"
with patch(
"runpod_flash.core.resources.resource_manager.RESOURCE_STATE_FILE",
resource_file,
Expand Down
Loading