org.apache.hadoop.mapred.jobcontrol.Job.setState()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(245)

本文整理了Java中org.apache.hadoop.mapred.jobcontrol.Job.setState()方法的一些代码示例,展示了Job.setState()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Job.setState()方法的具体详情如下:
包路径:org.apache.hadoop.mapred.jobcontrol.Job
类名称:Job
方法名:setState

Job.setState介绍

[英]Set the state for this job.
[中]设置此作业的状态。

代码示例

代码示例来源:origin: stackoverflow.com

public boolean print(Job aJob){
  boolean result = false;
  if (isAvailable()){
    currentJob=aJob;
    aJob.setPrinter(this);
    aJob.setState(Job.PRINTING);
    result = true;
  }
  System.err.println("Error");
  return result;
}

代码示例来源:origin: stackoverflow.com

public void print(Job aJob) {
  if (!isAvailable()) {
    throw new IllegalStateException("Cannot print when printer not available.");
  }
  currentJob = aJob;
  aJob.setPrinter(this);
  aJob.setState(Job.PRINTING);
}

public void printingCompleted() {
  if (!isPrinting()) {
    throw new IllegalStateException("Attempt to complete printing when no printing in progress.");
  }
  currentJob.setPrinter(null);
  currentJob.setState(Job.COMPLETED);
  currentJob = null;
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

/**
 * Add a new job.
 * @param aJob the new job
 */
synchronized public String addJob(Job aJob) {
 String id = this.getNextJobID();
 aJob.setJobID(id);
 aJob.setState(Job.WAITING);
 this.addToQueue(aJob);
 return id;	
}

代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core

/**
 * Add a new job.
 * @param aJob the the new job
 */
synchronized public String addJob(Job aJob) {
 String id = this.getNextJobID();
 aJob.setJobID(id);
 aJob.setState(Job.WAITING);
 this.addToQueue(aJob);
 return id;	
}

代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-jobclient

@SuppressWarnings("deprecation")
@Test(timeout = 30000)
public void testJobState() throws Exception {
 Job job_1 = getCopyJob();
 JobControl jc = new JobControl("Test");
 jc.addJob(job_1);
 Assert.assertEquals(Job.WAITING, job_1.getState());
 job_1.setState(Job.SUCCESS);
 Assert.assertEquals(Job.WAITING, job_1.getState());
 org.apache.hadoop.mapreduce.Job mockjob =
   mock(org.apache.hadoop.mapreduce.Job.class);
 org.apache.hadoop.mapreduce.JobID jid =
   new org.apache.hadoop.mapreduce.JobID("test", 0);
 when(mockjob.getJobID()).thenReturn(jid);
 job_1.setJob(mockjob);
 Assert.assertEquals("job_test_0000", job_1.getMapredJobID());
 job_1.setMapredJobID("job_test_0001");
 Assert.assertEquals("job_test_0000", job_1.getMapredJobID());
 jc.stop();
}

相关文章