private void PopulateXrefAll(IDataClient dataClient, string customer, string project) { var projectConfig = _iam.GetProjectConfig(customer, project); var parameters = new List <NpgsqlParameter> { new NpgsqlParameter("v_result_schema", NpgsqlDbType.Varchar) { Value = projectConfig.GreenplumConfig.ResultSchema }, }; var request = new GreenplumStoredProcedureRequest(projectConfig.GreenplumConfig.RawConnectionString, "usp_populate_xref_all", parameters); dataClient.ExecuteScalar <object>(request); _logging.Log("usp_populate_xref_all proc executed"); }
public IActionResult TestLongRunning([FromServices] IDataClient dataClient, [FromServices] IIAM iam, string customerShortName, string projectShortName, int timeout) { var parameters = new List <NpgsqlParameter> { new NpgsqlParameter("v_timeout", NpgsqlDbType.Integer) { Value = timeout }, }; var projectConfig = iam.GetProjectConfig(customerShortName, projectShortName); var request = new GreenplumStoredProcedureRequest(projectConfig.GreenplumConfig.RawConnectionString, "usp_timeout_test", parameters); var stopWatch = Stopwatch.StartNew(); dataClient.ExecuteScalar <object>(request); _logging.Log($"Long-running-test ran for: { stopWatch.Elapsed }"); return(Ok()); }
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()); }