|
|
@@ -418,15 +418,23 @@ func RestartNotebookJob(jobID string) (*models.GrampusNotebookRestartResponse, e |
|
|
checkSetting() |
|
|
checkSetting() |
|
|
client := getRestyClient() |
|
|
client := getRestyClient() |
|
|
var restartResponse *models.GrampusNotebookRestartResponse |
|
|
var restartResponse *models.GrampusNotebookRestartResponse |
|
|
|
|
|
retry := 0 |
|
|
|
|
|
|
|
|
|
|
|
sendjob: |
|
|
res, err := client.R(). |
|
|
res, err := client.R(). |
|
|
SetAuthToken(TOKEN). |
|
|
SetAuthToken(TOKEN). |
|
|
SetResult(&restartResponse). |
|
|
SetResult(&restartResponse). |
|
|
Get(HOST + urlNotebookJob + "/" + jobID + "/start") |
|
|
|
|
|
|
|
|
Post(HOST + urlNotebookJob + "/" + jobID + "/start") |
|
|
|
|
|
|
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return nil, fmt.Errorf("resty grampus restart note book job: %v", err) |
|
|
return nil, fmt.Errorf("resty grampus restart note book job: %v", err) |
|
|
} |
|
|
} |
|
|
|
|
|
if restartResponse.ErrorCode == errorIllegalToken && retry < 1 { |
|
|
|
|
|
retry++ |
|
|
|
|
|
log.Info("retry get token") |
|
|
|
|
|
_ = getToken() |
|
|
|
|
|
goto sendjob |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if res.StatusCode() != http.StatusOK { |
|
|
if res.StatusCode() != http.StatusOK { |
|
|
log.Error("resty grampus restart note book job failed(%s): %v", res.String(), err.Error()) |
|
|
log.Error("resty grampus restart note book job failed(%s): %v", res.String(), err.Error()) |
|
|
|