Package org.apache.hadoop.yarn.api.records

Examples of org.apache.hadoop.yarn.api.records.ApplicationId


    args = new String[]{
        "--spring.yarn.client.clientClass=org.springframework.yarn.client.DefaultApplicationYarnClient",
        "--spring.yarn.client.launchcontext.archiveFile=" + APPMASTER_ARCHIVE
    };

    ApplicationId applicationId = submitApp.run(args);

    YarnApplicationState state = waitState(applicationId, 60, TimeUnit.SECONDS, YarnApplicationState.FINISHED, YarnApplicationState.FAILED);
    assertThat(state, is(YarnApplicationState.FINISHED));
  }
View Full Code Here


    when(status.getExitStatus()).thenReturn(exitStatus);
    return status;
  }

  public static ApplicationId getMockApplicationId(int appId) {
    ApplicationId applicationId = mock(ApplicationId.class);
    when(applicationId.getClusterTimestamp()).thenReturn(0L);
    when(applicationId.getId()).thenReturn(appId);
    return applicationId;
  }
View Full Code Here

    when(pri.getPriority()).thenReturn(priority);
    return pri;
  }

  public static ApplicationAttemptId getMockApplicationAttemptId(int appId, int attemptId) {
    ApplicationId applicationId = mock(ApplicationId.class);
    when(applicationId.getClusterTimestamp()).thenReturn(0L);
    when(applicationId.getId()).thenReturn(appId);
    ApplicationAttemptId applicationAttemptId = mock(ApplicationAttemptId.class);
    when(applicationAttemptId.getApplicationId()).thenReturn(applicationId);
    when(applicationAttemptId.getAttemptId()).thenReturn(attemptId);
    return applicationAttemptId;
  }
View Full Code Here

    String[] submitArgs = new String[]{
        "--spring.yarn.client.clientClass=org.springframework.yarn.client.DefaultApplicationYarnClient",
        "--spring.yarn.client.launchcontext.archiveFile=" + APPMASTER_ARCHIVE
    };

    ApplicationId applicationId = submitApp.run(submitArgs);

    YarnApplicationState state = waitState(applicationId, 60, TimeUnit.SECONDS, YarnApplicationState.FINISHED,
        YarnApplicationState.FAILED, YarnApplicationState.RUNNING);
    assertThat(state, is(YarnApplicationState.RUNNING));

    // kill
    YarnKillApplication killApp = new YarnKillApplication();
    killApp.appProperties(appProperties);

    String[] killArgs = new String[]{
        "--spring.yarn.internal.YarnKillApplication.applicationId=" + applicationId.toString()
    };

    String info = killApp.run(killArgs);
    assertThat(info, containsString("Kill request for"));
  }
View Full Code Here

  private void doSubmitAndAssert() throws Exception {
    YarnClient client = (YarnClient) ctx.getBean("yarnClient");
    assertThat(client, notNullValue());

    ApplicationId applicationId = client.submitApplication();
    assertThat(applicationId, notNullValue());

    YarnApplicationState state = null;
    for (int i = 0; i<120; i++) {
      state = findState(client, applicationId);
      if (state == null) {
        break;
      }
      if (state.equals(YarnApplicationState.FINISHED) || state.equals(YarnApplicationState.FAILED)) {
        break;
      }
      Thread.sleep(1000);
    }
    assertThat(state, notNullValue());

    YarnCluster cluster = (YarnCluster) ctx.getBean("yarnCluster");
    File testWorkDir = cluster.getYarnWorkDir();

    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    String locationPattern = "file:" + testWorkDir.getAbsolutePath() + "/**/" + applicationId.toString() + "/**/*.std*";
    Resource[] resources = resolver.getResources(locationPattern);

    // get possible appmaster error from stderr file
    StringBuilder masterFailReason = new StringBuilder();
    for (Resource res : resources) {
View Full Code Here

      @Override
      public String runWithSpringApplication(ApplicationContext context) throws Exception {
        OperationProperties operationProperties = context.getBean(OperationProperties.class);
        YarnClient client = context.getBean(YarnClient.class);
        ApplicationId applicationId = ConverterUtils.toApplicationId(operationProperties.getApplicationId());
        String clusterId = operationProperties.getClusterId();
        String clusterDef = operationProperties.getClusterDef();
        String projectionType = operationProperties.getProjectionType();
        Integer projectionDataAny = operationProperties.getProjectionDataAny();
        Map<String, Integer> projectionDataHosts = operationProperties.getProjectionDataHosts();
View Full Code Here

      @Override
      public String runWithSpringApplication(ApplicationContext context) throws Exception {
        YarnClient client = context.getBean(YarnClient.class);
        OperationProperties operationProperties = context.getBean(OperationProperties.class);
        ApplicationId applicationId = ConverterUtils.toApplicationId(operationProperties.getApplicationId());
        ApplicationReport report = client.getApplicationReport(applicationId);
        if (report.getYarnApplicationState() == YarnApplicationState.FINISHED
            || report.getYarnApplicationState() == YarnApplicationState.KILLED
            || report.getYarnApplicationState() == YarnApplicationState.FAILED) {
          return "Application " + applicationId + " is not running";
View Full Code Here

   *
   * @param appId the app id
   * @return mocked {@link ApplicationId}
   */
  public static ApplicationId getMockApplicationId(int appId) {
    ApplicationId applicationId = mock(ApplicationId.class);
    when(applicationId.getClusterTimestamp()).thenReturn(0L);
    when(applicationId.getId()).thenReturn(appId);
    return applicationId;
  }
View Full Code Here

   * @param appId the app id
   * @param attemptId the app attempt id
   * @return mocked {@link ApplicationAttemptId}
   */
  public static ApplicationAttemptId getMockApplicationAttemptId(int appId, int attemptId) {
    ApplicationId applicationId = mock(ApplicationId.class);
    when(applicationId.getClusterTimestamp()).thenReturn(0L);
    when(applicationId.getId()).thenReturn(appId);
    ApplicationAttemptId applicationAttemptId = mock(ApplicationAttemptId.class);
    when(applicationAttemptId.getApplicationId()).thenReturn(applicationId);
    when(applicationAttemptId.getAttemptId()).thenReturn(attemptId);
    return applicationAttemptId;
  }
View Full Code Here

   * @throws YarnException
   * @throws IOException
   */
  private void killApplication(String applicationId) throws YarnException,
      IOException {
    ApplicationId appId = ConverterUtils.toApplicationId(applicationId);
    ApplicationReport  appReport = null;
    try {
      appReport = client.getApplicationReport(appId);
    } catch (ApplicationNotFoundException e) {
      sysout.println("Application with id '" + applicationId +
View Full Code Here

TOP

Related Classes of org.apache.hadoop.yarn.api.records.ApplicationId

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.