<#4266 Ray logs persistence> Pull request opened b...
# flyte-github
a
#4266 Ray logs persistence Pull request opened by jeevb Describe your changes Injects a logging sidecar to tail and expose RayJob logs to the container's stdout, and in turn, to a cluster's logging infrastructure. This will allow job logs to be persisted to Cloudwatch, Stackdriver, or other storage backend for perusal at a later time. Also adds support for specifying multiple containers in a pod template for Ray tasks. Check all the applicable boxes ☐ I updated the documentation accordingly. ☑︎ All new and existing tests passed. ☑︎ All commits are signed-off. Screenshots Got this working with the following
fluent-bit.conf
config:
Copy code
[SERVICE]
    Log_Level error
[INPUT]
    Name tail
    Path /tmp/ray/session_latest/logs/job-driver-*
    Refresh_Interval 1
[OUTPUT]
    Name file
    Match *
    File /dev/stdout
    Format template
    Template {log}
Note that the
stdout
output plugin could work here as well if structured logs are desired, but I went with just exposing logs as plaintext for now. Sidecar stdout looks as follows:
Copy code
> kubectl logs -f r9d1584b28b7d-taskraytask-0-raycluster-kksrv-head-fhm4q -c logs
Fluent Bit v2.1.10
* Copyright (C) 2015-2022 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

tar: Removing leading `/' from member names

2023-10-31 23:17:27,711	INFO worker.py:1329 -- Using address 10.42.0.11:6379 set in the environment variable RAY_ADDRESS
2023-10-31 23:17:27,712	INFO worker.py:1458 -- Connecting to existing Ray cluster at address: 10.42.0.11:6379...
2023-10-31 23:17:27,718	INFO worker.py:1633 -- Connected to Ray cluster. View the dashboard at http://10.42.0.11:8265
(compute_squared pid=186) Computing squared of 0...
(compute_squared pid=186) Computed squared of 0: 0
(compute_squared pid=85, ip=10.42.0.12) Computing squared of 1...
(compute_squared pid=186) Computing squared of 2...
(compute_squared pid=186) Computed squared of 2: 4 [repeated 2x across cluster] (Ray deduplicates logs by default. Set RAY_DEDUP_LOGS=0 to disable log deduplication, or see https://docs.ray.io/en/master/ray-observability/ray-logging.html#log-deduplication for more options.)
(compute_squared pid=85, ip=10.42.0.12) Computing squared of 3...
(compute_squared pid=186) Computing squared of 4...
(compute_squared pid=85, ip=10.42.0.12) Computed squared of 3: 9
[2023/10/31 23:18:44] [engine] caught signal (SIGTERM)
Note to reviewers flyteorg/flyte Codecov: 59.06% (-0.47%) compared to b6b0d61 ✅ 29 other checks have passed 29/30 successful checks