Skip to content

fix(plugins/ray): disable ANSI color codes and Ray Data progress bars in pod logs#7504

Open
1fanwang wants to merge 1 commit into
flyteorg:mainfrom
1fanwang:fix/ray-disable-log-noise
Open

fix(plugins/ray): disable ANSI color codes and Ray Data progress bars in pod logs#7504
1fanwang wants to merge 1 commit into
flyteorg:mainfrom
1fanwang:fix/ray-disable-log-noise

Conversation

@1fanwang

@1fanwang 1fanwang commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Why are the changes needed?

Ray decorates its output for an interactive terminal — ANSI-colored log prefixes and tqdm-style Ray Data progress bars. Flyte collects Ray pod stdout to a non-interactive log sink, where these turn into escape-sequence noise (\x1b[2m\x1b[36m(pid=...)\x1b[0m) and repeated progress-bar frames that hurt log readability and search.

What changes were proposed in this pull request?

Set two env vars on the Ray head and worker containers to turn the decorations off: RAY_COLOR_PREFIX=0 (no ANSI in prefixes) and RAY_DATA_DISABLE_PROGRESS_BARS=1 (no Ray Data progress bars). They sit alongside the existing RAY_DISABLE_DOCKER_CPU_WARNING and are no-ops on Ray builds that don't read them.

How was this patch tested?

TestBuildResourceRay_DisablesLogNoiseEnv asserts both land on the head and worker containers. Against a real Ray 2.55.1 runtime, RAY_COLOR_PREFIX=0 strips the colored (pid=…) prefix that otherwise reaches the log sink; on a live KubeRay cluster the vars carry through to the running head pod's container.

Labels

fixed

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Copilot AI review requested due to automatic review settings June 11, 2026 17:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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=0 and RAY_DATA_DISABLE_PROGRESS_BARS=1 on 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
pingsutw previously approved these changes Jun 11, 2026

@pingsutw pingsutw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, are you running v2 Flyte on the internal cluster?

Sovietaced
Sovietaced previously approved these changes Jun 11, 2026
@Sovietaced

Copy link
Copy Markdown
Member

@1fanwang Can you resolve the conflicts?

… in pod logs

Signed-off-by: 1fanwang <1fannnw@gmail.com>
@1fanwang 1fanwang dismissed stale reviews from Sovietaced and pingsutw via 6b2f8f0 June 20, 2026 22:34
@1fanwang 1fanwang force-pushed the fix/ray-disable-log-noise branch from 4387d1d to 6b2f8f0 Compare June 20, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants