Skip to content

Commit 37b4ce0

Browse files
authored
Remove serving model log (#271)
1 parent 4db5936 commit 37b4ce0

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

pkg/operator/workloads/logs.go

+12-8
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func ReadLogs(appName string, podSearchLabels map[string]string, verbose bool, s
117117
}
118118

119119
if !wrotePending {
120-
if !writeSocket("\nPending", socket) {
120+
if !writeSocket("\nPending...", socket) {
121121
return
122122
}
123123
wrotePending = true
@@ -138,9 +138,10 @@ func getKubectlLogs(pods []kcore.Pod, verbose bool, wrotePending bool, previous
138138
}
139139

140140
if isAllPending {
141-
if !writeSocket("\nPending", socket) {
141+
if !writeSocket("\nPending...", socket) {
142142
return
143143
}
144+
wrotePending = true
144145
}
145146
}
146147

@@ -154,7 +155,7 @@ func getKubectlLogs(pods []kcore.Pod, verbose bool, wrotePending bool, previous
154155
podCheckCancel := make(chan struct{})
155156
defer close(podCheckCancel)
156157

157-
go podCheck(podCheckCancel, socket, pods, previous, verbose, inr)
158+
go podCheck(podCheckCancel, socket, pods, previous, verbose, wrotePending, inr)
158159
pumpStdin(socket, inw)
159160
podCheckCancel <- struct{}{}
160161
}
@@ -186,7 +187,7 @@ func startKubectlProcess(pod kcore.Pod, previous bool, attrs *os.ProcAttr) (*os.
186187
return process, nil
187188
}
188189

189-
func podCheck(podCheckCancel chan struct{}, socket *websocket.Conn, initialPodList []kcore.Pod, previous bool, verbose bool, inr *os.File) {
190+
func podCheck(podCheckCancel chan struct{}, socket *websocket.Conn, initialPodList []kcore.Pod, previous bool, verbose bool, wrotePending bool, inr *os.File) {
190191
timer := time.NewTimer(0)
191192
defer timer.Stop()
192193

@@ -266,6 +267,13 @@ func podCheck(podCheckCancel chan struct{}, socket *websocket.Conn, initialPodLi
266267
maxPodsToAdd = len(podsToAdd)
267268
}
268269

270+
if wrotePending && len(latestRunningPods) > 0 {
271+
if !writeSocket("Streaming logs:", socket) {
272+
return
273+
}
274+
wrotePending = false
275+
}
276+
269277
for _, podName := range podsToAdd[:maxPodsToAdd] {
270278
process, err := startKubectlProcess(latestRunningPodsMap[podName], previous, &os.ProcAttr{
271279
Files: []*os.File{inr, outw, outw},
@@ -453,10 +461,6 @@ func extractFromCortexLog(match string, loglevel string, logStr string) (*string
453461
return formatHeader3(cutStr), false
454462
}
455463

456-
if strings.HasPrefix(cutStr, "Serving model") {
457-
return formatHeader3(cutStr), false
458-
}
459-
460464
if strings.HasPrefix(cutStr, "Prediction failed") {
461465
return formatHeader2(cutStr), false
462466
}

pkg/workloads/cortex/onnx_serve/api.py

-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ def start(args):
237237
local_cache["sess"] = sess
238238
local_cache["input_metadata"] = sess.get_inputs()
239239
local_cache["output_metadata"] = sess.get_outputs()
240-
logger.info("Serving model: {}".format(util.remove_resource_ref(api["model"])))
241240
except CortexException as e:
242241
e.wrap("error")
243242
logger.error(str(e))

pkg/workloads/cortex/tf_api/api.py

-1
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,6 @@ def start(args):
532532

533533
time.sleep(1)
534534

535-
logger.info("Serving model: {}".format(util.remove_resource_ref(api["model"])))
536535
serve(app, listen="*:{}".format(args.port))
537536

538537

0 commit comments

Comments
 (0)