|
|
|
@@ -106,6 +106,12 @@ 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 { |
|
|
|
@@ -113,13 +119,7 @@ sendjob: |
|
|
|
return &result, fmt.Errorf("son.Unmarshal failed: %s", err.Error()) |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode != 0 { |
|
|
|
if len(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,6 +145,12 @@ sendjob: |
|
|
|
return nil, fmt.Errorf("resty GetJob: %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 { |
|
|
|
@@ -152,13 +158,7 @@ sendjob: |
|
|
|
return &result, fmt.Errorf("son.Unmarshal failed: %s", err.Error()) |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode != 0 { |
|
|
|
if len(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) |
|
|
|
} |
|
|
|
@@ -185,6 +185,12 @@ 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 { |
|
|
|
@@ -192,13 +198,7 @@ sendjob: |
|
|
|
return &result, fmt.Errorf("son.Unmarshal failed: %s", err.Error()) |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode != 0 { |
|
|
|
if len(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) |
|
|
|
} |
|
|
|
@@ -224,6 +224,12 @@ 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 { |
|
|
|
@@ -231,13 +237,7 @@ sendjob: |
|
|
|
return &result, fmt.Errorf("son.Unmarshal failed: %s", err.Error()) |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode != 0 { |
|
|
|
if len(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) |
|
|
|
} |
|
|
|
@@ -263,6 +263,12 @@ 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 { |
|
|
|
@@ -270,13 +276,7 @@ sendjob: |
|
|
|
return &result, fmt.Errorf("son.Unmarshal failed: %s", err.Error()) |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode == http.StatusUnauthorized && retry < 1 { |
|
|
|
retry++ |
|
|
|
_ = getToken() |
|
|
|
goto sendjob |
|
|
|
} |
|
|
|
|
|
|
|
if response.ErrorCode != 0 { |
|
|
|
if len(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) |
|
|
|
} |
|
|
|
|