Example #1
0
        /// <summary>
        /// 前処理コンテナを削除し、ステータスを変更する。
        /// 削除可否の判断が必要なら、呼び出しもとで判定すること。
        /// </summary>
        /// <param name="preprocessHistory">対象前処理履歴</param>
        /// <param name="force">他テナントに対する変更を許可するか</param>
        public async Task <bool> DeleteAsync(PreprocessHistory preprocessHistory, bool force)
        {
            // 前処理結果を削除
            bool result = true;

            foreach (var outputDataId in preprocessHistoryRepository.GetPreprocessOutputs(preprocessHistory.Id))
            {
                //1件でも失敗したら結果はfalse。ただし、エラーが出ても最後まで消し切る。
                result &= await dataLogic.DeleteDataAsync(outputDataId);
            }

            // 前処理履歴の削除
            preprocessHistoryRepository.Delete(preprocessHistory, force);

            // 結果に関わらずコミット
            unitOfWork.Commit();

            var status = ContainerStatus.Convert(preprocessHistory.Status);

            if (status.Exist())
            {
                //コンテナが動いていれば、停止する
                await clusterManagementLogic.DeleteContainerAsync(
                    ContainerType.Preprocessing, preprocessHistory.Name, CurrentUserInfo.SelectedTenant.Name, force);
            }

            return(result);
        }
        public async Task <IActionResult> GetDetailHistory([FromRoute] long id, [FromRoute] long?dataId)
        {
            if (dataId == null)
            {
                return(JsonBadRequest("Data ID is required."));
            }

            var history = await preprocessHistoryRepository.GetPreprocessIncludeDataAndPreprocessAsync(id, dataId.Value);

            if (history == null)
            {
                return(JsonNotFound($"Preprocessing History about Preprocess {id} to Data {dataId} is not found."));
            }

            var result = new HistoryDetailsOutputModel(history);

            result = await GetUpdatedIndexOutputModelAsync(history, result) as HistoryDetailsOutputModel;

            result.OutputDataIds = preprocessHistoryRepository.GetPreprocessOutputs(history.Id);
            return(JsonOK(result));
        }