Search in sources :

Example 6 with KillXCommand

use of org.apache.oozie.command.wf.KillXCommand in project oozie by apache.

the class TestSLAEventGeneration method _testWorkflowJobKillCommand.

private void _testWorkflowJobKillCommand(Configuration conf, SLAService slas) throws Exception {
    cal.setTime(new Date());
    // for start_miss
    cal.add(Calendar.MINUTE, -20);
    Date nominal = cal.getTime();
    String nominalTime = DateUtils.formatDateOozieTZ(nominal);
    conf.set("nominal_time", nominalTime);
    // test that sla processes the Job Event from Kill command
    // submit new job
    String jobId = new SubmitXCommand(conf).call();
    new KillXCommand(jobId).call();
    // wait for wf-action kill event to generate
    waitForEventGeneration(200);
    ehs.new EventWorker().run();
    // time for listeners to run
    waitForEventGeneration(300);
    SLACalcStatus slaEvent = skipToSLAEvent();
    assertEquals(jobId, slaEvent.getId());
    assertNotNull(slaEvent.getActualEnd());
    assertEquals(EventStatus.END_MISS, slaEvent.getEventStatus());
    assertEquals(SLAStatus.MISS, slaEvent.getSLAStatus());
    assertEquals(WorkflowJob.Status.KILLED.name(), slaEvent.getJobStatus());
}
Also used : CoordSubmitXCommand(org.apache.oozie.command.coord.CoordSubmitXCommand) SubmitXCommand(org.apache.oozie.command.wf.SubmitXCommand) KillXCommand(org.apache.oozie.command.wf.KillXCommand) CoordKillXCommand(org.apache.oozie.command.coord.CoordKillXCommand) Date(java.util.Date)

Aggregations

KillXCommand (org.apache.oozie.command.wf.KillXCommand)6 Date (java.util.Date)3 CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)2 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)2 ActionKillXCommand (org.apache.oozie.command.wf.ActionKillXCommand)2 Test (org.junit.Test)2 CoordinatorActionInfo (org.apache.oozie.CoordinatorActionInfo)1 WorkflowActionBean (org.apache.oozie.WorkflowActionBean)1 JobEvent (org.apache.oozie.client.event.JobEvent)1 CommandException (org.apache.oozie.command.CommandException)1 CoordKillXCommand (org.apache.oozie.command.coord.CoordKillXCommand)1 CoordResumeXCommand (org.apache.oozie.command.coord.CoordResumeXCommand)1 CoordSubmitXCommand (org.apache.oozie.command.coord.CoordSubmitXCommand)1 ActionStartXCommand (org.apache.oozie.command.wf.ActionStartXCommand)1 ResumeXCommand (org.apache.oozie.command.wf.ResumeXCommand)1 SignalXCommand (org.apache.oozie.command.wf.SignalXCommand)1 StartXCommand (org.apache.oozie.command.wf.StartXCommand)1 SubmitXCommand (org.apache.oozie.command.wf.SubmitXCommand)1 SuspendXCommand (org.apache.oozie.command.wf.SuspendXCommand)1 UpdateEntry (org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry)1