Exemplo n.º 1
0
        public DetailsOutputModel(NotebookHistory history) : base(history)
        {
            Key = history.Key;
            if (history.DataSet != null) {
                DataSet = new DataSetApiModels.IndexOutputModel(history.DataSet);
            }
            Options = new List<KeyValuePair<string, string>>();
            GitModel = new GitCommitOutputModel()
            {
                GitId = history.ModelGitId,
                Repository = history.ModelRepository,
                Owner = history.ModelRepositoryOwner,
                Branch = history.ModelBranch,
                CommitId = history.ModelCommitId
            };
            ContainerImage = new ContainerImageOutputModel()
            {
                Image = history.ContainerImage,
                Tag = history.ContainerTag
            };
            if (history.ContainerRegistryId.HasValue)
            {
                ContainerImage.RegistryId = history.ContainerRegistryId.Value;
                ContainerImage.RegistryName = history.ContainerRegistry.Name;
            }

            CompletedAt = history.CompletedAt?.ToFormatedString();
            StartedAt = history.StartedAt?.ToFormatedString();
            Node = history.Node;

            Cpu = history.Cpu;
            Memory = history.Memory;
            Gpu = history.Gpu;
            Partition = history.Partition;

            ExpiresIn = history.ExpiresIn;

            foreach (var option in history.GetOptionDic())
            {
                Options.Add(new KeyValuePair<string, string>(option.Key, option.Value));
            }

            // 待機時間と実行時間の設定
            SetWaitingAndExecutionTimes(history);
        }
Exemplo n.º 2
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="history">ノートブック履歴</param>
        public DetailsOutputModel(NotebookHistory history) : base(history)
        {
            Key = history.Key;
            if (history.DataSet != null)
            {
                DataSet = new DataSetApiModels.IndexOutputModel(history.DataSet);
            }

            if (history.ParentTrainingMaps != null)
            {
                Parents = new List <TrainingApiModels.IndexOutputModel>();
                foreach (var parentTrainingMaps in history.ParentTrainingMaps)
                {
                    var parent = new TrainingApiModels.IndexOutputModel(parentTrainingMaps.Parent);
                    Parents.Add(parent);
                }
                Parents.Sort(delegate(TrainingApiModels.IndexOutputModel parent1, TrainingApiModels.IndexOutputModel parent2)
                {
                    return(parent1.Id.CompareTo(parent2.Id));
                });
            }

            if (history.ParentInferenceMaps != null)
            {
                Inferences = new List <InferenceApiModels.InferenceIndexOutputModel>();
                foreach (var parentInferenceMap in history.ParentInferenceMaps)
                {
                    var parentInference = new InferenceApiModels.InferenceIndexOutputModel(parentInferenceMap.Parent);
                    Inferences.Add(parentInference);
                }
                Inferences.Sort(delegate(InferenceApiModels.InferenceIndexOutputModel parentInference1, InferenceApiModels.InferenceIndexOutputModel parentInference2)
                {
                    return(parentInference1.Id.CompareTo(parentInference2.Id));
                });
            }

            Options  = new List <KeyValuePair <string, string> >();
            GitModel = new GitCommitOutputModel()
            {
                GitId      = history.ModelGitId,
                Repository = history.ModelRepository,
                Owner      = history.ModelRepositoryOwner,
                Branch     = history.ModelBranch,
                CommitId   = history.ModelCommitId
            };
            ContainerImage = new ContainerImageOutputModel()
            {
                Image = history.ContainerImage,
                Tag   = history.ContainerTag
            };
            if (history.ContainerRegistryId.HasValue)
            {
                ContainerImage.RegistryId   = history.ContainerRegistryId.Value;
                ContainerImage.RegistryName = history.ContainerRegistry.Name;
            }

            CompletedAt = history.CompletedAt?.ToFormatedString();
            StartedAt   = history.StartedAt?.ToFormatedString();
            Node        = history.Node;

            Cpu       = history.Cpu;
            Memory    = history.Memory;
            Gpu       = history.Gpu;
            Partition = history.Partition;

            JupyterLabVersion = history.JupyterLabVersion;

            ExpiresIn    = history.ExpiresIn;
            LocalDataSet = history.LocalDataSet;

            foreach (var option in history.GetOptionDic())
            {
                Options.Add(new KeyValuePair <string, string>(option.Key, option.Value));
            }

            // 待機時間と実行時間の設定
            SetWaitingAndExecutionTimes(history);

            EntryPoint = history.EntryPoint;
        }