Пример #1
0
        public async Task TestDelete()
        {
            string flowName = "localconfiggentest";

            var testingConfig = await File.ReadAllTextAsync(@"Resource\flowSaved.json");

            await DesignTimeStorage.SaveByName(flowName, testingConfig, FlowDataManager.DataCollectionName);

            // generate runtime configs
            var result = await this.RuntimeConfigGeneration.GenerateRuntimeConfigs(flowName);

            var runtimeConfigFolderUri = result.Properties?.GetValueOrDefault(PrepareJobConfigVariables.ResultPropertyName_RuntimeConfigFolder, null);

            _runtimeConfigFolder = new System.Uri(runtimeConfigFolderUri.ToString()).AbsolutePath;

            Assert.IsTrue(result.IsSuccess);

            // Invoke delete
            var runtimeDeleteResult = await RuntimeConfigGeneration.DeleteConfigs(flowName);

            Ensure.IsSuccessResult(runtimeDeleteResult);

            // Ensure flow config doesn't exist anymore
            var flowConfigs = await this.DesignTimeStorage.GetAll(FlowDataManager.DataCollectionName);

            Assert.IsTrue(flowConfigs.Count() == 0);

            // Ensure job config doesn't exist anymore
            var jobConfigs = await this.DesignTimeStorage.GetAll(SparkJobData.DataCollectionName);

            Assert.IsTrue(jobConfigs.Count() == 0);

            // Ensure runtime configs folder doesn't exist anymore
            Assert.IsTrue(!Directory.Exists(_runtimeConfigFolder));
        }
Пример #2
0
        public FlowManagementController(ILogger <FlowManagementController> logger, FlowOperation flowOp, RuntimeConfigGeneration runtimeConfigGenerator, JobOperation jobOp)
        {
            _logger                 = logger;
            _flowOperation          = flowOp;
            _jobOperation           = jobOp;
            _runtimeConfigGenerator = runtimeConfigGenerator;

            if (InitialConfiguration.Instance.TryGet(DataX.Config.ConfigDataModel.Constants.ConfigSettingName_EnableOneBox, out string enableOneBox))
            {
                _isLocal = enableOneBox.ToLower().Equals("true");
            }
        }
Пример #3
0
        /// <summary>
        /// Schedule batch jobs
        /// </summary>
        /// <param name="runtimeConfigGeneration"></param>
        /// <returns></returns>
        public async Task <Result> ScheduleBatch(RuntimeConfigGeneration runtimeConfigGeneration)
        {
            var flows = await GetByMode(Constants.InputMode_Batching).ConfigureAwait(false);

            Result result = null;

            foreach (var flow in flows)
            {
                var name = flow.Name;
                result = await runtimeConfigGeneration.GenerateRuntimeConfigs(name).ConfigureAwait(false);

                if (result.IsSuccess)
                {
                    result = await RestartJobsForFlow(name).ConfigureAwait(false);
                }
            }

            return(result ?? new SuccessResult("done"));
        }