arjun4084346 commented on a change in pull request #2702: [GOBBLIN-847] Flow
level sla
URL: https://github.com/apache/incubator-gobblin/pull/2702#discussion_r312679070
##########
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()) {
+ JobExecutionPlan jobExecutionPlan =
DagManagerUtils.getJobExecutionPlan(node);
+ Map<String, String> jobMetadata =
TimingEventUtils.getJobMetadata(Maps.newHashMap(), jobExecutionPlan);
+
this.eventSubmitter.get().getTimingEvent(TimingEvent.LauncherTimings.JOB_CANCEL).stop(jobMetadata);
Review comment:
Fixed it, cancelling only one node not the whole dag
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services