mirror of https://github.com/databricks/cli.git
better debug logs
This commit is contained in:
parent
30a582a5e3
commit
efdb977470
|
@ -1,10 +1,4 @@
|
|||
attempt 0:
|
||||
err: Endpoint not implemented.
|
||||
response body: (*telemetry.ResponseBody)(nil)
|
||||
attempt 1:
|
||||
err: Endpoint not implemented.
|
||||
response body: (*telemetry.ResponseBody)(nil)
|
||||
attempt 2:
|
||||
err: Endpoint not implemented.
|
||||
response body: (*telemetry.ResponseBody)(nil)
|
||||
Attempt 0 failed due to a server side error. Retrying status code: 501
|
||||
Attempt 1 failed due to a server side error. Retrying status code: 501
|
||||
Attempt 2 failed due to a server side error. Retrying status code: 501
|
||||
error: upload did not succeed after three attempts
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
attempt 0:
|
||||
err: %!s(<nil>)
|
||||
response body: &telemetry.ResponseBody{Errors:[]telemetry.LogError{}, NumProtoSuccess:1}
|
||||
attempt 1:
|
||||
err: %!s(<nil>)
|
||||
response body: &telemetry.ResponseBody{Errors:[]telemetry.LogError{}, NumProtoSuccess:1}
|
||||
attempt 2:
|
||||
err: %!s(<nil>)
|
||||
response body: &telemetry.ResponseBody{Errors:[]telemetry.LogError{}, NumProtoSuccess:1}
|
||||
Attempt 0 was a partial success. Number of logs uploaded: 1 out of 2
|
||||
Attempt 1 was a partial success. Number of logs uploaded: 1 out of 2
|
||||
Attempt 2 was a partial success. Number of logs uploaded: 1 out of 2
|
||||
error: upload did not succeed after three attempts
|
||||
|
|
|
@ -89,13 +89,9 @@ func Upload(ctx context.Context) (*ResponseBody, error) {
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
// Log API output if the upload failed for debugging purposes.
|
||||
fmt.Fprintf(os.Stderr, "attempt %d:\n", i)
|
||||
fmt.Fprintf(os.Stderr, "err: %s\n", err)
|
||||
fmt.Fprintf(os.Stderr, "response body: %#v\n", resp)
|
||||
|
||||
// Partial success. Retry.
|
||||
if err == nil && resp.NumProtoSuccess < int64(len(logs)) {
|
||||
fmt.Fprintf(os.Stderr, "Attempt %d was a partial success. Number of logs uploaded: %d out of %d\n", i, resp.NumProtoSuccess, len(logs))
|
||||
time.Sleep(2 * time.Second)
|
||||
continue
|
||||
}
|
||||
|
@ -105,6 +101,7 @@ func Upload(ctx context.Context) (*ResponseBody, error) {
|
|||
// ref: https://github.com/databricks/databricks-sdk-go/blob/cdb28002afacb8b762348534a4c4040a9f19c24b/apierr/errors.go#L91
|
||||
var apiErr *apierr.APIError
|
||||
if errors.As(err, &apiErr) && apiErr.StatusCode >= 500 && apiErr.StatusCode != 503 {
|
||||
fmt.Fprintf(os.Stderr, "Attempt %d failed due to a server side error. Retrying status code: %d\n", i, apiErr.StatusCode)
|
||||
time.Sleep(2 * time.Second)
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue