Examples of AppmasterService


Examples of org.springframework.yarn.am.AppmasterService

  @Override
  protected void doStart() {
    super.doStart();

    AppmasterService service = getAppmasterService();
    if(log.isDebugEnabled() && service != null) {
      log.debug("We have a appmaster service " + service);
    }

    if(service instanceof BatchAppmasterService) {
      ((BatchAppmasterService)service).addInterceptor(new JobRepositoryRemoteServiceInterceptor() {

        @Override
        public BaseObject preRequest(BaseObject baseObject) {
          if(baseObject.getType().equals("PartitionedStepExecutionStatusReq")) {
            StepExecutionType stepExecutionType = ((PartitionedStepExecutionStatusReq)baseObject).stepExecution;
            StepExecution convertStepExecution = JobRepositoryRpcFactory.convertStepExecutionType(stepExecutionType);
            getStepExecutions().add(convertStepExecution);
            return null;
          } else {
            return baseObject;
          }
        }

        @Override
        public BaseResponseObject postRequest(BaseResponseObject baseResponseObject) {
          return baseResponseObject;
        }

        @Override
        public BaseResponseObject handleRequest(BaseObject baseObject) {
          return new PartitionedStepExecutionStatusRes();
        }
      });
    }

    if(service != null && service.hasPort()) {
      for(int i=0; i<10; i++) {
        if(service.getPort() == -1) {
          try {
            Thread.sleep(500);
          } catch (InterruptedException e) {
          }
        } else {
View Full Code Here

Examples of org.springframework.yarn.am.AppmasterService

    getAllocator().releaseContainer(containerId);
  }

  @Override
  public ContainerLaunchContext preLaunch(Container container, ContainerLaunchContext context) {
    AppmasterService service = getAppmasterService();

    if(log.isDebugEnabled()) {
      log.debug("Intercept launch context: " + context);
    }

    StepExecution stepExecution = containerToStepMap.get(container.getId());
    String jobName = remoteStepNames.get(stepExecution);

    if(service != null) {
      int port = service.getPort();
      String address = service.getHost();
      Map<String, String> env = new HashMap<String, String>(context.getEnvironment());
      env.put(YarnSystemConstants.FS_ADDRESS, getConfiguration().get(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY));
      env.put(YarnSystemConstants.AMSERVICE_PORT, Integer.toString(port));
      env.put(YarnSystemConstants.AMSERVICE_HOST, address);
      env.put(YarnSystemConstants.AMSERVICE_BATCH_STEPNAME, jobName);
View Full Code Here

Examples of org.springframework.yarn.am.AppmasterService

    }
  }

  @Override
  public ContainerLaunchContext preLaunch(Container container, ContainerLaunchContext context) {
    AppmasterService service = getAppmasterService();
    if (service != null) {
      int port = service.getPort();
      String address = service.getHost();
      Map<String, String> env = new HashMap<String, String>(context.getEnvironment());
      env.put(YarnSystemConstants.AMSERVICE_PORT, Integer.toString(port));
      env.put(YarnSystemConstants.AMSERVICE_HOST, address);
      context.setEnvironment(env);
      return context;
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.