service: avoid hard pod log dependency for remote jobs
This commit is contained in:
parent
34dfc165d6
commit
8f0d5389c2
@ -193,16 +193,26 @@ func (a *App) runRemotePod(jobID, podName string, podSpec map[string]any) (strin
|
||||
if strings.TrimSpace(state.Message) != "" {
|
||||
return strings.TrimSpace(state.Message), nil
|
||||
}
|
||||
return a.remotePodLogs(kube, podName)
|
||||
logs, logErr := a.remotePodLogs(kube, podName)
|
||||
if strings.TrimSpace(logs) != "" {
|
||||
return strings.TrimSpace(logs), nil
|
||||
}
|
||||
if logErr != nil {
|
||||
return "", fmt.Errorf("remote pod %s succeeded but did not return a result payload; logs unavailable: %v", podName, logErr)
|
||||
}
|
||||
return "", fmt.Errorf("remote pod %s succeeded but did not return a result payload", podName)
|
||||
case "Failed":
|
||||
if strings.TrimSpace(state.Message) != "" {
|
||||
return "", fmt.Errorf("remote pod %s failed: %s", podName, strings.TrimSpace(state.Message))
|
||||
}
|
||||
logs, _ := a.remotePodLogs(kube, podName)
|
||||
if strings.TrimSpace(logs) != "" {
|
||||
if logs, logErr := a.remotePodLogs(kube, podName); logErr == nil && strings.TrimSpace(logs) != "" {
|
||||
return "", fmt.Errorf("remote pod %s failed: %s", podName, strings.TrimSpace(logs))
|
||||
}
|
||||
return "", fmt.Errorf("remote pod %s failed: %s %s", podName, state.Reason, state.Message)
|
||||
reason := strings.TrimSpace(state.Reason)
|
||||
if reason == "" {
|
||||
reason = "remote worker failed before reporting details"
|
||||
}
|
||||
return "", fmt.Errorf("remote pod %s failed: %s", podName, reason)
|
||||
}
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user