|
|
@@ -106,12 +106,6 @@ sendjob: |
|
|
|
return nil, fmt.Errorf("resty create job: %s", err) |
|
|
|
} |
|
|
|
|
|
|
|
if res.StatusCode() == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
var response models.NotebookResult |
|
|
|
err = json.Unmarshal(res.Body(), &response) |
|
|
|
if err != nil { |
|
|
@@ -119,7 +113,13 @@ sendjob: |
|
|
|
return &result, fmt.Errorf("son.Unmarshal failed: %s", err.Error()) |
|
|
|
} |
|
|
|
|
|
|
|
if len(response.ErrorCode) != 0 { |
|
|
|
if response.ErrorCode == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode != 0 { |
|
|
|
log.Error("CreateJob failed(%s): %s", response.ErrorCode, response.ErrorMsg) |
|
|
|
return &result, fmt.Errorf("CreateJob failed(%s): %s", response.ErrorCode, response.ErrorMsg) |
|
|
|
} |
|
|
@@ -145,14 +145,6 @@ sendjob: |
|
|
|
return nil, fmt.Errorf("resty GetJob: %v", err) |
|
|
|
} |
|
|
|
|
|
|
|
if res.StatusCode() == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
log.Info(string(res.Body())) |
|
|
|
|
|
|
|
var response models.NotebookResult |
|
|
|
err = json.Unmarshal(res.Body(), &response) |
|
|
|
if err != nil { |
|
|
@@ -160,7 +152,13 @@ sendjob: |
|
|
|
return &result, fmt.Errorf("son.Unmarshal failed: %s", err.Error()) |
|
|
|
} |
|
|
|
|
|
|
|
if len(response.ErrorCode) != 0 { |
|
|
|
if response.ErrorCode == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode != 0 { |
|
|
|
log.Error("GetJob failed(%s): %s", response.ErrorCode, response.ErrorMsg) |
|
|
|
return &result, fmt.Errorf("GetJob failed(%s): %s", response.ErrorCode, response.ErrorMsg) |
|
|
|
} |
|
|
@@ -187,12 +185,6 @@ sendjob: |
|
|
|
return &result, fmt.Errorf("resty StopJob: %v", err) |
|
|
|
} |
|
|
|
|
|
|
|
if res.StatusCode() == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
var response models.NotebookResult |
|
|
|
err = json.Unmarshal(res.Body(), &response) |
|
|
|
if err != nil { |
|
|
@@ -200,7 +192,13 @@ sendjob: |
|
|
|
return &result, fmt.Errorf("son.Unmarshal failed: %s", err.Error()) |
|
|
|
} |
|
|
|
|
|
|
|
if len(response.ErrorCode) != 0 { |
|
|
|
if response.ErrorCode == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode != 0 { |
|
|
|
log.Error("StopJob failed(%s): %s", response.ErrorCode, response.ErrorMsg) |
|
|
|
return &result, fmt.Errorf("StopJob failed(%s): %s", response.ErrorCode, response.ErrorMsg) |
|
|
|
} |
|
|
@@ -226,12 +224,6 @@ sendjob: |
|
|
|
return &result, fmt.Errorf("resty DelJob: %v", err) |
|
|
|
} |
|
|
|
|
|
|
|
if res.StatusCode() == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
var response models.NotebookResult |
|
|
|
err = json.Unmarshal(res.Body(), &response) |
|
|
|
if err != nil { |
|
|
@@ -239,7 +231,13 @@ sendjob: |
|
|
|
return &result, fmt.Errorf("son.Unmarshal failed: %s", err.Error()) |
|
|
|
} |
|
|
|
|
|
|
|
if len(response.ErrorCode) != 0 { |
|
|
|
if response.ErrorCode == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode != 0 { |
|
|
|
log.Error("DelJob failed(%s): %s", response.ErrorCode, response.ErrorMsg) |
|
|
|
return &result, fmt.Errorf("DelJob failed(%s): %s", response.ErrorCode, response.ErrorMsg) |
|
|
|
} |
|
|
@@ -265,12 +263,6 @@ sendjob: |
|
|
|
return &result, fmt.Errorf("resty GetJobToken: %v", err) |
|
|
|
} |
|
|
|
|
|
|
|
if res.StatusCode() == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
var response models.NotebookResult |
|
|
|
err = json.Unmarshal(res.Body(), &response) |
|
|
|
if err != nil { |
|
|
@@ -278,7 +270,13 @@ sendjob: |
|
|
|
return &result, fmt.Errorf("son.Unmarshal failed: %s", err.Error()) |
|
|
|
} |
|
|
|
|
|
|
|
if len(response.ErrorCode) != 0 { |
|
|
|
if response.ErrorCode == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode != 0 { |
|
|
|
log.Error("GetJobToken failed(%s): %s", response.ErrorCode, response.ErrorMsg) |
|
|
|
return &result, fmt.Errorf("GetJobToken failed(%s): %s", response.ErrorCode, response.ErrorMsg) |
|
|
|
} |
|
|
|