本文整理汇总了Java中org.apache.hadoop.mapred.JobStatusChangeEvent.EventType.RUN_STATE_CHANGED属性的典型用法代码示例。如果您正苦于以下问题:Java EventType.RUN_STATE_CHANGED属性的具体用法?Java EventType.RUN_STATE_CHANGED怎么用?Java EventType.RUN_STATE_CHANGED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.hadoop.mapred.JobStatusChangeEvent.EventType
的用法示例。
在下文中一共展示了EventType.RUN_STATE_CHANGED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: killJob
private synchronized void killJob(JobInProgress job) {
LOG.info("Killing job " + job.getJobID());
JobStatus prevStatus = (JobStatus)job.getStatus().clone();
job.kill();
// Inform the listeners if the job is killed
// Note :
// If the job is killed in the PREP state then the listeners will be
// invoked
// If the job is killed in the RUNNING state then cleanup tasks will be
// launched and the updateTaskStatuses() will take care of it
JobStatus newStatus = (JobStatus)job.getStatus().clone();
if (prevStatus.getRunState() != newStatus.getRunState()
&& newStatus.getRunState() == JobStatus.KILLED) {
JobStatusChangeEvent event =
new JobStatusChangeEvent(job, EventType.RUN_STATE_CHANGED, prevStatus,
newStatus);
updateJobInProgressListeners(event);
}
}
示例2: failJob
/**
* Fail a job and inform the listeners. Other components in the framework
* should use this to fail a job.
*/
public synchronized void failJob(JobInProgress job) {
if (null == job) {
LOG.info("Fail on null job is not valid");
return;
}
JobStatus prevStatus = (JobStatus)job.getStatus().clone();
LOG.info("Failing job " + job.getJobID());
job.fail();
// Inform the listeners if the job state has changed
JobStatus newStatus = (JobStatus)job.getStatus().clone();
if (prevStatus.getRunState() != newStatus.getRunState()) {
JobStatusChangeEvent event =
new JobStatusChangeEvent(job, EventType.RUN_STATE_CHANGED, prevStatus,
newStatus);
updateJobInProgressListeners(event);
}
}
示例3: jobUpdated
public void jobUpdated(JobChangeEvent event) {
LOG.info("Job " + event.getJobInProgress().getJobID().toString() + " updated");
// remove the job is the event is for a completed job
if (event instanceof JobStatusChangeEvent) {
JobStatusChangeEvent statusEvent = (JobStatusChangeEvent)event;
if (statusEvent.getEventType() == EventType.RUN_STATE_CHANGED) {
// check if the state changes from
// RUNNING->COMPLETE(SUCCESS/KILLED/FAILED)
JobInProgress jip = event.getJobInProgress();
String jobId = jip.getJobID().toString();
if (jip.isComplete()) {
LOG.info("Job " + jobId + " deleted from the running queue");
if (statusEvent.getOldStatus().getRunState() == JobStatus.PREP) {
wjobs.remove(jip);
} else {
jobs.remove(jip);
}
} else {
// PREP->RUNNING
LOG.info("Job " + jobId + " deleted from the waiting queue");
wjobs.remove(jip);
jobs.add(jip);
}
}
}
}
示例4: initJob
public void initJob(JobInProgress job) {
try {
JobStatus prevStatus = (JobStatus)job.getStatus().clone();
job.initTasks();
JobStatus newStatus = (JobStatus)job.getStatus().clone();
if (prevStatus.getRunState() != newStatus.getRunState()) {
JobStatusChangeEvent event =
new JobStatusChangeEvent(job, EventType.RUN_STATE_CHANGED, prevStatus,
newStatus);
for (JobInProgressListener listener : listeners) {
listener.jobUpdated(event);
}
}
} catch (Exception ioe) {
failJob(job);
}
}
示例5: 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);
}
}
}
}
示例6: killJob
private synchronized void killJob(JobInProgress job) {
LOG.info("Killing job " + job.getJobID());
JobStatus prevStatus = (JobStatus)job.getStatus().clone();
job.kill();
// Inform the listeners if the job is killed
// Note :
// If the job is killed in the PREP state then the listeners will be
// invoked
// If the job is killed in the RUNNING state then cleanup tasks will be
// launched and the updateTaskStatuses() will take care of it
JobStatus newStatus = (JobStatus)job.getStatus().clone();
if (prevStatus.getRunState() != newStatus.getRunState()
&& newStatus.getRunState() == JobStatus.KILLED) {
JobStatusChangeEvent event =
new JobStatusChangeEvent(job, EventType.RUN_STATE_CHANGED, prevStatus,
newStatus);
updateJobInProgressListeners(event);
}
}
示例7: failJob
/**
* Fail a job and inform the listeners. Other components in the framework
* should use this to fail a job.
*/
public synchronized void failJob(JobInProgress job) {
if (null == job) {
LOG.info("Fail on null job is not valid");
return;
}
JobStatus prevStatus = (JobStatus)job.getStatus().clone();
LOG.info("Failing job " + job.getJobID());
job.fail();
// Inform the listeners if the job state has changed
JobStatus newStatus = (JobStatus)job.getStatus().clone();
if (prevStatus.getRunState() != newStatus.getRunState()) {
JobStatusChangeEvent event =
new JobStatusChangeEvent(job, EventType.RUN_STATE_CHANGED, prevStatus,
newStatus);
updateJobInProgressListeners(event);
}
}
示例8: 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);
}
}
}
示例9: initJob
public void initJob(JobInProgress job) {
try {
JobStatus prevStatus = (JobStatus)job.getStatus().clone();
job.initTasks();
if (job.isJobEmpty()) {
completeEmptyJob(job);
} else if (!job.isSetupCleanupRequired()) {
job.completeSetup();
}
JobStatus newStatus = (JobStatus)job.getStatus().clone();
if (prevStatus.getRunState() != newStatus.getRunState()) {
JobStatusChangeEvent event =
new JobStatusChangeEvent(job, EventType.RUN_STATE_CHANGED, prevStatus,
newStatus);
for (JobInProgressListener listener : listeners) {
listener.jobUpdated(event);
}
}
} catch (KillInterruptedException kie) {
killJob(job.getJobID());
} catch (IOException ioe) {
failJob(job);
}
}
示例10: raiseStatusChangeEvents
private void raiseStatusChangeEvents(JobQueuesManager mgr, String queueName) {
Collection<JobInProgress> jips = mgr.getWaitingJobs(queueName);
for(JobInProgress jip : jips) {
if(jip.getStatus().getRunState() == JobStatus.RUNNING) {
JobStatusChangeEvent evt = new JobStatusChangeEvent(jip,
EventType.RUN_STATE_CHANGED,jip.getStatus());
mgr.jobUpdated(evt);
}
}
}
示例11: initJob
public void initJob(JobInProgress job) {
if (null == job) {
LOG.info("Init on null job is not valid");
return;
}
try {
JobStatus prevStatus = (JobStatus)job.getStatus().clone();
LOG.info("Initializing " + job.getJobID());
job.initTasks();
// Inform the listeners if the job state has changed
// Note : that the job will be in PREP state.
JobStatus newStatus = (JobStatus)job.getStatus().clone();
if (prevStatus.getRunState() != newStatus.getRunState()) {
JobStatusChangeEvent event =
new JobStatusChangeEvent(job, EventType.RUN_STATE_CHANGED, prevStatus,
newStatus);
synchronized (JobTracker.this) {
updateJobInProgressListeners(event);
}
}
} catch (KillInterruptedException kie) {
// If job was killed during initialization, job state will be KILLED
LOG.error("Job initialization interrupted:\n" +
StringUtils.stringifyException(kie));
killJob(job);
} catch (Throwable t) {
String failureInfo =
"Job initialization failed:\n" + StringUtils.stringifyException(t);
// If the job initialization is failed, job state will be FAILED
LOG.error(failureInfo);
job.getStatus().setFailureInfo(failureInfo);
failJob(job);
}
}
示例12: failJob
public synchronized void failJob(JobInProgress job) {
JobStatus prevStatus = (JobStatus)job.getStatus().clone();
job.fail();
JobStatus newStatus = (JobStatus)job.getStatus().clone();
if (prevStatus.getRunState() != newStatus.getRunState()) {
JobStatusChangeEvent event =
new JobStatusChangeEvent(job, EventType.RUN_STATE_CHANGED, prevStatus,
newStatus);
for (JobInProgressListener listener : listeners) {
listener.jobUpdated(event);
}
}
}
示例13: initJob
public void initJob(JobInProgress jip) {
try {
JobStatus oldStatus = (JobStatus)jip.getStatus().clone();
jip.initTasks();
JobStatus newStatus = (JobStatus)jip.getStatus().clone();
JobStatusChangeEvent event = new JobStatusChangeEvent(jip,
EventType.RUN_STATE_CHANGED, oldStatus, newStatus);
for (JobInProgressListener listener : mylisteners) {
listener.jobUpdated(event);
}
} catch (Exception ioe) {
failJob(jip);
}
}
示例14: finalizeJob
void finalizeJob(JobInProgress fjob, int state) {
// take a snapshot of the status before changing it
JobStatus oldStatus = (JobStatus)fjob.getStatus().clone();
fjob.getStatus().setRunState(state);
JobStatus newStatus = (JobStatus)fjob.getStatus().clone();
JobStatusChangeEvent event =
new JobStatusChangeEvent (fjob, EventType.RUN_STATE_CHANGED, oldStatus,
newStatus);
for (JobInProgressListener listener : mylisteners) {
listener.jobUpdated(event);
}
}
示例15: raiseStatusChangeEvents
private void raiseStatusChangeEvents(JobQueuesManager mgr, String queueName) {
Collection<JobInProgress> jips = mgr.getQueue(queueName).getInitializingJobs();
for(JobInProgress jip : jips) {
if(jip.getStatus().getRunState() == JobStatus.RUNNING) {
JobStatusChangeEvent evt = new JobStatusChangeEvent(jip,
EventType.RUN_STATE_CHANGED,jip.getStatus());
mgr.jobUpdated(evt);
}
}
}