use of com.cognizant.devops.platformreports.assessment.datamodel.InsightsAssessmentConfigurationDTO in project Insights by CognizantOneDevOps.
the class GrafanaPDFExecutionSubscriber method handleTaskExecution.
@Override
public void handleTaskExecution(byte[] body) throws IOException {
try {
long startTime = System.nanoTime();
String incomingTaskMessage = new String(body, StandardCharsets.UTF_8);
log.debug("Worlflow Detail ==== GrafanaPDFExecutionSubscriber started ... " + "routing key message handleDelivery ===== {} ", incomingTaskMessage);
JsonObject incomingTaskMessageJson = JsonUtils.parseStringAsJsonObject(incomingTaskMessage);
String workflowId = incomingTaskMessageJson.get("workflowId").getAsString();
long executionId = incomingTaskMessageJson.get("executionId").getAsLong();
workflowConfig = workflowDAL.getWorkflowConfigByWorkflowId(workflowId);
log.debug("Worlflow Detail ==== scheduleType {} ", workflowConfig.getScheduleType());
assessmentReportDTO = new InsightsAssessmentConfigurationDTO();
assessmentReportDTO.setIncomingTaskMessageJson(incomingTaskMessage);
assessmentReportDTO.setExecutionId(executionId);
assessmentReportDTO.setWorkflowId(workflowId);
BasePDFProcessor chartHandler = ReportPDFVisualizationHandlerFactory.getChartHandler("GrafanaPDF");
chartHandler.generatePDF(assessmentReportDTO);
long processingTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
log.debug("Type = Grafana PDF ");
log.debug("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", assessmentReportDTO.getExecutionId(), assessmentReportDTO.getWorkflowId(), assessmentReportDTO.getConfigId(), workflowConfig.getWorkflowType(), "-", "-", processingTime, " ReportName :" + assessmentReportDTO.getReportName() + " Visualizationutil :" + assessmentReportDTO.getVisualizationutil());
} catch (InsightsJobFailedException ie) {
log.error("Worlflow Detail ==== GrafanaPDFExecutionSubscriber Completed with error ", ie);
log.error("Type = Grafana PDF");
log.error("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", assessmentReportDTO.getExecutionId(), assessmentReportDTO.getWorkflowId(), assessmentReportDTO.getConfigId(), workflowConfig.getWorkflowType(), "-", "-", 0, " ReportName :" + assessmentReportDTO.getReportName() + " Visualizationutil :" + assessmentReportDTO.getVisualizationutil() + "GrafanaPDFExecutionSubscriber Completed with error" + ie.getMessage());
statusLog = ie.getMessage();
throw ie;
} catch (Exception e) {
log.error("Worlflow Detail ==== GrafanaPDFExecutionSubscriber Completed with error ", e);
log.error("Type = Grafana PDF");
log.error("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", assessmentReportDTO.getExecutionId(), assessmentReportDTO.getWorkflowId(), assessmentReportDTO.getConfigId(), workflowConfig.getWorkflowType(), "-", "-", 0, " ReportName :" + assessmentReportDTO.getReportName() + " Visualizationutil :" + assessmentReportDTO.getVisualizationutil() + "GrafanaPDFExecutionSubscriber Completed with error" + e.getMessage());
throw new InsightsJobFailedException(e.getMessage());
}
}
use of com.cognizant.devops.platformreports.assessment.datamodel.InsightsAssessmentConfigurationDTO in project Insights by CognizantOneDevOps.
the class HyperLedgerExecutionSubscriber method handleTaskExecution.
@Override
public void handleTaskExecution(byte[] body) throws IOException {
try {
String incomingTaskMessage = new String(body, MQMessageConstants.MESSAGE_ENCODING);
log.debug("Worlflow Detail ==== HyperLedgerExecutionSubscriber started ... " + "routing key message handleDelivery ===== {} ", incomingTaskMessage);
assessmentReportDTO = new InsightsAssessmentConfigurationDTO();
assessmentReportDTO.setIncomingTaskMessageJson(incomingTaskMessage);
JsonObject incomingTaskMessageJson = JsonUtils.parseStringAsJsonObject(incomingTaskMessage);
String workflowId = incomingTaskMessageJson.get("workflowId").getAsString();
workflowConfig = workflowDAL.getWorkflowConfigByWorkflowId(workflowId);
log.debug("Worlflow Detail ==== scheduleType {} ", workflowConfig.getScheduleType());
long startDate = 0;
long endDate = 0;
long startDateEpoch = 0;
if (workflowConfig.getScheduleType().equals(WorkflowTaskEnum.WorkflowSchedule.ONETIME.name())) {
startDate = workflowConfig.getAssessmentConfig().getStartDate();
endDate = workflowConfig.getAssessmentConfig().getEndDate();
} else {
startDateEpoch = workflowConfig.getNextRun();
startDate = InsightsUtils.getStartFromTime(startDateEpoch, workflowConfig.getScheduleType()) - 1;
endDate = startDateEpoch;
}
log.debug("Worlflow Detail ==== startDate & endDate in Epoch {} {}", startDate, endDate);
String ledgerStartDate = InsightsUtils.epochToDateFormat(startDate, "yyyy-MM-dd");
String ledgerEndDate = InsightsUtils.epochToDateFormat(endDate, "yyyy-MM-dd");
log.debug("Worlflow Detail ==== ledgerStartDate & ledgerEndDate {} {}", ledgerStartDate, ledgerEndDate);
prepareAssestmentDTO(incomingTaskMessageJson);
List<JsonObject> ledgerList = fetchLedgerRecords(ledgerStartDate, ledgerEndDate);
assessmentReportDTO.setLedgerRecords(ledgerList);
BasePDFProcessor chartHandler = ReportPDFVisualizationHandlerFactory.getChartHandler(assessmentReportDTO.getVisualizationutil());
chartHandler.generatePDF(assessmentReportDTO);
log.debug("Worlflow Detail ==== HyperLedgerExecutionSubscriber Completed {} ", incomingTaskMessageJson);
} catch (InsightsJobFailedException ijfe) {
log.error("Worlflow Detail ==== HyperLedgerExecutionSubscriber Completed with error ", ijfe);
statusLog = ijfe.getMessage();
throw ijfe;
} catch (Exception e) {
log.error("Worlflow Detail ==== HyperLedgerExecutionSubscriber Completed with error ", e);
throw new InsightsJobFailedException(e.getMessage());
}
}
use of com.cognizant.devops.platformreports.assessment.datamodel.InsightsAssessmentConfigurationDTO in project Insights by CognizantOneDevOps.
the class MileStoneExecutionSubscriber method handleTaskExecution.
@Override
public void handleTaskExecution(byte[] body) throws IOException {
try {
String incomingTaskMessage = new String(body, StandardCharsets.UTF_8);
log.debug("Worlflow Detail ==== MileStoneExecutionSubscriber started ... " + "routing key message handleDelivery ===== {} ", incomingTaskMessage);
JsonObject incomingTaskMessageJson = JsonUtils.parseStringAsJsonObject(incomingTaskMessage);
String workflowId = incomingTaskMessageJson.get("workflowId").getAsString();
long executionId = incomingTaskMessageJson.get("executionId").getAsLong();
workflowConfig = workflowDAL.getWorkflowConfigByWorkflowId(workflowId);
log.debug("Worlflow Detail ==== scheduleType {} ", workflowConfig.getScheduleType());
assessmentReportDTO = new InsightsAssessmentConfigurationDTO();
assessmentReportDTO.setIncomingTaskMessageJson(incomingTaskMessage);
assessmentReportDTO.setExecutionId(executionId);
assessmentReportDTO.setWorkflowId(workflowId);
MileStoneConfig mileStoneConfig = mileStoneConfigDAL.fetchMileStoneByWorkflowId(assessmentReportDTO.getWorkflowId());
Long startDate = mileStoneConfig.getStartDate();
if (startDate < Instant.now().getEpochSecond()) {
mileStoneConfig.setStatus("IN_PROGRESS");
mileStoneConfigDAL.updateMileStoneConfig(mileStoneConfig);
List<JsonObject> listOfMilestoneJson = createToolBasedJson(mileStoneConfig);
for (JsonObject milestone : listOfMilestoneJson) {
publishMessageInMQ(milestone.get("queueName").getAsString(), milestone.toString());
}
}
} catch (Exception e) {
log.error("Worlflow Detail ==== MileStoneExecutionSubscriber Completed with error ", e);
throw new InsightsJobFailedException(e.getMessage());
}
}
use of com.cognizant.devops.platformreports.assessment.datamodel.InsightsAssessmentConfigurationDTO in project Insights by CognizantOneDevOps.
the class PDFExecutionSubscriber method handleTaskExecution.
@Override
public void handleTaskExecution(byte[] body) throws IOException {
try {
long startTime = System.nanoTime();
String incomingTaskMessage = new String(body, MQMessageConstants.MESSAGE_ENCODING);
log.debug("Worlflow Detail ==== PDFExecutionSubscriber started ... routing key message handleDelivery ===== {} ", incomingTaskMessage);
assessmentReportDTO = new InsightsAssessmentConfigurationDTO();
JsonObject incomingTaskMessageJson = JsonUtils.parseStringAsJsonObject(incomingTaskMessage);
prepareVisualizationJsonBasedOnKPIResult(incomingTaskMessageJson);
processVisualizationJson();
setPDFDetailsInEmailHistory(incomingTaskMessageJson);
log.debug("Worlflow Detail ==== PDFExecutionSubscriber Completed {} ", incomingTaskMessage);
InsightsStatusProvider.getInstance().createInsightStatusNode("PDFExecutionSubscriber completed", PlatformServiceConstants.SUCCESS);
long processingTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
log.debug("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", assessmentReportDTO.getExecutionId(), assessmentReportDTO.getWorkflowId(), assessmentReportDTO.getConfigId(), "-", "-", "-", processingTime, "reportId: " + assessmentReportDTO.getReportId() + "reportName: " + assessmentReportDTO.getReportName() + "VisualizationUtil" + assessmentReportDTO.getVisualizationutil() + "PDFExecutionSubscriber Completed ");
} catch (InsightsJobFailedException ijfe) {
log.error("Worlflow Detail ==== PDFExecutionSubscriber Completed with error ", ijfe);
InsightsStatusProvider.getInstance().createInsightStatusNode("PDFExecutionSubscriber Completed with error " + ijfe.getMessage(), PlatformServiceConstants.FAILURE);
statusLog = ijfe.getMessage();
log.error("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", assessmentReportDTO.getExecutionId(), assessmentReportDTO.getWorkflowId(), assessmentReportDTO.getConfigId(), "-", "-", "-", 0, "reportId: " + assessmentReportDTO.getReportId() + "reportName: " + assessmentReportDTO.getReportName() + "VisualizationUtil" + assessmentReportDTO.getVisualizationutil() + "PDFExecutionSubscriber Completed with error " + ijfe.getMessage());
throw ijfe;
} catch (Exception e) {
log.error("Worlflow Detail ==== PDFExecutionSubscriber Completed with error ", e);
InsightsStatusProvider.getInstance().createInsightStatusNode("PDFExecutionSubscriber Completed with error " + e.getMessage(), PlatformServiceConstants.FAILURE);
log.error("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", assessmentReportDTO.getExecutionId(), assessmentReportDTO.getWorkflowId(), assessmentReportDTO.getConfigId(), "-", "-", "-", 0, "reportId: " + assessmentReportDTO.getReportId() + "reportName: " + assessmentReportDTO.getReportName() + "VisualizationUtil" + assessmentReportDTO.getVisualizationutil() + "PDFExecutionSubscriber Completed with error " + e.getMessage());
throw new InsightsJobFailedException(e.getMessage());
}
}
use of com.cognizant.devops.platformreports.assessment.datamodel.InsightsAssessmentConfigurationDTO in project Insights by CognizantOneDevOps.
the class UpshiftAssessmentExecutionSubscriber method handleTaskExecution.
@Override
public void handleTaskExecution(byte[] body) throws IOException {
try {
long startTime = System.nanoTime();
String incomingTaskMessage = new String(body, StandardCharsets.UTF_8);
log.debug("Worlflow Detail ==== UpshiftAssessmentExecutionSubscriber started ... " + "routing key message handleDelivery ===== {} ", incomingTaskMessage);
JsonObject incomingTaskMessageJson = JsonUtils.parseStringAsJsonObject(incomingTaskMessage);
String workflowId = incomingTaskMessageJson.get("workflowId").getAsString();
long executionId = incomingTaskMessageJson.get("executionId").getAsLong();
workflowConfig = workflowDAL.getWorkflowConfigByWorkflowId(workflowId);
log.debug("Worlflow Detail ==== scheduleType {} ", workflowConfig.getScheduleType());
assessmentReportDTO = new InsightsAssessmentConfigurationDTO();
assessmentReportDTO.setIncomingTaskMessageJson(incomingTaskMessage);
assessmentReportDTO.setAsseementreportname(WorkflowTaskEnum.WorkflowType.UPSHIFTASSESSMENT.getValue());
assessmentReportDTO.setExecutionId(executionId);
assessmentReportDTO.setWorkflowId(workflowId);
BaseDataProcessor chartHandler = ReportDataProcessHandlerFactory.getDataHandler("UPSHIFTASSESSMENT");
chartHandler.processJson(assessmentReportDTO);
long processingTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
log.debug("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", executionId, workflowId, assessmentReportDTO.getReportId(), workflowConfig.getWorkflowType(), "-", "-", processingTime, "Schedule :" + workflowConfig.getScheduleType() + "ReportName :" + assessmentReportDTO.getReportName() + "UpshiftAssessmentExecutionSubscriber Block");
} catch (Exception e) {
log.error("Worlflow Detail ==== GrafanaPDFExecutionSubscriber Completed with error ", e);
log.error("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", assessmentReportDTO.getExecutionId(), assessmentReportDTO.getWorkflowId(), assessmentReportDTO.getReportId(), workflowConfig.getWorkflowType(), "-", "-", 0, "Schedule :" + workflowConfig.getScheduleType() + "ReportName :" + assessmentReportDTO.getReportName() + "GrafanaPDFExecutionSubscriber Completed with error" + e.getMessage());
throw new InsightsJobFailedException(e.getMessage());
}
}
Aggregations