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
12 changes: 6 additions & 6 deletions historyserver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,25 @@ docker buildx build -t <image-name>:<tag> --platform linux/amd64,linux/arm64 . -

The history server can be configured using command-line flags:

- `--runtime-class-name`: Storage backend type (e.g., "s3", "aliyunoss", "localtest")
- `--storage-backend`: Storage backend type (e.g., "s3", "aliyunoss", "localtest")
- `--ray-root-dir`: Root directory for Ray logs
- `--kubeconfigs`: Path to kubeconfig file(s) for accessing Kubernetes clusters
- `--dashboard-dir`: Directory containing dashboard assets (default: "/dashboard")
- `--runtime-class-config-path`: Path to runtime class configuration file
- `--storage-backend-config-path`: Path to storage backend configuration file

### Collector Configuration

The collector can be configured using command-line flags:

- `--role`: Node role ("Head" or "Worker")
- `--runtime-class-name`: Storage backend type (e.g., "s3", "aliyunoss")
- `--storage-backend`: Storage backend type (e.g., "s3", "aliyunoss")
- `--ray-cluster-name`: Name of the Ray cluster
- `--ray-cluster-namespace`: Namespace of the Ray cluster
- `--ray-root-dir`: Root directory for Ray logs
- `--log-batching`: Number of log entries to batch before writing
- `--events-port`: Port for the events server
- `--push-interval`: Interval between pushes to storage
- `--runtime-class-config-path`: Path to runtime class configuration file
- `--storage-backend-config-path`: Path to storage backend configuration file

## Supported Storage Backends

Expand All @@ -99,7 +99,7 @@ Each backend requires specific configuration parameters passed through environme

```bash
./output/bin/historyserver \
--runtime-class-name=s3 \
--storage-backend=s3 \
--ray-root-dir=/path/to/logs
```

Expand All @@ -108,7 +108,7 @@ Each backend requires specific configuration parameters passed through environme
```bash
./output/bin/collector \
--role=Head \
--runtime-class-name=s3 \
--storage-backend=s3 \
--ray-cluster-name=my-cluster \
--ray-root-dir=/path/to/logs
```
Expand Down
32 changes: 15 additions & 17 deletions historyserver/cmd/collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

