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
19 changes: 18 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,21 @@ wandb/
checkpoints/
rollout_results/
reference_projects/
docs/
docs/

# SLURM job outputs
*.out
*.err

# Cluster results
results/

# Private cluster configs and logs
worklogs/

# Cluster artifacts (generated locally)
cluster.yaml
opencode.def
test_results.log
tmp_defs/
sif_images/
68 changes: 67 additions & 1 deletion examples/calculator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,70 @@ Each rollout then prepares a fresh workspace by:
- installing the harness CLI or SDK for that run
- creating `/polar/session/workspace`
- uploading `calculator.py` and `test_calculator.py`
- initializing a git repo used by the evaluator
- initializing a git repo used by the evaluator

## Cluster Deployment (SLURM)

For running on a SLURM cluster with Apptainer containers and vLLM inference.
See [examples/slurm/README.md](../slurm/README.md) for full documentation.

### 1. Configure

```bash
cp examples/slurm/cluster.yaml.example my-cluster.yaml
# Edit my-cluster.yaml with your cluster details
```

### 2. One-Time Setup

```bash
polar cluster setup -c my-cluster.yaml
```

### 3. Build SIF Image

```bash
# Single harness:
polar cluster build-sif -c my-cluster.yaml --example calculator --harness opencode

# Multiple harnesses:
polar cluster build-sif -c my-cluster.yaml --example calculator --harness opencode,codex,swe_agent
```

### 4. Start Services

```bash
polar cluster serve -c my-cluster.yaml
```

Once services are ready, the command prints the job ID and a sample `submit-task` command.

### 5. Submit Tasks

```bash
# Use the job ID from step 4
polar cluster submit-task -c my-cluster.yaml \
--job-id JOB_ID --example calculator --harness opencode

# Multiple harnesses against the same running service
polar cluster submit-task -c my-cluster.yaml \
--job-id JOB_ID --example calculator --harness codex
```

### 6. Stop Services

```bash
scancel JOB_ID
```

### 7. Collect Results

```bash
polar cluster sync -c my-cluster.yaml
```

**One-shot alternative** — start services, run tasks, and exit in one command:

```bash
polar cluster launch -c my-cluster.yaml --example calculator --harness opencode
```
27 changes: 27 additions & 0 deletions examples/calculator/swe_agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM python:3.12-slim

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
bash \
ca-certificates \
curl \
git \
build-essential \
&& rm -rf /var/lib/apt/lists/*

# Install SWE-agent from git (PyPI version has missing dependency)
RUN pip install --no-cache-dir "git+https://github.com/SWE-agent/SWE-agent.git" \
&& SITE=$(python -c "import site; print(site.getsitepackages()[0])") \
&& git clone --depth 1 https://github.com/SWE-agent/SWE-agent.git /tmp/swe-agent-src \
&& cp -r /tmp/swe-agent-src/config "$SITE/config" \
&& cp -r /tmp/swe-agent-src/tools "$SITE/tools" \
&& mkdir -p "$SITE/trajectories" \
&& rm -rf /tmp/swe-agent-src

# Pre-install tool dependencies so install.sh is a no-op at runtime
# (compute nodes may lack internet access).
RUN pip install --no-cache-dir 'tree-sitter==0.21.3' 'tree-sitter-languages'

WORKDIR /polar/session
Loading