-
Notifications
You must be signed in to change notification settings - Fork 683
[history server] Web Server + Event Processor #4329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Future-Outlier
wants to merge
27
commits into
ray-project:master
Choose a base branch
from
Future-Outlier:historyserver-webserver
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,705
−225
Open
Changes from 14 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
3ce2df3
Add event server for history server.
chiayi 785df87
Update test
chiayi 13b9187
[history server] Web Server
Future-Outlier ba17941
add Kun Wu's setting
Future-Outlier 3dab9dc
Merge branch 'master' into historyserver-webserver
Future-Outlier f8c7214
Merge branch 'historyserver-eventserver' into historyserver-webserver
Future-Outlier 72a9134
a worked version
Future-Outlier 11d6eda
a worked version, will revise it
Future-Outlier 4bd398c
Trigger CI
Future-Outlier 44cb52e
Merge remote-tracking branch 'upstream/master' into historyserver-web…
Future-Outlier 3912d2f
merge master
Future-Outlier f16a7e2
turn chinese comments to english
Future-Outlier 1524b44
fix bugs and make dead cluster endpoint work or return not yet supported
Future-Outlier 2b18bea
support task summarize, not yet test live cluster
Future-Outlier ebfff2d
support predicate
Future-Outlier ea1cde3
remove license
Future-Outlier 144cf11
fix Stop signal ignored during hour-long sleep period
Future-Outlier 14aca06
fix Main exits without waiting for graceful shutdown
Future-Outlier a52b19c
remove log key info
Future-Outlier 0cae478
fix Graceful shutdown incorrectly treated as fatal error
Future-Outlier 767d87d
fix Event processor failure causes event processing to block
Future-Outlier 76b7f2f
Fix Task update discards all fields except attempt number, but this i…
Future-Outlier 32532fe
fix max clusters default 0 problem, and add todo
Future-Outlier 4e3e897
fix Missing cookie path causes repeated Kubernetes API calls
Future-Outlier 34f5aca
fix task list problems
Future-Outlier a9afe32
add actor json tag
Future-Outlier 58578b5
handle task lifecycle event, need to update to binary search
Future-Outlier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| FROM golang:1.25.1 AS builder | ||
|
|
||
| ENV GOPROXY=https://proxy.golang.org,direct | ||
| WORKDIR /historyserver | ||
|
|
||
| # Copy the go modules and manifests. | ||
| COPY go.mod go.mod | ||
| COPY go.sum go.sum | ||
| # Cache dependencies to avoid re-downloading when only sources change. | ||
| RUN go mod download | ||
|
|
||
| # Copy the go source. | ||
| COPY cmd/historyserver/main.go cmd/historyserver/main.go | ||
| # need collector because storage's interface is put in here, will change | ||
| # after this is merged | ||
| # https://github.com/ray-project/kuberay/pull/4302 | ||
| COPY pkg/collector/ pkg/collector/ | ||
| COPY pkg/historyserver/ pkg/historyserver/ | ||
| COPY pkg/storage/ pkg/storage/ | ||
| COPY pkg/utils/ pkg/utils/ | ||
| COPY pkg/eventserver/ pkg/eventserver/ | ||
|
|
||
| # Build the historyserver binary. | ||
| COPY Makefile Makefile | ||
| RUN make buildhistoryserver GOOS=linux GOARCH=amd64 | ||
|
|
||
| FROM ubuntu:22.04 | ||
| RUN apt-get update && apt-get upgrade -y && rm -rf /var/cache/apt/ && apt-get install -y ca-certificates | ||
| COPY --from=builder /historyserver/output/bin/historyserver /usr/local/bin/historyserver |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,81 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
| "flag" | ||
| "os" | ||
| "os/signal" | ||
| "syscall" | ||
|
|
||
| "github.com/ray-project/kuberay/historyserver/pkg/collector" | ||
| "github.com/ray-project/kuberay/historyserver/pkg/collector/types" | ||
| "github.com/ray-project/kuberay/historyserver/pkg/eventserver" | ||
| "github.com/ray-project/kuberay/historyserver/pkg/historyserver" | ||
| "github.com/sirupsen/logrus" | ||
| ) | ||
|
|
||
| func main() { | ||
| runtimeClassName := "" | ||
| rayRootDir := "" | ||
| kubeconfigs := "" | ||
| runtimeClassConfigPath := "/var/collector-config/data" | ||
| dashboardDir := "" | ||
| flag.StringVar(&runtimeClassName, "runtime-class-name", "", "") | ||
| flag.StringVar(&rayRootDir, "ray-root-dir", "", "") | ||
| flag.StringVar(&kubeconfigs, "kubeconfigs", "", "") | ||
| flag.StringVar(&dashboardDir, "dashboard-dir", "/dashboard", "") | ||
| flag.StringVar(&runtimeClassConfigPath, "runtime-class-config-path", "", "") //"/var/collector-config/data" | ||
| flag.Parse() | ||
|
|
||
| cliMgr := historyserver.NewClientManager(kubeconfigs) | ||
|
|
||
| jsonData := make(map[string]interface{}) | ||
| if runtimeClassConfigPath != "" { | ||
| data, err := os.ReadFile(runtimeClassConfigPath) | ||
| if err != nil { | ||
| panic("Failed to read runtime class config " + err.Error()) | ||
| } | ||
| err = json.Unmarshal(data, &jsonData) | ||
| if err != nil { | ||
| panic("Failed to parse runtime class config: " + err.Error()) | ||
| } | ||
| } | ||
|
|
||
| registry := collector.GetReaderRegistry() | ||
| factory, ok := registry[runtimeClassName] | ||
| if !ok { | ||
| panic("Not supported runtime class name: " + runtimeClassName + ".") | ||
| } | ||
|
|
||
| globalConfig := types.RayHistoryServerConfig{ | ||
| RootDir: rayRootDir, | ||
| } | ||
|
|
||
| reader, err := factory(&globalConfig, jsonData) | ||
| if err != nil { | ||
| panic("Failed to create reader for runtime class name: " + runtimeClassName + ".") | ||
| } | ||
|
|
||
| // Create EventHandler with storage reader | ||
| eventHandler := eventserver.NewEventHandler(reader) | ||
|
|
||
| // Start EventHandler in background goroutine | ||
| eventStop := make(chan struct{}, 1) | ||
| go func() { | ||
| logrus.Info("Starting EventHandler in background...") | ||
| if err := eventHandler.Run(eventStop, 2); err != nil { | ||
| logrus.Errorf("EventHandler stopped with error: %v", err) | ||
| } | ||
| }() | ||
|
|
||
| handler := historyserver.NewServerHandler(&globalConfig, dashboardDir, reader, cliMgr, eventHandler) | ||
|
|
||
| sigChan := make(chan os.Signal, 1) | ||
| stop := make(chan struct{}, 1) | ||
| signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL) | ||
| go handler.Run(stop) | ||
| <-sigChan | ||
| // Stop both the server and the event handler | ||
| stop <- struct{}{} | ||
| eventStop <- struct{}{} | ||
| } | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: historyserver #TODO: to specify your service name | ||
| labels: | ||
| app: historyserver | ||
| spec: | ||
| selector: | ||
| app: historyserver | ||
| ports: | ||
| - protocol: TCP | ||
| name: http | ||
| port: 30080 | ||
| targetPort: 8080 | ||
| type: ClusterIP | ||
| --- | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: historyserver-demo | ||
| labels: | ||
| app: historyserver | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: historyserver | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: historyserver | ||
| spec: | ||
| serviceAccountName: historyserver | ||
| containers: | ||
| - name: historyserver | ||
| env: | ||
| - name: S3DISABLE_SSL | ||
| value: "true" | ||
| - name: AWS_S3ID | ||
| value: minioadmin | ||
| - name: AWS_S3SECRET | ||
| value: minioadmin | ||
| - name: AWS_S3TOKEN | ||
| value: "" | ||
| - name: S3_BUCKET | ||
| value: "ray-historyserver" | ||
| - name: S3_ENDPOINT | ||
| value: "minio-service.minio-dev:9000" | ||
| - name: S3_REGION | ||
| value: "test" | ||
| - name: S3FORCE_PATH_STYLE | ||
| value: "true" | ||
| image: historyserver:v0.1.0 | ||
| imagePullPolicy: IfNotPresent | ||
| command: | ||
| - historyserver | ||
| - --runtime-class-name=s3 | ||
| - --ray-root-dir=log | ||
| ports: | ||
| - containerPort: 8080 | ||
| resources: | ||
| limits: | ||
| cpu: "500m" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: historyserver | ||
| automountServiceAccountToken: true | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: raycluster-reader | ||
| rules: | ||
| - apiGroups: ["ray.io"] | ||
| resources: ["rayclusters"] | ||
| verbs: ["list", "get"] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: historyserver | ||
| namespace: default | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: default | ||
| namespace: default | ||
| - kind: ServiceAccount | ||
| name: historyserver | ||
| namespace: default | ||
| roleRef: | ||
| kind: ClusterRole | ||
| name: raycluster-reader |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.