pratapaditya04 commented on code in PR #4178:
URL: https://github.com/apache/gobblin/pull/4178#discussion_r3009375515
##########
gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/azkaban/AzkabanGobblinYarnAppLauncher.java:
##########
@@ -138,4 +230,51 @@ public void run() {
public void cancel() throws Exception {
this.gobblinYarnAppLauncher.stop();
}
+
+ /**
+ * Emits a JOB_FAILED timing event and an {@link IssueEventBuilder} so GaaS
transitions the job
+ * to FAILED and populates {@code issues[]} with the bootstrap failure root
cause.
+ */
+ private void submitJobFailedEvent(Exception e) {
+
this.eventSubmitter.getTimingEvent(TimingEvent.LauncherTimings.JOB_FAILED).stop(getFlowMetadata());
+
+ // Emit an IssueEventBuilder so the error details appear in the issues[]
array in GaaS
+ String summary = "YARN AM bootstrap failed: " +
ExceptionUtils.getRootCauseMessage(e);
+ Issue issue = Issue.builder()
+ .time(ZonedDateTime.now(ZoneOffset.UTC))
+ .severity(IssueSeverity.ERROR)
+ .code("T" + DigestUtils.sha256Hex(summary).substring(0,
6).toUpperCase())
+ .summary(summary)
+ .details(ExceptionUtils.getStackTrace(e))
+ .sourceClass(AzkabanGobblinYarnAppLauncher.class.getName())
+ .properties(Collections.emptyMap())
+ .build();
+ IssueEventBuilder issueEventBuilder = new
IssueEventBuilder(IssueEventBuilder.JOB_ISSUE);
+ issueEventBuilder.setIssue(issue);
+
issueEventBuilder.addMetadata(TimingEvent.FlowEventConstants.FLOW_GROUP_FIELD,
+ this.gobblinProps.getProperty(ConfigurationKeys.FLOW_GROUP_KEY, ""));
+
issueEventBuilder.addMetadata(TimingEvent.FlowEventConstants.FLOW_NAME_FIELD,
+ this.gobblinProps.getProperty(ConfigurationKeys.FLOW_NAME_KEY, ""));
+
issueEventBuilder.addMetadata(TimingEvent.FlowEventConstants.FLOW_EXECUTION_ID_FIELD,
+ this.gobblinProps.getProperty(ConfigurationKeys.FLOW_EXECUTION_ID_KEY,
""));
+
issueEventBuilder.addMetadata(TimingEvent.FlowEventConstants.JOB_NAME_FIELD,
+ this.gobblinProps.getProperty(ConfigurationKeys.JOB_NAME_KEY, ""));
+ this.eventSubmitter.submit(issueEventBuilder);
+ }
+
+ /** Returns flow/job metadata tags from job properties for timing event
metadata. */
+ private Map<String, String> getFlowMetadata() {
+ Map<String, String> metadata = Maps.newHashMap();
Review Comment:
Can we ruse TimingEventUtils.getFlowMetadata, instead of duplicating?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]