• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EventType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.mapred.JobStatusChangeEvent.EventType的典型用法代码示例。如果您正苦于以下问题:Java EventType类的具体用法?Java EventType怎么用?Java EventType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EventType类属于org.apache.hadoop.mapred.JobStatusChangeEvent包,在下文中一共展示了EventType类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: jobUpdated

import org.apache.hadoop.mapred.JobStatusChangeEvent.EventType; //导入依赖的package包/类
@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);
      }
    }
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:25,代码来源:JobQueueJobInProgressListener.java


示例2: killJob

import org.apache.hadoop.mapred.JobStatusChangeEvent.EventType; //导入依赖的package包/类
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);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:21,代码来源:JobTracker.java


示例3: failJob

import org.apache.hadoop.mapred.JobStatusChangeEvent.EventType; //导入依赖的package包/类
/**
 * 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);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:24,代码来源:JobTracker.java


示例4: setJobPriority

import org.apache.hadoop.mapred.JobStatusChangeEvent.EventType; //导入依赖的package包/类
/**
 * Change the run-time priority of the given job.
 * 
 * @param jobId job id
 * @param priority new {@link JobPriority} for the job
 * @throws IOException
 * @throws AccessControlException
 */
synchronized void setJobPriority(JobID jobId, JobPriority priority)
    throws AccessControlException, IOException {
  JobInProgress job = jobs.get(jobId);
  if (job != null) {

    // check both queue-level and job-level access
    aclsManager.checkAccess(job, UserGroupInformation.getCurrentUser(),
        Operation.SET_JOB_PRIORITY);

    synchronized (taskScheduler) {
      JobStatus oldStatus = (JobStatus)job.getStatus().clone();
      job.setPriority(priority);
      JobStatus newStatus = (JobStatus)job.getStatus().clone();
      JobStatusChangeEvent event = 
        new JobStatusChangeEvent(job, EventType.PRIORITY_CHANGED, oldStatus, 
                                 newStatus);
      updateJobInProgressListeners(event);
    }
  } else {
    LOG.warn("Trying to change the priority of an unknown job: " + jobId);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:31,代码来源:JobTracker.java


示例5: jobUpdated

import org.apache.hadoop.mapred.JobStatusChangeEvent.EventType; //导入依赖的package包/类
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);
      }
    }
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:27,代码来源:TestJobInProgressListener.java


示例6: initJob

import org.apache.hadoop.mapred.JobStatusChangeEvent.EventType; //导入依赖的package包/类
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);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:18,代码来源:TestParallelInitialization.java


示例7: setStartTime

import org.apache.hadoop.mapred.JobStatusChangeEvent.EventType; //导入依赖的package包/类
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);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:17,代码来源:TestCapacityScheduler.java


示例8: killJob

import org.apache.hadoop.mapred.JobStatusChangeEvent.EventType; //导入依赖的package包/类
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);
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:21,代码来源:JobTracker.java


示例9: failJob

import org.apache.hadoop.mapred.JobStatusChangeEvent.EventType; //导入依赖的package包/类
/**
 * 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);
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:24,代码来源:JobTracker.java


示例10: setJobPriority

import org.apache.hadoop.mapred.JobStatusChangeEvent.EventType; //导入依赖的package包/类
/**
 * Change the run-time priority of the given job.
 * @param jobId job id
 * @param priority new {@link JobPriority} for the job
 */
synchronized void setJobPriority(JobID jobId, JobPriority priority) {
  JobInProgress job = jobs.get(jobId);
  if (job != null) {
    synchronized (taskScheduler) {
      JobStatus oldStatus = (JobStatus)job.getStatus().clone();
      job.setPriority(priority);
      JobStatus newStatus = (JobStatus)job.getStatus().clone();
      JobStatusChangeEvent event =
        new JobStatusChangeEvent(job, EventType.PRIORITY_CHANGED, oldStatus,
                                 newStatus);
      updateJobInProgressListeners(event);
    }
  } else {
    LOG.warn("Trying to change the priority of an unknown job: " + jobId);
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:22,代码来源:JobTracker.java


示例11: jobStateChanged

import org.apache.hadoop.mapred.JobStatusChangeEvent.EventType; //导入依赖的package包/类
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);
    }
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:23,代码来源:JobQueuesManager.java


示例12: setStartTime

import org.apache.hadoop.mapred.JobStatusChangeEvent.EventType; //导入依赖的package包/类
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);
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:17,代码来源:TestCapacityScheduler.java


示例13: updateJob

import org.apache.hadoop.mapred.JobStatusChangeEvent.EventType; //导入依赖的package包/类
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);
}
 
开发者ID:thisisvoa,项目名称:hadoop-0.20,代码行数:24,代码来源:JobTracker.java


示例14: setJobPriority

import org.apache.hadoop.mapred.JobStatusChangeEvent.EventType; //导入依赖的package包/类
/**
 * Change the run-time priority of the given job.
 * @param jobId job id
 * @param priority new {@link JobPriority} for the job
 */
synchronized void setJobPriority(JobID jobId, JobPriority priority) {
  JobInProgress job = jobs.get(jobId);
  if (job != null) {
    synchronized (taskScheduler) {
      JobStatus oldStatus = (JobStatus)job.getStatus().clone();
      job.setPriority(priority);
      JobStatus newStatus = (JobStatus)job.getStatus().clone();
      JobStatusChangeEvent event = 
        new JobStatusChangeEvent(job, EventType.PRIORITY_CHANGED, oldStatus, 
                                 newStatus);
      updateJobInProgressListeners(event);
    }
  } else {
    LOG.warn("Trying to change the priority of an unknown job: " + jobId);
  }
}
 
开发者ID:thisisvoa,项目名称:hadoop-0.20,代码行数:22,代码来源:JobTracker.java



注:本文中的org.apache.hadoop.mapred.JobStatusChangeEvent.EventType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ReadWriteTransaction类代码示例发布时间:2022-05-22
下一篇:
Java KafkaSpout类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap