fix(plugins/ray): disable ANSI color codes and Ray Data progress bars in pod logs#7504
Open
1fanwang wants to merge 1 commit into
Open
fix(plugins/ray): disable ANSI color codes and Ray Data progress bars in pod logs#75041fanwang wants to merge 1 commit into
1fanwang wants to merge 1 commit into
Conversation
… in pod logs Signed-off-by: 1fanwang <1fannnw@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds default Ray environment variables to reduce log noise in head/worker pods, and verifies the behavior via a new unit test.
Changes:
- Set
RAY_COLOR_PREFIX=0andRAY_DATA_DISABLE_PROGRESS_BARS=1on Ray head pods. - Set the same log-noise env vars on Ray worker pods.
- Add a unit test asserting these env vars are present on both head and worker containers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| flyteplugins/go/tasks/plugins/k8s/ray/ray.go | Adds env vars to Ray head/worker pod templates to reduce ANSI/progress-bar log noise. |
| flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go | Adds coverage ensuring the new env vars are applied to both head and worker pod specs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+233
to
+236
| RayResource, err := rayJobResourceHandler.BuildResource(context.TODO(), rayCtx) | ||
| assert.Nil(t, err) | ||
| ray, ok := RayResource.(*rayv1.RayJob) | ||
| assert.True(t, ok) |
Comment on lines
+233
to
+236
| RayResource, err := rayJobResourceHandler.BuildResource(context.TODO(), rayCtx) | ||
| assert.Nil(t, err) | ||
| ray, ok := RayResource.(*rayv1.RayJob) | ||
| assert.True(t, ok) |
| } | ||
|
|
||
| headContainers := ray.Spec.RayClusterSpec.HeadGroupSpec.Template.Spec.Containers | ||
| workerContainers := ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].Template.Spec.Containers |
Comment on lines
+238
to
+247
| hasEnv := func(containers []corev1.Container, name, value string) bool { | ||
| for _, c := range containers { | ||
| for _, e := range c.Env { | ||
| if e.Name == name && e.Value == value { | ||
| return true | ||
| } | ||
| } | ||
| } | ||
| return false | ||
| } |
Comment on lines
+412
to
+421
| // Disable Ray's terminal-oriented log decorations (ANSI-colored log prefixes and | ||
| // Ray Data progress bars) so logs collected from non-interactive pods stay readable. | ||
| { | ||
| Name: "RAY_COLOR_PREFIX", | ||
| Value: "0", | ||
| }, | ||
| { | ||
| Name: "RAY_DATA_DISABLE_PROGRESS_BARS", | ||
| Value: "1", | ||
| }, |
pingsutw
approved these changes
Jun 11, 2026
pingsutw
left a comment
Member
There was a problem hiding this comment.
Thanks, are you running v2 Flyte on the internal cluster?
Sovietaced
approved these changes
Jun 11, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why are the changes needed?
Ray decorates its output for an interactive terminal: actor/task log lines get ANSI-colored prefixes, and Ray Data prints tqdm-style progress bars. Flyte collects Ray pod stdout to a non-interactive log sink, where these render as unreadable escape-sequence noise (e.g.
\x1b[2m\x1b[36m(pid=...)\x1b[0m) and repeated progress-bar frames, hurting log readability and search.What changes were proposed in this pull request?
Set two environment variables on the Ray head and worker containers to turn off the terminal-oriented decorations:
RAY_COLOR_PREFIX=0— disables ANSI color in log prefixesRAY_DATA_DISABLE_PROGRESS_BARS=1— disables Ray Data progress barsThey sit alongside the existing
RAY_DISABLE_DOCKER_CPU_WARNINGenv and are no-ops on Ray builds that don't read them.How was this patch tested?
Added
TestBuildResourceRay_DisablesLogNoiseEnv, which builds the RayJob resource and asserts both env vars are set on the head and worker containers.Reproduce:
Before:
After:
Labels
fixed
Check all the applicable boxes