Exemplo n.º 1
0
        public async Task <IActionResult> GetDetailTemplateVersion(long id, long versionId)
        {
            var templateVersion = await templateVersionRepository
                                  .GetAll()
                                  .Include(x => x.PreprocessContainerRegistry)
                                  .Include(x => x.TrainingContainerRegistry)
                                  .Include(x => x.EvaluationContainerRegistry)
                                  .SingleOrDefaultAsync(x => x.Id == versionId && x.TemplateId == id);

            if (templateVersion == null)
            {
                return(JsonNotFound($"TemplateVersion (Id {id} VersionId {versionId}) is not found."));
            }

            var model = new VersionDetailsOutputModel(templateVersion);

            // Gitの表示用URLを作る
            if (templateVersion.PreprocessRepositoryGitId != null)
            {
                model.PreprocessGitModel.Url = gitLogic.GetTreeUiUrl(templateVersion.PreprocessRepositoryGitId.Value, templateVersion.PreprocessRepositoryName, templateVersion.PreprocessRepositoryOwner, templateVersion.PreprocessRepositoryCommitId);
            }
            model.TrainingGitModel.Url = gitLogic.GetTreeUiUrl(templateVersion.TrainingRepositoryGitId, templateVersion.TrainingRepositoryName, templateVersion.TrainingRepositoryOwner, templateVersion.TrainingRepositoryCommitId);
            if (templateVersion.EvaluationRepositoryGitId != null)
            {
                model.EvaluationGitModel.Url = gitLogic.GetTreeUiUrl(templateVersion.EvaluationRepositoryGitId.Value, templateVersion.EvaluationRepositoryName, templateVersion.EvaluationRepositoryOwner, templateVersion.EvaluationRepositoryCommitId);
            }

            return(JsonOK(model));
        }
        public async Task <IActionResult> GetDetail(long?id, [FromServices] IPreprocessHistoryRepository preprocessHistoryRepository)
        {
            if (id == null)
            {
                return(JsonBadRequest("Preprocessing ID is required."));
            }
            var preprocessing = await preprocessRepository.GetIncludeAllAsync(id.Value);

            if (preprocessing == null)
            {
                return(JsonNotFound($"Preprocessing Id {id.Value} is not found."));
            }

            var model = new DetailsOutputModel(preprocessing)
            {
                IsLocked = await preprocessHistoryRepository.ExistsAsync(p => p.PreprocessId == id.Value)
            };

            //Gitの表示用URLを作る
            if (preprocessing.RepositoryGitId != null)
            {
                model.GitModel.Url = gitLogic.GetTreeUiUrl(preprocessing.RepositoryGitId.Value, preprocessing.RepositoryName, preprocessing.RepositoryOwner, preprocessing.RepositoryCommitId);
            }

            return(JsonOK(model));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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);

            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;
            }

            //Gitの表示用URLを作る
            model.GitModel.Url = gitLogic.GetTreeUiUrl(history.ModelGitId, history.ModelRepository, history.ModelRepositoryOwner, history.ModelCommitId);
            return(JsonOK(model));
        }