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

            // Point these two settings to your filesystem locations
            InitialConfiguration.Set(LocalSparkClient.ConfigSettingName_SparkHomeFolder, @"<LOCAL SPARK HOME FOLDER>");
            InitialConfiguration.Set(Constants.ConfigSettingName_LocalRoot, @"<LOCAL ROOT>");

            var input = await File.ReadAllTextAsync(@"Resource\guiInputLocal.json");

            var inputJson = JsonConfig.From(input);
            var result    = await this.FlowOperation.SaveFlowConfig(FlowGuiConfig.From(inputJson));

            Assert.IsTrue(result.IsSuccess, result.Message);

            var result2 = await this.RuntimeConfigGeneration.GenerateRuntimeConfigs(flowName);

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

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

            var jobResult1 = await JobOperation.StartJob(flowName);

            Assert.IsTrue(jobResult1.IsSuccess);
            // Wait for few seconds for the job to do some work
            System.Threading.Thread.Sleep(5000);
            var jobResult2 = await JobOperation.StopJob(flowName);

            Assert.IsTrue(jobResult2.IsSuccess);
        }
        public async Task <ApiResult> StopJob([FromBody] string jobName)
        {
            try
            {
                RolesCheck.EnsureWriter(Request, _isLocal);
                Ensure.NotNull(jobName, "jobName");

                // Stop the job
                var jobOpResult = await _jobOperation.StopJob(jobName);

                return(ApiResult.CreateSuccess(JToken.FromObject(jobOpResult)));
            }
            catch (Exception e)
            {
                _logger.LogError(e, e.Message);
                return(ApiResult.CreateError(e.Message));
            }
        }