@@ -201,9 +201,7 @@ class YarnService extends AbstractIdleService {
201201 private final ConcurrentMap <Long , WorkerProfile > workerProfileByAllocationRequestId = new ConcurrentHashMap <>();
202202
203203 @ Getter
204- protected JobState jobState ;
205- @ Getter
206- protected String jobIssuesSummary ;
204+ protected JobSummaryEvent jobSummaryEvent ;
207205
208206 public YarnService (Config config , String applicationName , String applicationId , YarnConfiguration yarnConfiguration ,
209207 FileSystem fs , EventBus eventBus ) throws Exception {
@@ -314,8 +312,7 @@ public void handleContainerReleaseRequest(ContainerReleaseRequest containerRelea
314312 @ SuppressWarnings ("unused" )
315313 @ Subscribe
316314 public void handleJobFailure (JobSummaryEvent jobSummaryEvent ) {
317- this .jobState = jobSummaryEvent .getJobState ();
318- this .jobIssuesSummary = jobSummaryEvent .getIssuesSummary ();
315+ this .jobSummaryEvent = jobSummaryEvent ;
319316 }
320317
321318 @ Override
@@ -367,10 +364,10 @@ protected void shutDown() throws IOException {
367364 }
368365 }
369366
370- if (this .jobState != null && !this .jobState .getState ().isSuccess ()) {
371- this .amrmClientAsync .unregisterApplicationMaster (FinalApplicationStatus .FAILED , this .getJobIssuesSummary (), null );
367+ if (this .jobSummaryEvent . getJobState () != null && !this .jobSummaryEvent . getJobState () .getState ().isSuccess ()) {
368+ this .amrmClientAsync .unregisterApplicationMaster (FinalApplicationStatus .FAILED , this .jobSummaryEvent . getIssuesSummary (), null );
372369 } else {
373- this .amrmClientAsync .unregisterApplicationMaster (FinalApplicationStatus .SUCCEEDED , StringUtils .defaultString (this .getJobIssuesSummary ()), null );
370+ this .amrmClientAsync .unregisterApplicationMaster (FinalApplicationStatus .SUCCEEDED , StringUtils .defaultString (this .jobSummaryEvent . getIssuesSummary ()), null );
374371 }
375372 } catch (IOException | YarnException e ) {
376373 LOGGER .error ("Failed to unregister the ApplicationMaster" , e );
0 commit comments