public async Task <IActionResult> GetDetail(long?id) { if (id == null) { return(JsonBadRequest("Notebook ID is required.")); } var notebookHistory = await notebookHistoryRepository.GetIncludeAllAsync(id.Value); if (notebookHistory == null) { return(JsonNotFound($"Notebook ID {id.Value} is not found.")); } var model = new DetailsOutputModel(notebookHistory); var status = notebookHistory.GetStatus(); model.StatusType = status.StatusType; if (status.Exist()) { //コンテナがまだ存在している場合、情報を更新する var details = await clusterManagementLogic.GetContainerEndpointInfoAsync(notebookHistory.Key, CurrentUserInfo.SelectedTenant.Name, false); model.Status = details.Status.Name; model.StatusType = details.Status.StatusType; //ステータスを更新 notebookHistory.Status = details.Status.Key; if (notebookHistory.StartedAt == null) { notebookHistory.StartedAt = details.StartedAt; notebookHistory.Node = details.Node; //設計上ノードが切り替わることはない } unitOfWork.Commit(); model.ConditionNote = details.ConditionNote; //コンテナが正常動作している場合、notebookのエンドポイントを取得 if (details.Status.IsRunning()) { model.NotebookNodePort = GetNotebookNodePort(details.EndPoints); model.NotebookToken = await GetNotebookTokenAsync(notebookHistory.Id); } } if (notebookHistory.ModelGitId != null) { //Gitの表示用URLを作る model.GitModel.Url = gitLogic.GetTreeUiUrl(notebookHistory.ModelGitId.Value, notebookHistory.ModelRepository, notebookHistory.ModelRepositoryOwner, notebookHistory.ModelCommitId); } return(JsonOK(model)); }
public async Task <IActionResult> GetDetail(long?id) { if (id == null) { return(JsonBadRequest("Training ID is required.")); } var history = await trainingHistoryRepository.GetIncludeAllAsync(id.Value); if (history == null) { return(JsonNotFound($"Training ID {id.Value} is not found.")); } var model = new DetailsOutputModel(history); model.Tags = tagLogic.GetAllTrainingHistoryTag(history.Id).Select(t => t.Name); var status = history.GetStatus(); model.StatusType = status.StatusType; if (status.Exist()) { //コンテナがまだ存在している場合、情報を更新する var details = await clusterManagementLogic.GetContainerDetailsInfoAsync(history.Key, CurrentUserInfo.SelectedTenant.Name, false); model.Status = details.Status.Name; model.StatusType = details.Status.StatusType; //ステータスを更新 history.Status = details.Status.Key; unitOfWork.Commit(); model.ConditionNote = details.ConditionNote; if (details.Status.IsRunning()) { // 開放ポート未指定時には行わない if (model.Ports != null && model.Ports.Count > 0) { var endpointInfo = await clusterManagementLogic.GetContainerEndpointInfoAsync(history.Key, CurrentUserInfo.SelectedTenant.Name, false); foreach (var endpoint in endpointInfo.EndPoints ?? new List <EndPointInfo>()) { //ノードポート番号を返す model.NodePorts.Add(new KeyValuePair <string, string>(endpoint.Key, endpoint.Port.ToString())); } } } } //Gitの表示用URLを作る model.GitModel.Url = gitLogic.GetTreeUiUrl(history.ModelGitId, history.ModelRepository, history.ModelRepositoryOwner, history.ModelCommitId); return(JsonOK(model)); }
public async Task <IActionResult> GetDetail(long?id) { if (id == null) { return(JsonBadRequest("Inference ID is required.")); } var history = await inferenceHistoryRepository.GetIncludeAllAsync(id.Value); if (history == null) { return(JsonNotFound($"Inference ID {id.Value} is not found.")); } var model = new InferenceDetailsOutputModel(history); var status = history.GetStatus(); model.StatusType = status.StatusType; if (status.Exist()) { //コンテナがまだ存在している場合、情報を更新する var details = await clusterManagementLogic.GetContainerEndpointInfoAsync(history.Key, CurrentUserInfo.SelectedTenant.Name, false); model.Status = details.Status.Name; model.StatusType = details.Status.StatusType; //ステータスを更新 history.Status = details.Status.Key; if (history.StartedAt == null) { history.StartedAt = details.StartedAt; history.Node = details.Node; //設計上ノードが切り替わることはない } unitOfWork.Commit(); model.ConditionNote = details.ConditionNote; if (details.Status.IsRunning()) { //コンテナが正常に動いているので、エンドポイントを表示する model.Endpoints = details.EndPoints; } } //Gitの表示用URLを作る model.GitModel.Url = gitLogic.GetTreeUiUrl(history.ModelGitId.Value, history.ModelRepository, history.ModelRepositoryOwner, history.ModelCommitId); return(JsonOK(model)); }