本文整理汇总了Java中org.apache.hadoop.mapred.JobStatusChangeEvent.EventType.START_TIME_CHANGED属性的典型用法代码示例。如果您正苦于以下问题:Java EventType.START_TIME_CHANGED属性的具体用法?Java EventType.START_TIME_CHANGED怎么用?Java EventType.START_TIME_CHANGED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.hadoop.mapred.JobStatusChangeEvent.EventType
的用法示例。
在下文中一共展示了EventType.START_TIME_CHANGED属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jobUpdated
@Override
public synchronized void jobUpdated(JobChangeEvent event) {
JobInProgress job = event.getJobInProgress();
if (event instanceof JobStatusChangeEvent) {
// Check if the ordering of the job has changed
// For now priority and start-time can change the job ordering
JobStatusChangeEvent statusEvent = (JobStatusChangeEvent)event;
JobSchedulingInfo oldInfo =
new JobSchedulingInfo(statusEvent.getOldStatus());
if (statusEvent.getEventType() == EventType.PRIORITY_CHANGED
|| statusEvent.getEventType() == EventType.START_TIME_CHANGED) {
// Make a priority change
reorderJobs(job, oldInfo);
} else if (statusEvent.getEventType() == EventType.RUN_STATE_CHANGED) {
// Check if the job is complete
int runState = statusEvent.getNewStatus().getRunState();
if (runState == JobStatus.SUCCEEDED
|| runState == JobStatus.FAILED
|| runState == JobStatus.KILLED) {
jobCompleted(oldInfo);
}
}
}
}
示例2: setStartTime
public void setStartTime(FakeJobInProgress fjob, long start) {
// take a snapshot of the status before changing it
JobStatus oldStatus = (JobStatus)fjob.getStatus().clone();
fjob.startTime = start; // change the start time of the job
fjob.status.setStartTime(start); // change the start time of the jobstatus
JobStatus newStatus = (JobStatus)fjob.getStatus().clone();
JobStatusChangeEvent event =
new JobStatusChangeEvent (fjob, EventType.START_TIME_CHANGED, oldStatus,
newStatus);
for (JobInProgressListener listener : mylisteners) {
listener.jobUpdated(event);
}
}
示例3: jobStateChanged
private void jobStateChanged(JobStatusChangeEvent event, QueueInfo qi) {
JobInProgress job = event.getJobInProgress();
JobSchedulingInfo oldJobStateInfo =
new JobSchedulingInfo(event.getOldStatus());
// Check if the ordering of the job has changed
// For now priority and start-time can change the job ordering
if (event.getEventType() == EventType.PRIORITY_CHANGED
|| event.getEventType() == EventType.START_TIME_CHANGED) {
// Make a priority change
reorderJobs(job, oldJobStateInfo, qi);
} else if (event.getEventType() == EventType.RUN_STATE_CHANGED) {
// Check if the job is complete
int runState = job.getStatus().getRunState();
if (runState == JobStatus.SUCCEEDED
|| runState == JobStatus.FAILED
|| runState == JobStatus.KILLED) {
jobCompleted(job, oldJobStateInfo, qi);
} else if (runState == JobStatus.RUNNING) {
makeJobRunning(job, oldJobStateInfo, qi);
}
}
}
示例4: setStartTime
public void setStartTime(FakeJobInProgress fjob, long start) {
// take a snapshot of the status before changing it
JobStatus oldStatus = (JobStatus)fjob.getStatus().clone();
fjob.startTime = start; // change the start time of the job
fjob.status.setStartTime(start); // change the start time of the jobstatus
JobStatus newStatus = (JobStatus)fjob.getStatus().clone();
JobStatusChangeEvent event =
new JobStatusChangeEvent (fjob, EventType.START_TIME_CHANGED, oldStatus,
newStatus);
for (JobInProgressListener listener : listeners) {
listener.jobUpdated(event);
}
}
示例5: updateJob
private JobStatusChangeEvent updateJob(JobInProgress jip,
JobHistory.JobInfo job) {
// Change the job priority
String jobpriority = job.get(Keys.JOB_PRIORITY);
JobPriority priority = JobPriority.valueOf(jobpriority);
// It's important to update this via the jobtracker's api as it will
// take care of updating the event listeners too
setJobPriority(jip.getJobID(), priority);
// Save the previous job status
JobStatus oldStatus = (JobStatus)jip.getStatus().clone();
// Set the start/launch time only if there are recovered tasks
// Increment the job's restart count
jip.updateJobInfo(job.getLong(JobHistory.Keys.SUBMIT_TIME),
job.getLong(JobHistory.Keys.LAUNCH_TIME));
// Save the new job status
JobStatus newStatus = (JobStatus)jip.getStatus().clone();
return new JobStatusChangeEvent(jip, EventType.START_TIME_CHANGED, oldStatus,
newStatus);
}
示例6: jobStateChanged
private void jobStateChanged(JobStatusChangeEvent event) {
// Resort the job queue if the job-start-time or job-priority changes
if (event.getEventType() == EventType.START_TIME_CHANGED
|| event.getEventType() == EventType.PRIORITY_CHANGED) {
synchronized (jobInitQueue) {
resortInitQueue();
}
}
}
示例7: updateJob
private JobStatusChangeEvent updateJob(JobInProgress jip,
JobHistory.JobInfo job) {
// Change the job priority
String jobpriority = job.get(Keys.JOB_PRIORITY);
JobPriority priority = JobPriority.valueOf(jobpriority);
// It's important to update this via the jobtracker's api as it will
// take care of updating the event listeners too
try {
setJobPriority(jip.getJobID(), priority);
} catch (IOException e) {
// This will not happen. JobTracker can set jobPriority of any job
// as mrOwner has the needed permissions.
LOG.warn("Unexpected. JobTracker could not do SetJobPriority on "
+ jip.getJobID() + ". " + e);
}
// Save the previous job status
JobStatus oldStatus = (JobStatus)jip.getStatus().clone();
// Set the start/launch time only if there are recovered tasks
// Increment the job's restart count
jip.updateJobInfo(job.getLong(JobHistory.Keys.SUBMIT_TIME),
job.getLong(JobHistory.Keys.LAUNCH_TIME));
// Save the new job status
JobStatus newStatus = (JobStatus)jip.getStatus().clone();
return new JobStatusChangeEvent(jip, EventType.START_TIME_CHANGED, oldStatus,
newStatus);
}