Package org.apache.ambari.server.scheduler

Examples of org.apache.ambari.server.scheduler.ExecutionScheduleManager


      LOG.info("********* Initializing Controller **********");
      AmbariManagementController controller = injector.getInstance(
          AmbariManagementController.class);

      LOG.info("********* Initializing Scheduled Request Manager **********");
      ExecutionScheduleManager executionScheduleManager = injector
        .getInstance(ExecutionScheduleManager.class);


      clusterController = controller;

      // FIXME need to figure out correct order of starting things to
      // handle restart-recovery correctly

      /*
       * Start the server after controller state is recovered.
       */
      server.start();

      serverForAgent.start();
      LOG.info("********* Started Server **********");

      manager.start();
      LOG.info("********* Started ActionManager **********");

      executionScheduleManager.start();
      LOG.info("********* Started Scheduled Request Manager **********");

      server.join();
      LOG.info("Joined the Server");
    } catch (BadPaddingException bpe){
View Full Code Here


      LOG.info("********* Initializing Controller **********");
      AmbariManagementController controller = injector.getInstance(
          AmbariManagementController.class);

      LOG.info("********* Initializing Scheduled Request Manager **********");
      ExecutionScheduleManager executionScheduleManager = injector
        .getInstance(ExecutionScheduleManager.class);


      clusterController = controller;

      // FIXME need to figure out correct order of starting things to
      // handle restart-recovery correctly

      /*
       * Start the server after controller state is recovered.
       */
      server.start();

      serverForAgent.start();
      LOG.info("********* Started Server **********");

      manager.start();
      LOG.info("********* Started ActionManager **********");

      executionScheduleManager.start();
      LOG.info("********* Started Scheduled Request Manager **********");

      server.join();
      LOG.info("Joined the Server");
    } catch (BadPaddingException bpe){
View Full Code Here

public class BatchRequestJobTest {

  @Test
  public void testDoWork() throws Exception {
    ExecutionScheduleManager scheduleManagerMock = createMock(ExecutionScheduleManager.class);
    BatchRequestJob batchRequestJob = new BatchRequestJob(scheduleManagerMock, 100L);
    String clusterName = "mycluster";
    long requestId = 11L;
    long executionId = 31L;
    long batchId = 1L;

    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put(BatchRequestJob.BATCH_REQUEST_EXECUTION_ID_KEY, executionId);
    properties.put(BatchRequestJob.BATCH_REQUEST_BATCH_ID_KEY, batchId);
    properties.put(BatchRequestJob.BATCH_REQUEST_CLUSTER_NAME_KEY, clusterName);

    HashMap<String, Integer> taskCounts = new HashMap<String, Integer>()
    {{ put(BatchRequestJob.BATCH_REQUEST_FAILED_TASKS_KEY, 0);
      put(BatchRequestJob.BATCH_REQUEST_TOTAL_TASKS_KEY, 0); }};


    BatchRequestResponse pendingResponse = new BatchRequestResponse();
    pendingResponse.setStatus(HostRoleStatus.PENDING.toString());
    BatchRequestResponse inProgressResponse = new BatchRequestResponse();
    inProgressResponse.setStatus(HostRoleStatus.IN_PROGRESS.toString());
    BatchRequestResponse completedResponse = new BatchRequestResponse();
    completedResponse.setStatus(HostRoleStatus.COMPLETED.toString());

    Capture<Long> executionIdCapture = new Capture<Long>();
    Capture<Long> batchIdCapture = new Capture<Long>();
    Capture<String> clusterNameCapture = new Capture<String>();


    expect(scheduleManagerMock.executeBatchRequest(captureLong(executionIdCapture),
      captureLong(batchIdCapture),
      capture(clusterNameCapture))).andReturn(requestId);

    expect(scheduleManagerMock.getBatchRequestResponse(requestId, clusterName)).
      andReturn(pendingResponse).times(2);
    expect(scheduleManagerMock.getBatchRequestResponse(requestId, clusterName)).
      andReturn(inProgressResponse).times(4);
    expect(scheduleManagerMock.getBatchRequestResponse(requestId, clusterName)).
      andReturn(completedResponse).once();
    expect(scheduleManagerMock.hasToleranceThresholdExceeded(executionId,
      clusterName, taskCounts)).andReturn(false);

    scheduleManagerMock.updateBatchRequest(eq(executionId), eq(batchId), eq(clusterName),
        anyObject(BatchRequestResponse.class), eq(true));
    expectLastCall().anyTimes();

    replay(scheduleManagerMock);
View Full Code Here

    Assert.assertEquals(clusterName, clusterNameCapture.getValue());
  }

  @Test
  public void testTaskCountsPersistedWithTrigger() throws Exception {
    ExecutionScheduleManager scheduleManagerMock = createNiceMock
      (ExecutionScheduleManager.class);
    BatchRequestJob batchRequestJobMock = createMockBuilder
      (BatchRequestJob.class).withConstructor(scheduleManagerMock, 100L)
      .addMockedMethods("doWork")
      .createMock();
    JobExecutionContext executionContext = createNiceMock(JobExecutionContext.class);
    JobDataMap jobDataMap = createNiceMock(JobDataMap.class);
    JobDetail jobDetail = createNiceMock(JobDetail.class);
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put(BatchRequestJob.BATCH_REQUEST_FAILED_TASKS_KEY, 10);
    properties.put(BatchRequestJob.BATCH_REQUEST_TOTAL_TASKS_KEY, 20);

    expect(scheduleManagerMock.continueOnMisfire(executionContext)).andReturn(true);
    expect(executionContext.getMergedJobDataMap()).andReturn(jobDataMap);
    expect(executionContext.getJobDetail()).andReturn(jobDetail);
    expect(jobDetail.getKey()).andReturn(JobKey.jobKey("testJob", "testGroup"));
    expect(jobDataMap.getWrappedMap()).andReturn(properties);
    expect(jobDataMap.getString((String) anyObject())).andReturn("testJob").anyTimes();

    Capture<Trigger> triggerCapture = new Capture<Trigger>();
    scheduleManagerMock.scheduleJob(capture(triggerCapture));
    expectLastCall().once();

    replay(scheduleManagerMock, executionContext, jobDataMap, jobDetail);

    batchRequestJobMock.execute(executionContext);
View Full Code Here

    Clusters clusters = createNiceMock(Clusters.class);
    Cluster cluster = createNiceMock(Cluster.class);
    RequestExecutionFactory executionFactory = createNiceMock
      (RequestExecutionFactory.class);
    RequestExecution requestExecution = createNiceMock(RequestExecution.class);
    ExecutionScheduleManager executionScheduleManager = createNiceMock
      (ExecutionScheduleManager.class);

    expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
    expect(managementController.getClusters()).andReturn(clusters);
    expect(managementController.getExecutionScheduleManager()).andReturn
View Full Code Here

    Clusters clusters = createNiceMock(Clusters.class);
    Cluster cluster = createNiceMock(Cluster.class);
    final RequestExecution requestExecution = createNiceMock(RequestExecution.class);
    RequestScheduleResponse requestScheduleResponse = createNiceMock
      (RequestScheduleResponse.class);
    ExecutionScheduleManager executionScheduleManager = createNiceMock
      (ExecutionScheduleManager.class);

    expect(managementController.getClusters()).andReturn(clusters).anyTimes();
    expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
    expect(managementController.getAuthName()).andReturn("admin").anyTimes();
View Full Code Here

  public void testDeleteRequestSchedule() throws Exception {
    AmbariManagementController managementController = createMock(AmbariManagementController.class);
    Clusters clusters = createNiceMock(Clusters.class);
    Cluster cluster = createNiceMock(Cluster.class);
    RequestExecution requestExecution = createNiceMock(RequestExecution.class);
    ExecutionScheduleManager executionScheduleManager = createNiceMock
      (ExecutionScheduleManager.class);

    Map<Long, RequestExecution> requestExecutionMap = new HashMap<Long,
      RequestExecution>();
    requestExecutionMap.put(1L, requestExecution);
View Full Code Here

      LOG.info("********* Initializing Controller **********");
      AmbariManagementController controller = injector.getInstance(
          AmbariManagementController.class);

      LOG.info("********* Initializing Scheduled Request Manager **********");
      ExecutionScheduleManager executionScheduleManager = injector
        .getInstance(ExecutionScheduleManager.class);


      clusterController = controller;

      // FIXME need to figure out correct order of starting things to
      // handle restart-recovery correctly

      /*
       * Start the server after controller state is recovered.
       */
      server.start();

      serverForAgent.start();
      LOG.info("********* Started Server **********");

      manager.start();
      LOG.info("********* Started ActionManager **********");

      executionScheduleManager.start();
      LOG.info("********* Started Scheduled Request Manager **********");

      server.join();
      LOG.info("Joined the Server");
    } catch (BadPaddingException bpe){
View Full Code Here

      LOG.info("********* Initializing Controller **********");
      AmbariManagementController controller = injector.getInstance(
          AmbariManagementController.class);

      LOG.info("********* Initializing Scheduled Request Manager **********");
      ExecutionScheduleManager executionScheduleManager = injector
        .getInstance(ExecutionScheduleManager.class);


      clusterController = controller;

      // FIXME need to figure out correct order of starting things to
      // handle restart-recovery correctly

      /*
       * Start the server after controller state is recovered.
       */
      server.start();

      serverForAgent.start();
      LOG.info("********* Started Server **********");

      manager.start();
      LOG.info("********* Started ActionManager **********");

      executionScheduleManager.start();
      LOG.info("********* Started Scheduled Request Manager **********");

      server.join();
      LOG.info("Joined the Server");
    } catch (BadPaddingException bpe){
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.scheduler.ExecutionScheduleManager

Copyright © 2018 www.massapicom. 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.