Java Code Examples for org.apache.hadoop.mapreduce.v2.api.records.JobReport#setJobState()
The following examples show how to use
org.apache.hadoop.mapreduce.v2.api.records.JobReport#setJobState() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NotRunningJob.java From tez with Apache License 2.0 | 6 votes |
@Override public GetJobReportResponse getJobReport(GetJobReportRequest request) throws IOException { JobReport jobReport = recordFactory.newRecordInstance(JobReport.class); jobReport.setJobId(request.getJobId()); jobReport.setJobState(jobState); jobReport.setUser(applicationReport.getUser()); jobReport.setStartTime(applicationReport.getStartTime()); jobReport.setDiagnostics(applicationReport.getDiagnostics()); jobReport.setJobName(applicationReport.getName()); jobReport.setTrackingUrl(applicationReport.getTrackingUrl()); jobReport.setFinishTime(applicationReport.getFinishTime()); GetJobReportResponse resp = recordFactory.newRecordInstance(GetJobReportResponse.class); resp.setJobReport(jobReport); return resp; }
Example 2
Source File: NotRunningJob.java From hadoop with Apache License 2.0 | 6 votes |
@Override public GetJobReportResponse getJobReport(GetJobReportRequest request) throws IOException { JobReport jobReport = recordFactory.newRecordInstance(JobReport.class); jobReport.setJobId(request.getJobId()); jobReport.setJobState(jobState); jobReport.setUser(applicationReport.getUser()); jobReport.setStartTime(applicationReport.getStartTime()); jobReport.setDiagnostics(applicationReport.getDiagnostics()); jobReport.setJobName(applicationReport.getName()); jobReport.setTrackingUrl(applicationReport.getTrackingUrl()); jobReport.setFinishTime(applicationReport.getFinishTime()); GetJobReportResponse resp = recordFactory.newRecordInstance(GetJobReportResponse.class); resp.setJobReport(jobReport); return resp; }
Example 3
Source File: NotRunningJob.java From incubator-tez with Apache License 2.0 | 6 votes |
@Override public GetJobReportResponse getJobReport(GetJobReportRequest request) throws IOException { JobReport jobReport = recordFactory.newRecordInstance(JobReport.class); jobReport.setJobId(request.getJobId()); jobReport.setJobState(jobState); jobReport.setUser(applicationReport.getUser()); jobReport.setStartTime(applicationReport.getStartTime()); jobReport.setDiagnostics(applicationReport.getDiagnostics()); jobReport.setJobName(applicationReport.getName()); jobReport.setTrackingUrl(applicationReport.getTrackingUrl()); jobReport.setFinishTime(applicationReport.getFinishTime()); GetJobReportResponse resp = recordFactory.newRecordInstance(GetJobReportResponse.class); resp.setJobReport(jobReport); return resp; }
Example 4
Source File: TestTypeConverter.java From big-c with Apache License 2.0 | 6 votes |
@Test public void testFromYarnJobReport() throws Exception { int jobStartTime = 612354; int jobFinishTime = 612355; JobState state = JobState.RUNNING; JobId jobId = Records.newRecord(JobId.class); JobReport jobReport = Records.newRecord(JobReport.class); ApplicationId applicationId = ApplicationId.newInstance(0, 0); jobId.setAppId(applicationId); jobId.setId(0); jobReport.setJobId(jobId); jobReport.setJobState(state); jobReport.setStartTime(jobStartTime); jobReport.setFinishTime(jobFinishTime); jobReport.setUser("TestTypeConverter-user"); JobStatus jobStatus = TypeConverter.fromYarn(jobReport, "dummy-jobfile"); Assert.assertEquals(jobStartTime, jobStatus.getStartTime()); Assert.assertEquals(jobFinishTime, jobStatus.getFinishTime()); Assert.assertEquals(state.toString(), jobStatus.getState().toString()); }
Example 5
Source File: TestClientRedirect.java From hadoop with Apache License 2.0 | 6 votes |
@Override public GetJobReportResponse getJobReport(GetJobReportRequest request) throws IOException { amContact = true; JobReport jobReport = recordFactory.newRecordInstance(JobReport.class); jobReport.setJobId(request.getJobId()); jobReport.setJobState(JobState.RUNNING); jobReport.setJobName("TestClientRedirect-jobname"); jobReport.setUser("TestClientRedirect-user"); jobReport.setStartTime(0L); jobReport.setFinishTime(1L); GetJobReportResponse response = recordFactory .newRecordInstance(GetJobReportResponse.class); response.setJobReport(jobReport); return response; }
Example 6
Source File: MRBuilderUtils.java From hadoop with Apache License 2.0 | 6 votes |
public static JobReport newJobReport(JobId jobId, String jobName, String userName, JobState state, long submitTime, long startTime, long finishTime, float setupProgress, float mapProgress, float reduceProgress, float cleanupProgress, String jobFile, List<AMInfo> amInfos, boolean isUber, String diagnostics) { JobReport report = Records.newRecord(JobReport.class); report.setJobId(jobId); report.setJobName(jobName); report.setUser(userName); report.setJobState(state); report.setSubmitTime(submitTime); report.setStartTime(startTime); report.setFinishTime(finishTime); report.setSetupProgress(setupProgress); report.setCleanupProgress(cleanupProgress); report.setMapProgress(mapProgress); report.setReduceProgress(reduceProgress); report.setJobFile(jobFile); report.setAMInfos(amInfos); report.setIsUber(isUber); report.setDiagnostics(diagnostics); return report; }
Example 7
Source File: TestTypeConverter.java From hadoop with Apache License 2.0 | 6 votes |
@Test public void testFromYarnJobReport() throws Exception { int jobStartTime = 612354; int jobFinishTime = 612355; JobState state = JobState.RUNNING; JobId jobId = Records.newRecord(JobId.class); JobReport jobReport = Records.newRecord(JobReport.class); ApplicationId applicationId = ApplicationId.newInstance(0, 0); jobId.setAppId(applicationId); jobId.setId(0); jobReport.setJobId(jobId); jobReport.setJobState(state); jobReport.setStartTime(jobStartTime); jobReport.setFinishTime(jobFinishTime); jobReport.setUser("TestTypeConverter-user"); JobStatus jobStatus = TypeConverter.fromYarn(jobReport, "dummy-jobfile"); Assert.assertEquals(jobStartTime, jobStatus.getStartTime()); Assert.assertEquals(jobFinishTime, jobStatus.getFinishTime()); Assert.assertEquals(state.toString(), jobStatus.getState().toString()); }
Example 8
Source File: MRBuilderUtils.java From big-c with Apache License 2.0 | 6 votes |
public static JobReport newJobReport(JobId jobId, String jobName, String userName, JobState state, long submitTime, long startTime, long finishTime, float setupProgress, float mapProgress, float reduceProgress, float cleanupProgress, String jobFile, List<AMInfo> amInfos, boolean isUber, String diagnostics) { JobReport report = Records.newRecord(JobReport.class); report.setJobId(jobId); report.setJobName(jobName); report.setUser(userName); report.setJobState(state); report.setSubmitTime(submitTime); report.setStartTime(startTime); report.setFinishTime(finishTime); report.setSetupProgress(setupProgress); report.setCleanupProgress(cleanupProgress); report.setMapProgress(mapProgress); report.setReduceProgress(reduceProgress); report.setJobFile(jobFile); report.setAMInfos(amInfos); report.setIsUber(isUber); report.setDiagnostics(diagnostics); return report; }
Example 9
Source File: TestClientRedirect.java From big-c with Apache License 2.0 | 6 votes |
@Override public GetJobReportResponse getJobReport(GetJobReportRequest request) throws IOException { amContact = true; JobReport jobReport = recordFactory.newRecordInstance(JobReport.class); jobReport.setJobId(request.getJobId()); jobReport.setJobState(JobState.RUNNING); jobReport.setJobName("TestClientRedirect-jobname"); jobReport.setUser("TestClientRedirect-user"); jobReport.setStartTime(0L); jobReport.setFinishTime(1L); GetJobReportResponse response = recordFactory .newRecordInstance(GetJobReportResponse.class); response.setJobReport(jobReport); return response; }
Example 10
Source File: NotRunningJob.java From big-c with Apache License 2.0 | 6 votes |
@Override public GetJobReportResponse getJobReport(GetJobReportRequest request) throws IOException { JobReport jobReport = recordFactory.newRecordInstance(JobReport.class); jobReport.setJobId(request.getJobId()); jobReport.setJobState(jobState); jobReport.setUser(applicationReport.getUser()); jobReport.setStartTime(applicationReport.getStartTime()); jobReport.setDiagnostics(applicationReport.getDiagnostics()); jobReport.setJobName(applicationReport.getName()); jobReport.setTrackingUrl(applicationReport.getTrackingUrl()); jobReport.setFinishTime(applicationReport.getFinishTime()); GetJobReportResponse resp = recordFactory.newRecordInstance(GetJobReportResponse.class); resp.setJobReport(jobReport); return resp; }
Example 11
Source File: MockJobs.java From big-c with Apache License 2.0 | 5 votes |
public static JobReport newJobReport(JobId id) { JobReport report = Records.newRecord(JobReport.class); report.setJobId(id); report.setSubmitTime(System.currentTimeMillis()-DT); report .setStartTime(System.currentTimeMillis() - (int) (Math.random() * DT)); report.setFinishTime(System.currentTimeMillis() + (int) (Math.random() * DT) + 1); report.setMapProgress((float) Math.random()); report.setReduceProgress((float) Math.random()); report.setJobState(JOB_STATES.next()); return report; }
Example 12
Source File: TestClientServiceDelegate.java From big-c with Apache License 2.0 | 5 votes |
private GetJobReportResponse getJobReportResponseFromHistoryServer() { GetJobReportResponse jobReportResponse = Records .newRecord(GetJobReportResponse.class); JobReport jobReport = Records.newRecord(JobReport.class); jobReport.setJobId(jobId); jobReport.setJobState(JobState.SUCCEEDED); jobReport.setMapProgress(1.0f); jobReport.setReduceProgress(1.0f); jobReport.setJobFile("TestJobFilePath"); jobReport.setTrackingUrl("http://TestTrackingUrl"); jobReportResponse.setJobReport(jobReport); return jobReportResponse; }
Example 13
Source File: TestClientServiceDelegate.java From big-c with Apache License 2.0 | 5 votes |
private GetJobReportResponse getJobReportResponse() { GetJobReportResponse jobReportResponse = Records .newRecord(GetJobReportResponse.class); JobReport jobReport = Records.newRecord(JobReport.class); jobReport.setJobId(jobId); jobReport.setJobState(JobState.SUCCEEDED); jobReportResponse.setJobReport(jobReport); return jobReportResponse; }
Example 14
Source File: TestClientServiceDelegate.java From hadoop with Apache License 2.0 | 5 votes |
private GetJobReportResponse getJobReportResponseFromHistoryServer() { GetJobReportResponse jobReportResponse = Records .newRecord(GetJobReportResponse.class); JobReport jobReport = Records.newRecord(JobReport.class); jobReport.setJobId(jobId); jobReport.setJobState(JobState.SUCCEEDED); jobReport.setMapProgress(1.0f); jobReport.setReduceProgress(1.0f); jobReport.setJobFile("TestJobFilePath"); jobReport.setTrackingUrl("http://TestTrackingUrl"); jobReportResponse.setJobReport(jobReport); return jobReportResponse; }
Example 15
Source File: TestClientServiceDelegate.java From hadoop with Apache License 2.0 | 5 votes |
private GetJobReportResponse getJobReportResponse() { GetJobReportResponse jobReportResponse = Records .newRecord(GetJobReportResponse.class); JobReport jobReport = Records.newRecord(JobReport.class); jobReport.setJobId(jobId); jobReport.setJobState(JobState.SUCCEEDED); jobReportResponse.setJobReport(jobReport); return jobReportResponse; }
Example 16
Source File: MockJobs.java From hadoop with Apache License 2.0 | 5 votes |
public static JobReport newJobReport(JobId id) { JobReport report = Records.newRecord(JobReport.class); report.setJobId(id); report.setSubmitTime(System.currentTimeMillis()-DT); report .setStartTime(System.currentTimeMillis() - (int) (Math.random() * DT)); report.setFinishTime(System.currentTimeMillis() + (int) (Math.random() * DT) + 1); report.setMapProgress((float) Math.random()); report.setReduceProgress((float) Math.random()); report.setJobState(JOB_STATES.next()); return report; }
Example 17
Source File: MRAppMaster.java From hadoop with Apache License 2.0 | 4 votes |
@VisibleForTesting public void shutDownJob() { // job has finished // this is the only job, so shut down the Appmaster // note in a workflow scenario, this may lead to creation of a new // job (FIXME?) try { //if isLastAMRetry comes as true, should never set it to false if ( !isLastAMRetry){ if (((JobImpl)job).getInternalState() != JobStateInternal.REBOOT) { LOG.info("We are finishing cleanly so this is the last retry"); isLastAMRetry = true; } } notifyIsLastAMRetry(isLastAMRetry); // Stop all services // This will also send the final report to the ResourceManager LOG.info("Calling stop for all the services"); MRAppMaster.this.stop(); if (isLastAMRetry) { // Send job-end notification when it is safe to report termination to // users and it is the last AM retry if (getConfig().get(MRJobConfig.MR_JOB_END_NOTIFICATION_URL) != null) { try { LOG.info("Job end notification started for jobID : " + job.getReport().getJobId()); JobEndNotifier notifier = new JobEndNotifier(); notifier.setConf(getConfig()); JobReport report = job.getReport(); // If unregistration fails, the final state is unavailable. However, // at the last AM Retry, the client will finally be notified FAILED // from RM, so we should let users know FAILED via notifier as well if (!context.hasSuccessfullyUnregistered()) { report.setJobState(JobState.FAILED); } notifier.notify(report); } catch (InterruptedException ie) { LOG.warn("Job end notification interrupted for jobID : " + job.getReport().getJobId(), ie); } } } try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } clientService.stop(); } catch (Throwable t) { LOG.warn("Graceful stop failed. Exiting.. ", t); ExitUtil.terminate(1, t); } }
Example 18
Source File: MRAppMaster.java From big-c with Apache License 2.0 | 4 votes |
@VisibleForTesting public void shutDownJob() { // job has finished // this is the only job, so shut down the Appmaster // note in a workflow scenario, this may lead to creation of a new // job (FIXME?) try { //if isLastAMRetry comes as true, should never set it to false if ( !isLastAMRetry){ if (((JobImpl)job).getInternalState() != JobStateInternal.REBOOT) { LOG.info("We are finishing cleanly so this is the last retry"); isLastAMRetry = true; } } notifyIsLastAMRetry(isLastAMRetry); // Stop all services // This will also send the final report to the ResourceManager LOG.info("Calling stop for all the services"); MRAppMaster.this.stop(); if (isLastAMRetry) { // Send job-end notification when it is safe to report termination to // users and it is the last AM retry if (getConfig().get(MRJobConfig.MR_JOB_END_NOTIFICATION_URL) != null) { try { LOG.info("Job end notification started for jobID : " + job.getReport().getJobId()); JobEndNotifier notifier = new JobEndNotifier(); notifier.setConf(getConfig()); JobReport report = job.getReport(); // If unregistration fails, the final state is unavailable. However, // at the last AM Retry, the client will finally be notified FAILED // from RM, so we should let users know FAILED via notifier as well if (!context.hasSuccessfullyUnregistered()) { report.setJobState(JobState.FAILED); } notifier.notify(report); } catch (InterruptedException ie) { LOG.warn("Job end notification interrupted for jobID : " + job.getReport().getJobId(), ie); } } } try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } clientService.stop(); } catch (Throwable t) { LOG.warn("Graceful stop failed. Exiting.. ", t); ExitUtil.terminate(1, t); } }