Package org.apache.hadoop.yarn.logaggregation

Examples of org.apache.hadoop.yarn.logaggregation.LogCLIHelpers


  @Test(timeout = 5000l)
  public void testFailResultCodes() throws Exception {
    Configuration conf = new YarnConfiguration();
    conf.setClass("fs.file.impl", LocalFileSystem.class, FileSystem.class);
    LogCLIHelpers cliHelper = new LogCLIHelpers();
    cliHelper.setConf(conf);
    YarnClient mockYarnClient = createMockYarnClient(YarnApplicationState.FINISHED);
    LogsCLI dumper = new LogsCLIForTest(mockYarnClient);
    dumper.setConf(conf);
   
    // verify dumping a non-existent application's logs returns a failure code
    int exitCode = dumper.run( new String[] {
        "-applicationId", "application_0_0" } );
    assertTrue("Should return an error code", exitCode != 0);
   
    // verify dumping a non-existent container log is a failure code
    exitCode = cliHelper.dumpAContainersLogs("application_0_0", "container_0_0",
        "nonexistentnode:1234", "nobody");
    assertTrue("Should return an error code", exitCode != 0);
  }
View Full Code Here


      } else if (logs) {
        try {
        JobID jobID = JobID.forName(jobid);
        TaskAttemptID taskAttemptID = TaskAttemptID.forName(taskid);
        LogParams logParams = cluster.getLogParams(jobID, taskAttemptID);
        LogCLIHelpers logDumper = new LogCLIHelpers();
        logDumper.setConf(getConf());
        exitCode = logDumper.dumpAContainersLogs(logParams.getApplicationId(),
            logParams.getContainerId(), logParams.getNodeId(),
            logParams.getOwner());
        } catch (IOException e) {
          if (e instanceof RemoteException) {
            throw e;
View Full Code Here

  @Test(timeout = 5000l)
  public void testFailResultCodes() throws Exception {
    Configuration conf = new YarnConfiguration();
    conf.setClass("fs.file.impl", LocalFileSystem.class, FileSystem.class);
    LogCLIHelpers cliHelper = new LogCLIHelpers();
    cliHelper.setConf(conf);
    YarnClient mockYarnClient = createMockYarnClient(YarnApplicationState.FINISHED);
    LogsCLI dumper = new LogsCLIForTest(mockYarnClient);
    dumper.setConf(conf);
   
    // verify dumping a non-existent application's logs returns a failure code
    int exitCode = dumper.run( new String[] {
        "-applicationId", "application_0_0" } );
    assertTrue("Should return an error code", exitCode != 0);
   
    // verify dumping a non-existent container log is a failure code
    exitCode = cliHelper.dumpAContainersLogs("application_0_0", "container_0_0",
        "nonexistentnode:1234", "nobody");
    assertTrue("Should return an error code", exitCode != 0);
  }
View Full Code Here

      } else if (logs) {
        try {
        JobID jobID = JobID.forName(jobid);
        TaskAttemptID taskAttemptID = TaskAttemptID.forName(taskid);
        LogParams logParams = cluster.getLogParams(jobID, taskAttemptID);
        LogCLIHelpers logDumper = new LogCLIHelpers();
        logDumper.setConf(getConf());
        exitCode = logDumper.dumpAContainersLogs(logParams.getApplicationId(),
            logParams.getContainerId(), logParams.getNodeId(),
            logParams.getOwner());
        } catch (IOException e) {
          if (e instanceof RemoteException) {
            throw e;
View Full Code Here

    } catch (Exception e) {
      System.err.println("Unable to get ApplicationState." +
          " Attempting to fetch logs directly from the filesystem.");
    }

    LogCLIHelpers logCliHelper = new LogCLIHelpers();
    logCliHelper.setConf(getConf());
   
    if (appOwner == null || appOwner.isEmpty()) {
      appOwner = UserGroupInformation.getCurrentUser().getShortUserName();
    }
    int resultCode = 0;
    if (containerIdStr == null && nodeAddress == null) {
      resultCode = logCliHelper.dumpAllContainersLogs(appId, appOwner, System.out);
    } else if ((containerIdStr == null && nodeAddress != null)
        || (containerIdStr != null && nodeAddress == null)) {
      System.out.println("ContainerId or NodeAddress cannot be null!");
      printHelpMessage(printOpts);
      resultCode = -1;
    } else {
      Path remoteRootLogDir =
        new Path(getConf().get(YarnConfiguration.NM_REMOTE_APP_LOG_DIR,
            YarnConfiguration.DEFAULT_NM_REMOTE_APP_LOG_DIR));
      AggregatedLogFormat.LogReader reader =
          new AggregatedLogFormat.LogReader(getConf(),
              LogAggregationUtils.getRemoteNodeLogFileForApp(
                  remoteRootLogDir,
                  appId,
                  appOwner,
                  ConverterUtils.toNodeId(nodeAddress),
                  LogAggregationUtils.getRemoteNodeLogDirSuffix(getConf())));
      resultCode = logCliHelper.dumpAContainerLogs(containerIdStr, reader, System.out);
    }

    return resultCode;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.yarn.logaggregation.LogCLIHelpers

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.