Skip to content

unconst/rf

Repository files navigation

rf

Containerized Ray environments with a clean CLI + SDK

Pure-Python orchestration for running Ray head in Docker and launching environments as containerized Ray actors.

🎯 Design

rf provides two interfaces:

1️⃣ CLI layer (developer UX)

rf new dummy       # scaffold a new env directory (Dockerfile + env.py)
rf build dummy     # docker build -t local/dummy:latest ./dummy
rf invoke dummy inc # runs env.inc() via Ray (starts Ray head if needed)

2️⃣ SDK layer (programmable UX)

import rf
import ray

# Start Ray cluster
cluster = af.Cluster()
cluster.up()

# Connect to Ray
ray.init("ray://localhost:10001")

# Create containerized actor
env = rf.create("./dummy")
result = ray.get(env.inc.remote())

🚀 Quick Start

Installation

uv pip install -e .

Create a new environment

fr new myenv

This scaffolds:

myenv/
├── Dockerfile    # Ray base + your dependencies
└── env.py        # Your environment class

Build the environment

rf build myenv

Invoke methods

rf invoke myenv inc

📦 Package Structure

rf/
├── __init__.py      # SDK exports: Cluster, create
├── cli.py           # CLI commands: new, build, invoke
├── cluster.py       # Ray head management
├── env.py           # Containerized actor creation
└── templates/       # Boilerplate for new environments
    ├── Dockerfile
    └── env.py

🎨 Features

  • Hash-based versioning - Only rebuilds when environment files change
  • Docker socket mounting - Ray head can build/launch worker containers
  • Embedded source fallback - Environments work even without explicit image installation
  • Automatic Ray management - CLI starts Ray head automatically when needed
  • Clean API surface - Both CLI and SDK share the same primitives

🧪 Example

See dummy/ for a complete example environment and main.py for SDK usage.

About

rf

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors