コード例 #1
0
ファイル: CacheDB.cs プロジェクト: Dhanas-git/dotnet
        public ActionResult InjectTasks([FromServices] IStonebranchClient stonebranchClient, string customerShortName, string projectShortName, string workflowInstanceId, string finishTaskId, Guid jobId)
        {
            var job = _jobProxy.GetJob(customerShortName, projectShortName, jobId);

            _workStatusProxy.Add(job, AnalyticsRunStatus.Running, 0, true, true);
            AddTasks(stonebranchClient, job, workflowInstanceId, finishTaskId);
            return(Ok());
        }
コード例 #2
0
        public IActionResult Start([FromServices] IBatchAnalyticsClient batchAnalyticsClient, string customerShortName, string projectShortName, Guid id)
        {
            var job = _jobProxy.GetJob(customerShortName, projectShortName, id);

            _workStatusProxy.Add(job, AnalyticsRunStatus.Running, _config.PreTAPercentageContribution, true, true);

            var json     = JsonConvert.SerializeObject(job);
            var response = batchAnalyticsClient.Client.PostAsync("analyticsrun", new StringContent(json, Encoding.UTF8, "application/json")).Result;

            _validation.ValidateResponse(response);
            return(Ok());
        }
コード例 #3
0
ファイル: Metadata.cs プロジェクト: Dhanas-git/dotnet
        public IActionResult PublishGreenplum([FromServices] IReportingServicesClient reportingServicesClient, string customerShortName, string projectShortName, Guid id)
        {
            var job = _jobProxy.GetJob(customerShortName, projectShortName, id);

            _workStatusProxy.Add(job, AnalyticsRunStatus.Running, 0, true, true);

            var content = job.flowchartRunRequest
                          .SelectMany(x => (x.flowchartCatalogMetadata), (request, metadata) => new { flowchartRunId = request.flowchartRunUUID, catalogId = metadata.flowchartCatalogID })
                          .GroupBy(x => x.catalogId)
                          .ToDictionary(g => g.Key, g => g.Select(x => x.flowchartRunId).ToList());

            var i      = 0;
            var length = content.Keys.Count;

            content.Keys.ToList().ForEach(x =>
            {
                var input = new
                {
                    customerShortName      = customerShortName,
                    projectShortName       = projectShortName,
                    flowchartContentItemId = x,
                    vaccuum = (i == (length - 1)) ? true : false
                };

                var json      = JsonConvert.SerializeObject(input);
                var method    = "publishflowchartMetaDataGreenPlum_Rest";
                var stopWatch = Stopwatch.StartNew();

                var response = reportingServicesClient.Client.PostAsync(method, new StringContent(json, Encoding.UTF8, "application/json")).Result;

                _validation.ValidateResponse(response);
                _taskLogging.LogOperation(customerShortName, projectShortName, "PublishMetadataGreenplum", job, stopWatch.Elapsed);

                var result    = response.Content.ReadAsStringAsync().Result;
                var succeeded = ((JProperty)JObject.Parse(result).First).Value.Value <bool>();

                if (!succeeded)
                {
                    throw new OperationCanceledException($"Published failed for the following input: api: {method}, json: {json}");
                }

                i++;
            });

            return(Ok());
        }
コード例 #4
0
ファイル: SetupRun.cs プロジェクト: Dhanas-git/dotnet
        public ActionResult LogParams([FromServices] IReportingServicesClient reportingServicesClient, string customerShortName, string projectShortName, Guid id)
        {
            var listWorkStatus = new List <WorkStatus>();
            var projectConfig  = _iam.GetProjectConfig(customerShortName, projectShortName);

            var job = _jobProxy.GetJob(customerShortName, projectShortName, id);

            _workStatusProxy.Add(job, AnalyticsRunStatus.Running, Calculations.Percentage(0, 13, 14, _config.PreTAPercentageContribution), true, true);

            // Add status to parent work id with WorkStatus of 'Running'
            listWorkStatus.Add(new WorkStatus(job.analyticsRunUUID, true, _config.PreTAPercentageContribution, AnalyticsRunStatus.Running));
            var stopWatch = Stopwatch.StartNew();

            job.flowchartRunRequest.ToList().ForEach(flowchartRunRequest =>
            {
                flowchartRunRequest.flowchartCatalogMetadata.ToList().ForEach(
                    catalog =>
                {
                    var advancedOptions = new string[16, 2]
                    {
                        { "continuousEnrollmentVariable", flowchartRunRequest.continuousEnrollmentVariable },
                        { "engine_type", "Orchestration" },
                        { "runType", flowchartRunRequest.runType },
                        { "excludeHospice", flowchartRunRequest.excludeHospice.ToString() },
                        { "hedisPPO", flowchartRunRequest.hedisPPO.ToString() },
                        { "ignoreOneDay", flowchartRunRequest.ignoreOneDay.ToString() },
                        { "includeDetailResults", flowchartRunRequest.includeDetailResults.ToString() },
                        { "includeFlaggedEventResults", flowchartRunRequest.includeFlaggedEventResults.ToString() },
                        { "includeGlobalEvents", flowchartRunRequest.includeGlobalEvents.ToString() },
                        { "includeMemberMonthResults", flowchartRunRequest.includeMemberMonthResults.ToString() },
                        { "includeMessageResults", flowchartRunRequest.includeMessageResults.ToString() },
                        { "nonDenomDetail", flowchartRunRequest.nonDenomDetail.ToString() },
                        { "reportingYearBeginDate", flowchartRunRequest.reportingYearBeginDate.ToString(CultureInfo.InvariantCulture) },
                        { "reportingYearEndDate", flowchartRunRequest.reportingYearEndDate.ToString(CultureInfo.InvariantCulture) },
                        { "skipContinuousEnrollment", flowchartRunRequest.skipContinuousEnrollment.ToString() },
                        { "skipHasBenefit", flowchartRunRequest.skipHasBenefit.ToString() },
                    };

                    var input = new
                    {
                        customerShortName  = customerShortName,
                        projectShortName   = projectShortName,
                        resultSchemaName   = projectConfig.GreenplumConfig.ResultSchema,
                        flowchartRunGuid   = flowchartRunRequest.flowchartRunUUID,
                        runId              = catalog.flowchartRunID,
                        populationIds      = job.populationIds ?? new List <int>(),
                        advancedOptions    = advancedOptions,
                        eventCatalogs      = catalog.eventCatalogs.Select(x => new string[] { x.eventCatalogID.ToString(), x.name }).ToArray(),
                        promptVariables    = catalog.promptVariables.Select(x => new string[] { x.variableName, x.value }).ToArray(),
                        gpConnectionString = projectConfig.GreenplumConfig.RawConnectionString,
                        sampleOptionsXml   = string.Empty
                    };


                    var json   = JsonConvert.SerializeObject(input);
                    var method = "LogParametersToGreenplum_REST";

                    var response = reportingServicesClient.Client.PostAsync(method, new StringContent(json, Encoding.UTF8, "application/json")).Result;
                    _validation.ValidateResponse(response);

                    var result    = response.Content.ReadAsStringAsync().Result;
                    var succeeded = ((JProperty)JObject.Parse(result).First).Value.Value <bool>();

                    if (!succeeded)
                    {
                        throw new OperationCanceledException($"Logging failed for the following input: method: {method}, json: {json}");
                    }
                });

                // Add status to child flowchart work id with WorkStatus of 'Running'
                listWorkStatus.Add(new WorkStatus(flowchartRunRequest.flowchartRunUUID, _config.PreTAPercentageContribution, AnalyticsRunStatus.Running));
            });

            _workStatusProxy.Add(listWorkStatus);
            _taskLogging.LogOperation(customerShortName, projectShortName, "LogParams", job, stopWatch.Elapsed);

            return(Ok());
        }