Examples of JobEvent


Examples of eu.stratosphere.nephele.event.job.JobEvent

        this.lastProcessedEventSequenceNumber = event.getSequenceNumber();

        // Check if we can exit the loop
        if (event instanceof JobEvent) {
          final JobEvent jobEvent = (JobEvent) event;
          final JobStatus jobStatus = jobEvent.getCurrentJobStatus();
          if (jobStatus == JobStatus.SCHEDULED) {
            startTimestamp = jobEvent.getTimestamp();
          }
          if (jobStatus == JobStatus.FINISHED) {
            Runtime.getRuntime().removeShutdownHook(this.jobCleanUp);
            final long jobDuration = jobEvent.getTimestamp() - startTimestamp;
           
            // Request accumulators
            Map<String, Object> accumulators = null;
            try {
              accumulators = AccumulatorHelper.toResultMap(getAccumulators().getAccumulators());
            } catch (IOException ioe) {
              Runtime.getRuntime().removeShutdownHook(this.jobCleanUp);
              throw ioe;  // Rethrow error
            }
            return new JobExecutionResult(jobDuration, accumulators);
           
          } else if (jobStatus == JobStatus.CANCELED || jobStatus == JobStatus.FAILED) {
            Runtime.getRuntime().removeShutdownHook(this.jobCleanUp);
            LOG.info(jobEvent.getOptionalMessage());
            if (jobStatus == JobStatus.CANCELED) {
              throw new JobExecutionException(jobEvent.getOptionalMessage(), true);
            } else {
              throw new JobExecutionException(jobEvent.getOptionalMessage(), false);
            }
          }
        }
      }
View Full Code Here

Examples of org.apache.flink.runtime.event.job.JobEvent

        this.lastProcessedEventSequenceNumber = event.getSequenceNumber();

        // Check if we can exit the loop
        if (event instanceof JobEvent) {
          final JobEvent jobEvent = (JobEvent) event;
          final JobStatus jobStatus = jobEvent.getCurrentJobStatus();
          if (jobStatus == JobStatus.RUNNING) {
            startTimestamp = jobEvent.getTimestamp();
          }
          if (jobStatus == JobStatus.FINISHED) {
            Runtime.getRuntime().removeShutdownHook(this.jobCleanUp);
            final long jobDuration = jobEvent.getTimestamp() - startTimestamp;

            // Request accumulators
            Map<String, Object> accumulators = null;
            try {
              accumulators = AccumulatorHelper.toResultMap(getAccumulators().getAccumulators(this.userCodeClassLoader));
            } catch (IOException ioe) {
              Runtime.getRuntime().removeShutdownHook(this.jobCleanUp);
              throw ioe; // Rethrow error
            }
            return new JobExecutionResult(jobDuration, accumulators);

          } else if (jobStatus == JobStatus.CANCELED || jobStatus == JobStatus.FAILED) {
            Runtime.getRuntime().removeShutdownHook(this.jobCleanUp);
            LOG.info(jobEvent.getOptionalMessage());
            if (jobStatus == JobStatus.CANCELED) {
              throw new JobExecutionException(jobEvent.getOptionalMessage(), true);
            } else {
              throw new JobExecutionException(jobEvent.getOptionalMessage(), false);
            }
          }
        }
      }
View Full Code Here

Examples of org.apache.hadoop.mapreduce.v2.app.job.event.JobEvent

        LOG.error("Can't handle this event at current state for "
            + this.attemptId, e);
        eventHandler.handle(new JobDiagnosticsUpdateEvent(
            this.attemptId.getTaskId().getJobId(), "Invalid event " + event.getType() +
            " on TaskAttempt " + this.attemptId));
        eventHandler.handle(new JobEvent(this.attemptId.getTaskId().getJobId(),
            JobEventType.INTERNAL_ERROR));
      }
      if (oldState != getInternalState()) {
          LOG.info(attemptId + " TaskAttempt Transitioned from "
           + oldState + " to "
View Full Code Here

Examples of org.apache.hadoop.mapreduce.v2.app.job.event.JobEvent

          return JobStateInternal.FAIL_ABORT;
        }

        //Set max timeout to wait for the tasks to get killed
        job.failWaitTriggerScheduledFuture = job.executor.schedule(
          new TriggerScheduledFuture(job, new JobEvent(job.getID(),
            JobEventType.JOB_FAIL_WAIT_TIMEDOUT)), job.conf.getInt(
                MRJobConfig.MR_AM_COMMITTER_CANCEL_TIMEOUT_MS,
                MRJobConfig.DEFAULT_MR_AM_COMMITTER_CANCEL_TIMEOUT_MS),
                TimeUnit.MILLISECONDS);
        return JobStateInternal.FAIL_WAIT;
View Full Code Here

Examples of org.apache.hadoop.mapreduce.v2.app.job.event.JobEvent

    JobSubmittedEventHandler jseHandler = new JobSubmittedEventHandler("testId",
        "testName", "testNodeName", "\"key2\"=\"value2\" \"key1\"=\"value1\" ",
        "tag1,tag2");
    dispatcher.register(EventType.class, jseHandler);
    JobImpl job = createStubbedJob(conf, dispatcher, 0, null);
    job.handle(new JobEvent(job.getID(), JobEventType.JOB_INIT));
    assertJobState(job, JobStateInternal.INITED);
    job.handle(new JobStartEvent(job.getID()));
    assertJobState(job, JobStateInternal.SUCCEEDED);
    dispatcher.stop();
    commitHandler.stop();
View Full Code Here

Examples of org.apache.hadoop.mapreduce.v2.app.job.event.JobEvent

    // let the committer complete and verify the job succeeds
    syncBarrier.await();
    assertJobState(job, JobStateInternal.SUCCEEDED);
   
    job.handle(new JobEvent(job.getID(),
        JobEventType.JOB_TASK_ATTEMPT_COMPLETED));
    assertJobState(job, JobStateInternal.SUCCEEDED);

    job.handle(new JobEvent(job.getID(),
        JobEventType.JOB_MAP_TASK_RESCHEDULED));
    assertJobState(job, JobStateInternal.SUCCEEDED);
   
    dispatcher.stop();
    commitHandler.stop();
View Full Code Here

Examples of org.apache.hadoop.mapreduce.v2.app.job.event.JobEvent

    AppContext mockContext = mock(AppContext.class);
    when(mockContext.isLastAMRetry()).thenReturn(false);
    JobImpl job = createStubbedJob(conf, dispatcher, 2, mockContext);
    JobId jobId = job.getID();
    job.handle(new JobEvent(jobId, JobEventType.JOB_INIT));
    assertJobState(job, JobStateInternal.INITED);
    job.handle(new JobStartEvent(jobId));
    assertJobState(job, JobStateInternal.SETUP);

    job.handle(new JobEvent(job.getID(), JobEventType.JOB_AM_REBOOT));
    assertJobState(job, JobStateInternal.REBOOT);
    // return the external state as RUNNING since otherwise JobClient will
    // exit when it polls the AM for job state
    Assert.assertEquals(JobState.RUNNING, job.getState());
View Full Code Here

Examples of org.apache.hadoop.mapreduce.v2.app.job.event.JobEvent

    JobImpl job = createRunningStubbedJob(conf, dispatcher, 2, mockContext);
    completeJobTasks(job);
    assertJobState(job, JobStateInternal.COMMITTING);

    syncBarrier.await();
    job.handle(new JobEvent(job.getID(), JobEventType.JOB_AM_REBOOT));
    assertJobState(job, JobStateInternal.REBOOT);
    // return the external state as ERROR since this is last retry.
    Assert.assertEquals(JobState.RUNNING, job.getState());
    when(mockContext.hasSuccessfullyUnregistered()).thenReturn(true);
    Assert.assertEquals(JobState.ERROR, job.getState());
View Full Code Here

Examples of org.apache.hadoop.mapreduce.v2.app.job.event.JobEvent

    commitHandler.init(conf);
    commitHandler.start();

    JobImpl job = createStubbedJob(conf, dispatcher, 2, null);
    JobId jobId = job.getID();
    job.handle(new JobEvent(jobId, JobEventType.JOB_INIT));
    assertJobState(job, JobStateInternal.INITED);
    job.handle(new JobStartEvent(jobId));
    assertJobState(job, JobStateInternal.SETUP);

    job.handle(new JobEvent(job.getID(), JobEventType.JOB_KILL));
    assertJobState(job, JobStateInternal.KILLED);
    dispatcher.stop();
    commitHandler.stop();
  }
View Full Code Here

Examples of org.apache.hadoop.mapreduce.v2.app.job.event.JobEvent

    JobImpl job = createRunningStubbedJob(conf, dispatcher, 2, null);
    completeJobTasks(job);
    assertJobState(job, JobStateInternal.COMMITTING);

    syncBarrier.await();
    job.handle(new JobEvent(job.getID(), JobEventType.JOB_KILL));
    assertJobState(job, JobStateInternal.KILLED);
    dispatcher.stop();
    commitHandler.stop();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.