|
|
@@ -180,7 +180,7 @@ func generateCommand(repoName, bootFile, datasetName string) string { |
|
|
|
} |
|
|
|
currentTimeNow := time.Now() |
|
|
|
timePostfix := currentTimeNow.Format("20060102_150405") |
|
|
|
command += "cd " + copyDatasetPath + ";echo " + timePostfix + " | tee /output/log_" + timePostfix + ".txt; uvicorn " + bootonlyfile + ":app --host 0.0.0.0 --port $OCTOPUS_NOTEBOOK_PORT 2>&1 | tee -a /output/log_" + timePostfix + ".txt;" |
|
|
|
command += "cd " + copyDatasetPath + ";echo " + timePostfix + " | tee /output/log_" + timePostfix + ".txt; uvicorn " + bootonlyfile + ":app --log-level debug --host 0.0.0.0 --port $OCTOPUS_NOTEBOOK_PORT 2>&1 | tee -a /output/log_" + timePostfix + ".txt;" |
|
|
|
|
|
|
|
log.Info("comand=" + command) |
|
|
|
return command |
|
|
@@ -351,8 +351,28 @@ func (c C2NetClusterAdapter) GetNoteBookUrl(jobId string) (string, error) { |
|
|
|
if res.Url == "" { |
|
|
|
return "", errors.New("notebook task error") |
|
|
|
} |
|
|
|
onlyForOnlineInference(res.Url, jobId) |
|
|
|
return res.Url + "?token=" + res.Token, nil |
|
|
|
} |
|
|
|
|
|
|
|
func onlyForOnlineInference(url string, jobId string) { |
|
|
|
cloudbrainTask, bizErr := models.GetCloudbrainByJobID(jobId) |
|
|
|
if bizErr == nil { |
|
|
|
if cloudbrainTask.JobType != string(models.JobTypeOnlineInference) { |
|
|
|
return |
|
|
|
} |
|
|
|
} else { |
|
|
|
return |
|
|
|
} |
|
|
|
if strings.HasPrefix(url, setting.Grampus.NoteBookDomainURL) { |
|
|
|
tmpurl := strings.Replace(url, setting.Grampus.NoteBookDomainURL, setting.Grampus.NoteBookLocalURL, 1) |
|
|
|
grampus.ClickOnce(tmpurl) |
|
|
|
tmpurl += "/queue/join" |
|
|
|
wsurl := strings.Replace(tmpurl, "http", "ws", 1) |
|
|
|
grampus.SendMsgToWebsocket(wsurl, "{\"msg\":\"send_hash\"}") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (c C2NetClusterAdapter) GetNoteBookOperationProfile(jobId string) (*entity.OperationProfile, error) { |
|
|
|
if jobId == "" { |
|
|
|
log.Error("jobid is empty") |
|
|
|