arjun4084346 commented on a change in pull request #2702: [GOBBLIN-847] Flow level sla URL: https://github.com/apache/incubator-gobblin/pull/2702#discussion_r312678964
########## File path: gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java ########## @@ -530,6 +529,44 @@ private void pollAndAdvanceDag() } } + private ExecutionStatus getJobExcecutionStatus(boolean slaKilled, JobStatus jobStatus) { + if (slaKilled) { + return CANCELLED; + } else { + if (jobStatus == null) { + return PENDING; + } else { + return valueOf(jobStatus.getEventName()); + } + } + } + + /** + * Check if the SLA is configured for this job. If it is, tries to cancel the job if SLA is reached. + * @param node dag node of the job + * @return true if the job is killed because it reached sla + * @throws ExecutionException exception + * @throws InterruptedException exception + */ + private boolean slaKillIfNeeded(DagNode<JobExecutionPlan> node) throws ExecutionException, InterruptedException { + long flowStartTime = DagManagerUtils.getFlowStartTime(node); + long currentTime = System.currentTimeMillis(); + long flowSla = DagManagerUtils.getFlowSla(node); + + if (flowSla != -1L && currentTime > flowStartTime + flowSla) { + log.info("Job exceeded the SLA of {} ms. Killing it now...", flowSla); + cancelDag(DagManagerUtils.generateDagId(node)); + if (this.eventSubmitter.isPresent()) { Review comment: There is not really any requirement for other cancellations to send this event. The cancelling job should be doing that. But okay, moved it. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services