Package org.apache.hadoop.yarn.api.protocolrecords

Examples of org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusRequest


            ContainerManager.class, NetUtils
                .createSocketAddr(allocatedContainer.getNodeId().toString()),
            conf);

        LOG.info("Going to contact NM:  ilLegal request");
        GetContainerStatusRequest request = recordFactory
            .newRecordInstance(GetContainerStatusRequest.class);
        request.setContainerId(containerID);
        try {
          client.getContainerStatus(request);
          fail("Connection initiation with illegally modified "
              + "tokens is expected to fail.");
        } catch (YarnRemoteException e) {
          LOG.error("Got exception", e);
          fail("Cannot get a YARN remote exception as "
              + "it will indicate RPC success");
        } catch (Exception e) {
          Assert.assertEquals(
            java.lang.reflect.UndeclaredThrowableException.class
              .getCanonicalName(), e.getClass().getCanonicalName());
          Assert.assertTrue(e
            .getCause()
            .getMessage()
            .contains(
              "DIGEST-MD5: digest response format violation. "
                  + "Mismatched response."));
        }
        return null;
      }
    });

    KillApplicationRequest request = Records
        .newRecord(KillApplicationRequest.class);
    request.setApplicationId(appID);
    resourceManager.getClientRMService().forceKillApplication(request);
  }
View Full Code Here


    return allocatedContainers.get(0);
  }

  void callWithIllegalContainerID(ContainerManager client,
      ContainerTokenIdentifier tokenId) {
    GetContainerStatusRequest request = recordFactory
        .newRecordInstance(GetContainerStatusRequest.class);
    ContainerId newContainerId = BuilderUtils.newContainerId(BuilderUtils
        .newApplicationAttemptId(tokenId.getContainerID()
            .getApplicationAttemptId().getApplicationId(), 1), 42);
    request.setContainerId(newContainerId); // Authenticated but
                                            // unauthorized.
    try {
      client.getContainerStatus(request);
      fail("Connection initiation with unauthorized "
          + "access is expected to fail.");
View Full Code Here

    StartContainerRequest scRequest =
        recordFactory.newRecordInstance(StartContainerRequest.class);
    scRequest.setContainerLaunchContext(containerLaunchContext);
    proxy.startContainer(scRequest);
   
    GetContainerStatusRequest gcsRequest =
        recordFactory.newRecordInstance(GetContainerStatusRequest.class);
    gcsRequest.setContainerId(containerLaunchContext.getContainerId());
    GetContainerStatusResponse response =  proxy.getContainerStatus(gcsRequest);
    ContainerStatus status = response.getStatus();
   
    //test remote exception
    boolean exception = false;
View Full Code Here

            ContainerManager.class, NetUtils
                .createSocketAddr(allocatedContainer.getNodeId().toString()),
            conf);

        LOG.info("Going to contact NM:  ilLegal request");
        GetContainerStatusRequest request = recordFactory
            .newRecordInstance(GetContainerStatusRequest.class);
        request.setContainerId(containerID);
        try {
          client.getContainerStatus(request);
          fail("Connection initiation with illegally modified "
              + "tokens is expected to fail.");
        } catch (YarnRemoteException e) {
          LOG.error("Got exception", e);
          fail("Cannot get a YARN remote exception as "
              + "it will indicate RPC success");
        } catch (Exception e) {
          Assert.assertEquals(
            java.lang.reflect.UndeclaredThrowableException.class
              .getCanonicalName(), e.getClass().getCanonicalName());
          Assert.assertTrue(e
            .getCause()
            .getMessage()
            .contains(
              "DIGEST-MD5: digest response format violation. "
                  + "Mismatched response."));
        }
        return null;
      }
    });

    KillApplicationRequest request = Records
        .newRecord(KillApplicationRequest.class);
    request.setApplicationId(appID);
    resourceManager.getClientRMService().forceKillApplication(request);
  }
View Full Code Here

    return allocatedContainers.get(0);
  }

  void callWithIllegalContainerID(ContainerManager client,
      ContainerTokenIdentifier tokenId) {
    GetContainerStatusRequest request = recordFactory
        .newRecordInstance(GetContainerStatusRequest.class);
    ContainerId newContainerId = BuilderUtils.newContainerId(BuilderUtils
        .newApplicationAttemptId(tokenId.getContainerID()
            .getApplicationAttemptId().getApplicationId(), 1), 42);
    request.setContainerId(newContainerId); // Authenticated but
                                            // unauthorized.
    try {
      client.getContainerStatus(request);
      fail("Connection initiation with unauthorized "
          + "access is expected to fail.");
View Full Code Here

    Assert.assertEquals(null, reader.readLine());

    BaseContainerManagerTest.waitForContainerState(containerManager, cId,
        ContainerState.COMPLETE, 60);

    GetContainerStatusRequest gcsRequest =
        recordFactory.newRecordInstance(GetContainerStatusRequest.class);
    gcsRequest.setContainerId(cId);
    ContainerStatus containerStatus =
        containerManager.getContainerStatus(gcsRequest).getStatus();
    Assert.assertEquals(ExitCode.TERMINATED.getExitCode(),
        containerStatus.getExitStatus());
    String expectedMsgPattern =
View Full Code Here

    StartContainerRequest startRequest =
        Records.newRecord(StartContainerRequest.class);
    startRequest.setContainerLaunchContext(containerLaunchContext);
    containerManager.startContainer(startRequest);

    GetContainerStatusRequest request =
        Records.newRecord(GetContainerStatusRequest.class);
    request.setContainerId(cId);
    Container container =
        nm.getNMContext().getContainers().get(request.getContainerId());

    final int MAX_TRIES = 20;
    int numTries = 0;
    while (!container.getContainerState().equals(ContainerState.DONE)
        && numTries <= MAX_TRIES) {
View Full Code Here

    containerLaunchContext.getResource().setMemory(1024);
    StartContainerRequest startRequest = recordFactory.newRecordInstance(StartContainerRequest.class);
    startRequest.setContainerLaunchContext(containerLaunchContext);
    containerManager.startContainer(startRequest);
   
    GetContainerStatusRequest request =
        recordFactory.newRecordInstance(GetContainerStatusRequest.class);
        request.setContainerId(cId);
    ContainerStatus containerStatus =
        containerManager.getContainerStatus(request).getStatus();
    Assert.assertEquals(ContainerState.RUNNING, containerStatus.getState());
   
    try {Thread.sleep(5000);} catch (InterruptedException ex) {ex.printStackTrace();}
View Full Code Here

    StartContainerRequest startReq = Records
        .newRecord(StartContainerRequest.class);
    startReq.setContainerLaunchContext(ctx);
    cm.startContainer(startReq);

    GetContainerStatusRequest statusReq = Records
        .newRecord(GetContainerStatusRequest.class);
    statusReq.setContainerId(allocatedContainer.getId());
    return statusReq;
  }
View Full Code Here

    containerManager.stopContainer(stopRequest);

    BaseContainerManagerTest.waitForContainerState(containerManager, cId,
        ContainerState.COMPLETE);

    GetContainerStatusRequest gcsRequest =
        recordFactory.newRecordInstance(GetContainerStatusRequest.class);
    gcsRequest.setContainerId(cId);
    ContainerStatus containerStatus =
        containerManager.getContainerStatus(gcsRequest).getStatus();
    Assert.assertEquals(ExitCode.TERMINATED.getExitCode(),
        containerStatus.getExitStatus());
View Full Code Here

TOP

Related Classes of org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusRequest

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.