Skip to content

Commit c6ddef6

Browse files
committed
[air] Suppress noisy missing requirements.yaml log
1 parent fdb851c commit c6ddef6

2 files changed

Lines changed: 35 additions & 3 deletions

File tree

experimental/air/cmd/logstream_support.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"fmt"
77
"io"
8+
"strings"
89
"time"
910
)
1011

@@ -143,10 +144,26 @@ func printTerminalEvent(out io.Writer, runID, status, dashboardURL string) {
143144
fmt.Fprintln(out, string(b))
144145
}
145146

146-
// emitLogLine writes one log line: raw in text mode, or a JSONL LOG event under
147-
// --json. In --json mode a line matching a fatal-failure pattern also emits an
148-
// ALERT event first, giving an agent an immediate actionable signal.
147+
const (
148+
missingRequirementsNoticePrefix = "No co-located requirements.yaml at "
149+
missingRequirementsNoticeSuffix = "; skipping requirements.yaml install."
150+
)
151+
152+
// suppressLogLine reports whether a backend log line should be omitted.
153+
func suppressLogLine(body string) bool {
154+
// This backend-derived notice is non-actionable noise because requirements.yaml
155+
// is not supported by Databricks Air and is rejected earlier.
156+
return strings.HasPrefix(body, missingRequirementsNoticePrefix) &&
157+
strings.HasSuffix(body, missingRequirementsNoticeSuffix)
158+
}
159+
160+
// emitLogLine writes one relevant log line: raw in text mode, or a JSONL LOG
161+
// event under --json. In --json mode a line matching a fatal-failure pattern also
162+
// emits an ALERT event first, giving an agent an immediate actionable signal.
149163
func emitLogLine(out io.Writer, req logRequest, body string) {
164+
if suppressLogLine(body) {
165+
return
166+
}
150167
if !req.jsonOutput {
151168
fmt.Fprintln(out, body)
152169
return

experimental/air/cmd/logstream_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,21 @@ func TestEmitLogLineText(t *testing.T) {
291291
assert.Equal(t, "hello\n", buf.String())
292292
}
293293

294+
func TestEmitLogLineSuppressesMissingRequirementsNotice(t *testing.T) {
295+
body := "No co-located requirements.yaml at /Workspace/Users/user/.air/cli_launch/run/requirements.yaml; skipping requirements.yaml install."
296+
297+
for _, req := range []logRequest{{node: 0}, {node: 0, jsonOutput: true}} {
298+
var buf bytes.Buffer
299+
emitLogLine(&buf, req, body)
300+
assert.Empty(t, buf.String())
301+
}
302+
}
303+
304+
func TestSuppressLogLineKeepsRequirementsErrors(t *testing.T) {
305+
assert.False(t, suppressLogLine("ERROR: requirements.yaml not found"))
306+
assert.False(t, suppressLogLine("ERROR: Failed to process requirements.yaml"))
307+
}
308+
294309
func TestEmitLogLineJSONFatalEmitsAlert(t *testing.T) {
295310
var buf bytes.Buffer
296311
emitLogLine(&buf, logRequest{node: 1, jsonOutput: true}, "CUDA out of memory")

0 commit comments

Comments
 (0)