func main() {
role := ""
runtimeClassName := ""
storageBackend := ""
rayClusterName := ""
rayClusterNamespace := ""
rayRootDir := ""
Expand All @@ -36,7 +36,7 @@ func main() {
ownerName := ""
enableEventCollector := true
enableLogCollector := true
runtimeClassConfigPath := ""
storageBackendConfigPath := ""

// Event collector disk-first storage flags.
eventDataDir := "/tmp/ray/event-data"
Expand All @@ -48,13 +48,13 @@ func main() {
flag.BoolVar(&enableEventCollector, "enable-event-collector", true, "Enable event collector")
flag.BoolVar(&enableLogCollector, "enable-log-collector", true, "Enable log collector")
flag.StringVar(&role, "role", "Worker", "Role of the collector node: Head or Worker")
flag.StringVar(&runtimeClassName, "runtime-class-name", "", "")
flag.StringVar(&storageBackend, "storage-backend", "", "")
flag.StringVar(&rayClusterName, "ray-cluster-name", "", "")
flag.StringVar(&rayClusterNamespace, "ray-cluster-namespace", "default", "")
flag.StringVar(&rayRootDir, "ray-root-dir", "", "")
flag.IntVar(&logBatching, "log-batching", 1000, "")
flag.IntVar(&eventsPort, "events-port", 8080, "")
flag.StringVar(&runtimeClassConfigPath, "runtime-class-config-path", "", "")
flag.StringVar(&storageBackendConfigPath, "storage-backend-config-path", "", "")
Comment thread
cursor[bot] marked this conversation as resolved.
flag.DurationVar(&pushInterval, "push-interval", time.Minute, "")
flag.StringVar(&ownerKind, "owner-kind", "", "")
flag.StringVar(&ownerName, "owner-name", "", "")
Expand Down Expand Up @@ -110,8 +110,8 @@ func main() {
enableLogCollector = enabled
}
}
if val := os.Getenv("RUNTIME_CLASS_CONFIG_PATH"); val != "" {
runtimeClassConfigPath = val
if val := os.Getenv("STORAGE_BACKEND_CONFIG_PATH"); val != "" {
storageBackendConfigPath = val
}

role = strings.TrimSpace(role)
Expand Down Expand Up @@ -183,27 +183,25 @@ func main() {
}

jsonData := make(map[string]interface{})
if runtimeClassConfigPath != "" {
data, err := os.ReadFile(runtimeClassConfigPath)
if storageBackendConfigPath != "" {
data, err := os.ReadFile(storageBackendConfigPath)
if err != nil {
logrus.Fatalf("Failed to read runtime class config from %s: %v", runtimeClassConfigPath, err)
logrus.Fatalf("Failed to read storage backend config from %s: %v", storageBackendConfigPath, err)
}
if err := json.Unmarshal(data, &jsonData); err != nil {
logrus.Fatalf("Failed to parse runtime class config from %s: %v", runtimeClassConfigPath, err)
logrus.Fatalf("Failed to parse storage backend config from %s: %v", storageBackendConfigPath, err)
}
}

if val := os.Getenv("STORAGE_BACKEND"); val != "" {
runtimeClassName = val
} else if val := os.Getenv("RUNTIME_CLASS_NAME"); val != "" {
runtimeClassName = val
storageBackend = val
}
runtimeClassName = strings.ToLower(runtimeClassName)
storageBackend = strings.ToLower(storageBackend)

registry := collector.GetWriterRegistry()
factory, ok := registry[runtimeClassName]
factory, ok := registry[storageBackend]
if !ok {
logrus.Fatalf("Not supported runtime class name: %s for role: %s.", runtimeClassName, role)
logrus.Fatalf("Not supported storage backend: %s for role: %s.", storageBackend, role)
}

rayNodeId, err := utils.GetNodeRayIDWithFQIP()
Expand Down Expand Up @@ -255,7 +253,7 @@ func main() {

writer, err := factory(&globalConfig, jsonData)
if err != nil {
logrus.Fatalf("Failed to create writer for runtime class name: %s for role: %s, err: %v", runtimeClassName, role, err)
logrus.Fatalf("Failed to create writer for storage backend: %s for role: %s, err: %v", storageBackend, role, err)
}

var wg sync.WaitGroup
Expand Down
32 changes: 15 additions & 17 deletions historyserver/cmd/historyserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (
)

func main() {
runtimeClassName := ""
storageBackend := ""
rayRootDir := ""
kubeconfigs := ""
runtimeClassConfigPath := ""
storageBackendConfigPath := ""
dashboardDir := ""
useKubernetesProxy := false
useAuthTokenMode := false
Expand All @@ -30,11 +30,11 @@ func main() {
sessionProcessTimeout := historyserver.DefaultSessionProcessTimeout
sessionCacheSize := historyserver.DefaultSessionCacheSize
sessionCacheTTL := historyserver.DefaultSessionCacheTTL
flag.StringVar(&runtimeClassName, "runtime-class-name", "", "Storage backend: s3 / gcs / azureblob / aliyunoss / localtest")
flag.StringVar(&storageBackend, "storage-backend", "", "Storage backend: s3 / gcs / azureblob / aliyunoss / localtest")
flag.StringVar(&rayRootDir, "ray-root-dir", "", "Root dir inside the bucket")
flag.StringVar(&kubeconfigs, "kubeconfigs", "", "Kubeconfig path; empty = in-cluster")
flag.StringVar(&dashboardDir, "dashboard-dir", "/dashboard", "Path to Ray Dashboard static assets")
flag.StringVar(&runtimeClassConfigPath, "runtime-class-config-path", "", "Path to backend config JSON")
flag.StringVar(&storageBackendConfigPath, "storage-backend-config-path", "", "Path to backend config JSON")
flag.BoolVar(&useKubernetesProxy, "use-kubernetes-proxy", false, "Use local kubeconfig instead of in-cluster config")
flag.BoolVar(&useAuthTokenMode, "use-auth-token-mode", false, "Enable Ray dashboard token authentication mode (requires x-ray-authorization header)")
flag.Float64Var(&qps, "kube-api-qps", historyserver.DefaultKubeAPIQPS, "The QPS value for the client communicating with the Kubernetes API server.")
Expand All @@ -45,14 +45,12 @@ func main() {
flag.Parse()

if val := os.Getenv("STORAGE_BACKEND"); val != "" {
runtimeClassName = val
} else if val := os.Getenv("RUNTIME_CLASS_NAME"); val != "" {
runtimeClassName = val
storageBackend = val
}
if runtimeClassName == "" {
logrus.Fatal("--runtime-class-name, STORAGE_BACKEND, or RUNTIME_CLASS_NAME environment variable is required")
if storageBackend == "" {
logrus.Fatal("--storage-backend or STORAGE_BACKEND environment variable is required")
}
runtimeClassName = strings.ToLower(runtimeClassName)
storageBackend = strings.ToLower(storageBackend)

if qps <= 0 {
logrus.Fatalf("--kube-api-qps must be > 0, got %v", qps)
Expand All @@ -78,20 +76,20 @@ func main() {
}

jsonData := make(map[string]interface{})
if runtimeClassConfigPath != "" {
data, err := os.ReadFile(runtimeClassConfigPath)
if storageBackendConfigPath != "" {
data, err := os.ReadFile(storageBackendConfigPath)
if err != nil {
logrus.Fatalf("Failed to read runtime-class-config-path from %s: %v", runtimeClassConfigPath, err)
logrus.Fatalf("Failed to read storage-backend-config-path from %s: %v", storageBackendConfigPath, err)
}
if err := json.Unmarshal(data, &jsonData); err != nil {
logrus.Fatalf("Failed to parse runtime-class-config-path from %s: %v", runtimeClassConfigPath, err)
logrus.Fatalf("Failed to parse storage-backend-config-path from %s: %v", storageBackendConfigPath, err)
}
}

registry := collector.GetReaderRegistry()
factory, ok := registry[runtimeClassName]
factory, ok := registry[storageBackend]
if !ok {
logrus.Fatalf("Unsupported runtime-class-name for reader: %s", runtimeClassName)
logrus.Fatalf("Unsupported storage-backend for reader: %s", storageBackend)
}

globalConfig := types.RayHistoryServerConfig{
Expand All @@ -100,7 +98,7 @@ func main() {

reader, err := factory(&globalConfig, jsonData)
if err != nil {
logrus.Fatalf("Failed to create reader for runtime class name %s: %v", runtimeClassName, err)
logrus.Fatalf("Failed to create reader for storage backend %s: %v", storageBackend, err)
}

serverCtx, serverCancel := signal.NotifyContext(
Expand Down
2 changes: 1 addition & 1 deletion historyserver/config/historyserver-azureblob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
imagePullPolicy: IfNotPresent
command:
- historyserver
- --runtime-class-name=azureblob
- --storage-backend=azureblob
- --ray-root-dir=log
ports:
- containerPort: 8080
Expand Down
2 changes: 1 addition & 1 deletion historyserver/config/historyserver-gcs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
imagePullPolicy: IfNotPresent
command:
- historyserver
- --runtime-class-name=gcs
- --storage-backend=gcs
- --ray-root-dir=log
ports:
- containerPort: 8080
Expand Down
2 changes: 1 addition & 1 deletion historyserver/config/historyserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ spec:
imagePullPolicy: IfNotPresent
command:
- historyserver
- --runtime-class-name=s3
- --storage-backend=s3
- --ray-root-dir=log
# Enable proxying to live RayClusters with token authentication enabled.
# The history server reads the auth Secret and forwards requests with the
Expand Down
4 changes: 2 additions & 2 deletions historyserver/config/raycluster-azureblob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ spec:
value: "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite-service.azurite-dev.svc.cluster.local:10000/devstoreaccount1;"
- name: AZURE_STORAGE_CONTAINER
value: ray-historyserver
command: [collector, --role=Head, --runtime-class-name=azureblob, --ray-cluster-name=raycluster-historyserver, --ray-root-dir=log, --events-port=8084]
command: [collector, --role=Head, --storage-backend=azureblob, --ray-cluster-name=raycluster-historyserver, --ray-root-dir=log, --events-port=8084]
volumeMounts:
- name: historyserver
mountPath: *rayTmpRoot
Expand Down Expand Up @@ -136,7 +136,7 @@ spec:
value: "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite-service.azurite-dev.svc.cluster.local:10000/devstoreaccount1;"
- name: AZURE_STORAGE_CONTAINER
value: ray-historyserver
command: [collector, --role=Worker, --runtime-class-name=azureblob, --ray-cluster-name=raycluster-historyserver, --ray-root-dir=log, --events-port=8084]
command: [collector, --role=Worker, --storage-backend=azureblob, --ray-cluster-name=raycluster-historyserver, --ray-root-dir=log, --events-port=8084]
volumeMounts:
- name: historyserver
mountPath: *rayTmpRoot
Expand Down
4 changes: 2 additions & 2 deletions historyserver/config/raycluster-gcs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ spec:
command:
- collector
- --role=Head
- --runtime-class-name=gcs
- --storage-backend=gcs
- --ray-cluster-name=${RAY_CLUSTER}
- --ray-root-dir=log
- --events-port=8084
Expand Down Expand Up @@ -161,7 +161,7 @@ spec:
command:
- collector
- --role=Worker
- --runtime-class-name=gcs
- --storage-backend=gcs
- --ray-cluster-name=${RAY_CLUSTER}
- --ray-root-dir=log
- --events-port=8084
Expand Down
4 changes: 2 additions & 2 deletions historyserver/config/raycluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ spec:
command:
- collector
- --role=Head
- --runtime-class-name=s3
- --storage-backend=s3
- --ray-cluster-name=raycluster-historyserver
- --ray-root-dir=log
- --events-port=8084
Expand Down Expand Up @@ -196,7 +196,7 @@ spec:
command:
- collector
- --role=Worker
- --runtime-class-name=s3
- --storage-backend=s3
- --ray-cluster-name=raycluster-historyserver
- --ray-root-dir=log
- --events-port=8084
Expand Down
8 changes: 4 additions & 4 deletions historyserver/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ The History Server supports multiple storage backends:

| Backend | Description | Configuration |
|---------|-------------|---------------|
| S3/MinIO | AWS S3 or MinIO-compatible storage | Use `--runtime-class-name=s3` |
| Azure Blob Storage | Microsoft Azure Blob Storage | Use `--runtime-class-name=azureblob` |
| Aliyun OSS | Alibaba Cloud Object Storage Service | Use `--runtime-class-name=aliyunoss` |
| Local test | For local testing and development | Use `--runtime-class-name=localtest` |
| S3/MinIO | AWS S3 or MinIO-compatible storage | Use `--storage-backend=s3` |
| Azure Blob Storage | Microsoft Azure Blob Storage | Use `--storage-backend=azureblob` |
| Aliyun OSS | Alibaba Cloud Object Storage Service | Use `--storage-backend=aliyunoss` |
| Local test | For local testing and development | Use `--storage-backend=localtest` |

## Running locally

Expand Down
4 changes: 2 additions & 2 deletions historyserver/docs/set_up_historyserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ debugging in your own IDE. For example, you can set up `.vscode/launch.json` as
"program": "${workspaceFolder}/historyserver/cmd/historyserver/main.go",
"cwd": "${workspaceFolder}",
"args": [
"--runtime-class-name=s3",
"--storage-backend=s3",
"--ray-root-dir=log"
],
"env": {
Expand Down Expand Up @@ -139,7 +139,7 @@ export S3DISABLE_SSL=true

# Run the history server.
./output/bin/historyserver \
--runtime-class-name=s3 \
--storage-backend=s3 \
--ray-root-dir=log \
--use-kubernetes-proxy=true
```
Expand Down
2 changes: 1 addition & 1 deletion historyserver/pkg/storage/aliyunoss/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Content in `/var/collector-config/data` should be in JSON format, for example:
}
```

Set `--runtime-class-name=aliyunoss` to enable this module.
Set `--storage-backend=aliyunoss` to enable this module.

Currently, this module can only be used in an ACK environment. OIDC must be
enabled for the cluster, and write permission to OSS must be granted.
2 changes: 1 addition & 1 deletion historyserver/pkg/storage/azureblob/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ variables or `/var/collector-config/data`.
Content in `/var/collector-config/data` should be in JSON format, like
`{"azureContainer": "", "azureConnectionString": "", "azureAccountURL": ""}`

Set `--runtime-class-name=azureblob` to enable this module.
Set `--storage-backend=azureblob` to enable this module.

## Authentication

Expand Down
6 changes: 3 additions & 3 deletions historyserver/pkg/storage/gcs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This module is the writer and reader for GCS storage.
It is required for the GKE Cluster running Ray to have workload identity (WI), to setup WI, please follow:
[How-to: Workload Identity](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/workload-identity)

To use it with the History Server, set `--runtime-class-name=gcs`.
To use it with the History Server, set `--storage-backend=gcs`.

```yaml
apiVersion: apps/v1
Expand All @@ -26,7 +26,7 @@ spec:
imagePullPolicy: Always
command:
- historyserver
- --runtime-class-name=gcs
- --storage-backend=gcs
- --ray-root-dir=log
ports:
- containerPort: 8080
Expand All @@ -47,7 +47,7 @@ RayCluster will also have the following under both the worker and head collector
command:
- collector
- --role=Head
- --runtime-class-name=gcs
- --storage-backend=gcs
- --ray-cluster-name=raycluster-historyserver
- --ray-root-dir=log
- --events-port=8084
Expand Down
2 changes: 1 addition & 1 deletion historyserver/pkg/storage/s3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ S3 endpoint, S3 region and S3 bucket are read from /var/collector-config/data.
Content in /var/collector-config/data should be in json format, like
`{"s3Bucket": "", "s3Endpoint": "", "s3Region": ""}`

Set `--runtime-class-name=s3` to enable this module.
Set `--storage-backend=s3` to enable this module.

This module can be used with any S3 compatible storage service.
Loading