当前位置: 首页>>代码示例>>Java>>正文


Java RMAuditLogger.logFailure方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger.logFailure方法的典型用法代码示例。如果您正苦于以下问题:Java RMAuditLogger.logFailure方法的具体用法?Java RMAuditLogger.logFailure怎么用?Java RMAuditLogger.logFailure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger的用法示例。


在下文中一共展示了RMAuditLogger.logFailure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAppState

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
@GET
@Path("/apps/{appid}/state")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public AppState getAppState(@Context HttpServletRequest hsr,
    @PathParam("appid") String appId) throws AuthorizationException {
  init();
  UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
  String userName = "";
  if (callerUGI != null) {
    userName = callerUGI.getUserName();
  }
  RMApp app = null;
  try {
    app = getRMAppForAppId(appId);
  } catch (NotFoundException e) {
    RMAuditLogger.logFailure(userName, AuditConstants.KILL_APP_REQUEST,
      "UNKNOWN", "RMWebService",
      "Trying to get state of an absent application " + appId);
    throw e;
  }

  AppState ret = new AppState();
  ret.setState(app.getState().toString());

  return ret;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:RMWebServices.java

示例2: getAppQueue

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
@GET
@Path("/apps/{appid}/queue")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public AppQueue getAppQueue(@Context HttpServletRequest hsr,
    @PathParam("appid") String appId) throws AuthorizationException {
  init();
  UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
  String userName = "UNKNOWN-USER";
  if (callerUGI != null) {
    userName = callerUGI.getUserName();
  }
  RMApp app = null;
  try {
    app = getRMAppForAppId(appId);
  } catch (NotFoundException e) {
    RMAuditLogger.logFailure(userName, AuditConstants.KILL_APP_REQUEST,
      "UNKNOWN", "RMWebService",
      "Trying to get state of an absent application " + appId);
    throw e;
  }

  AppQueue ret = new AppQueue();
  ret.setQueue(app.getQueue());

  return ret;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:RMWebServices.java

示例3: releaseContainers

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
protected void releaseContainers(List<ContainerId> containers,
    SchedulerApplicationAttempt attempt) {
  for (ContainerId containerId : containers) {
    RMContainer rmContainer = getRMContainer(containerId);
    if (rmContainer == null) {
      if (System.currentTimeMillis() - ResourceManager.getClusterTimeStamp()
          < nmExpireInterval) {
        LOG.info(containerId + " doesn't exist. Add the container"
            + " to the release request cache as it maybe on recovery.");
        synchronized (attempt) {
          attempt.getPendingRelease().add(containerId);
        }
      } else {
        RMAuditLogger.logFailure(attempt.getUser(),
          AuditConstants.RELEASE_CONTAINER,
          "Unauthorized access or invalid container", "Scheduler",
          "Trying to release container not owned by app or with invalid id.",
          attempt.getApplicationId(), containerId);
      }
    }
    completedContainer(rmContainer,
      SchedulerUtils.createAbnormalContainerStatus(containerId,
        SchedulerUtils.RELEASED_CONTAINER), RMContainerEventType.RELEASED);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:AbstractYarnScheduler.java

示例4: clearPendingContainerCache

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
@VisibleForTesting
public void clearPendingContainerCache() {
  for (SchedulerApplication<T> app : applications.values()) {
    T attempt = app.getCurrentAppAttempt();
    if (attempt != null) {
      synchronized (attempt) {
        for (ContainerId containerId : attempt.getPendingRelease()) {
          RMAuditLogger.logFailure(app.getUser(),
              AuditConstants.RELEASE_CONTAINER,
              "Unauthorized access or invalid container", "Scheduler",
              "Trying to release container not owned by app "
                  + "or with invalid id.", attempt.getApplicationId(),
              containerId);
        }
        attempt.getPendingRelease().clear();
      }
    }
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:20,代码来源:AbstractYarnScheduler.java

示例5: getAppState

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
@GET
@Path("/apps/{appid}/state")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public AppState getAppState(@Context HttpServletRequest hsr,
    @PathParam("appid") String appId) throws AuthorizationException {
  init();
  UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
  String userName = "";
  if (callerUGI != null) {
    userName = callerUGI.getUserName();
  }
  RMApp app = null;
  try {
    app = getRMAppForAppId(appId);
  } catch (NotFoundException e) {
    RMAuditLogger.logFailure(userName, AuditConstants.GET_APP_STATE,
      "UNKNOWN", "RMWebService",
      "Trying to get state of an absent application " + appId);
    throw e;
  }

  AppState ret = new AppState();
  ret.setState(app.getState().toString());

  return ret;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:27,代码来源:RMWebServices.java

示例6: getAppQueue

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
@GET
@Path("/apps/{appid}/queue")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public AppQueue getAppQueue(@Context HttpServletRequest hsr,
    @PathParam("appid") String appId) throws AuthorizationException {
  init();
  UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
  String userName = "UNKNOWN-USER";
  if (callerUGI != null) {
    userName = callerUGI.getUserName();
  }
  RMApp app = null;
  try {
    app = getRMAppForAppId(appId);
  } catch (NotFoundException e) {
    RMAuditLogger.logFailure(userName, AuditConstants.GET_APP_QUEUE,
      "UNKNOWN", "RMWebService",
      "Trying to get queue of an absent application " + appId);
    throw e;
  }

  AppQueue ret = new AppQueue();
  ret.setQueue(app.getQueue());

  return ret;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:27,代码来源:RMWebServices.java

示例7: validateReservation

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
private Plan validateReservation(ReservationSystem reservationSystem,
    ReservationId reservationId, String auditConstant) throws YarnException {
  // check if the reservation id is valid
  if (reservationId == null) {
    String message =
        "Missing reservation id."
            + " Please try again by specifying a reservation id.";
    RMAuditLogger.logFailure("UNKNOWN", auditConstant,
        "validate reservation input", "ClientRMService", message);
    throw RPCUtil.getRemoteException(message);
  }
  String queue = reservationSystem.getQueueForReservation(reservationId);
  String nullQueueErrorMessage =
          "The specified reservation with ID: " + reservationId
                  + " is unknown. Please try again with a valid reservation.";
  String nullPlanErrorMessage = "The specified reservation: " + reservationId
                          + " is not associated with any valid plan."
                          + " Please try again with a valid reservation.";
  return getPlanFromQueue(reservationSystem, queue, auditConstant,
          nullQueueErrorMessage, nullPlanErrorMessage);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:22,代码来源:ReservationInputValidator.java

示例8: getPlanFromQueue

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
private Plan getPlanFromQueue(ReservationSystem reservationSystem, String
        queue, String auditConstant, String nullQueueErrorMessage,
        String nullPlanErrorMessage) throws YarnException {
  if (queue == null || queue.isEmpty()) {
    RMAuditLogger.logFailure("UNKNOWN", auditConstant,
            "validate reservation input", "ClientRMService",
            nullQueueErrorMessage);
    throw RPCUtil.getRemoteException(nullQueueErrorMessage);
  }
  // check if the associated plan is valid
  Plan plan = reservationSystem.getPlan(queue);
  if (plan == null) {
    RMAuditLogger.logFailure("UNKNOWN", auditConstant,
            "validate reservation input", "ClientRMService",
            nullPlanErrorMessage);
    throw RPCUtil.getRemoteException(nullPlanErrorMessage);
  }
  return plan;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:20,代码来源:ReservationInputValidator.java

示例9: validateReservationListRequest

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
/**
 * Quick validation on the input to check some obvious fail conditions (fail
 * fast) the input and returns the appropriate {@link Plan} associated with
 * the specified {@link Queue} or throws an exception message illustrating the
 * details of any validation check failures.
 *
 * @param reservationSystem the {@link ReservationSystem} to validate against
 * @param request the {@link ReservationListRequest} defining search
 *                parameters for reservations in the {@link ReservationSystem}
 *                that is being validated against.
 * @return the {@link Plan} to list reservations of.
 * @throws YarnException
 */
public Plan validateReservationListRequest(
    ReservationSystem reservationSystem,
    ReservationListRequest request)
    throws YarnException {
  String queue = request.getQueue();
  if (request.getEndTime() < request.getStartTime()) {
    String errorMessage = "The specified end time must be greater than " +
            "the specified start time.";
    RMAuditLogger.logFailure("UNKNOWN",
            AuditConstants.LIST_RESERVATION_REQUEST,
            "validate list reservation input", "ClientRMService",
            errorMessage);
    throw RPCUtil.getRemoteException(errorMessage);
  }
  // Check if it is a managed queue
  return getPlanFromQueue(reservationSystem, queue,
          AuditConstants.LIST_RESERVATION_REQUEST);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:32,代码来源:ReservationInputValidator.java

示例10: validateReservation

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
private Plan validateReservation(ReservationSystem reservationSystem,
    ReservationId reservationId, String auditConstant) throws YarnException {
  String message = "";
  // check if the reservation id is valid
  if (reservationId == null) {
    message =
        "Missing reservation id."
            + " Please try again by specifying a reservation id.";
    RMAuditLogger.logFailure("UNKNOWN", auditConstant,
        "validate reservation input", "ClientRMService", message);
    throw RPCUtil.getRemoteException(message);
  }
  String queueName = reservationSystem.getQueueForReservation(reservationId);
  if (queueName == null) {
    message =
        "The specified reservation with ID: " + reservationId
            + " is unknown. Please try again with a valid reservation.";
    RMAuditLogger.logFailure("UNKNOWN", auditConstant,
        "validate reservation input", "ClientRMService", message);
    throw RPCUtil.getRemoteException(message);
  }
  // check if the associated plan is valid
  Plan plan = reservationSystem.getPlan(queueName);
  if (plan == null) {
    message =
        "The specified reservation: " + reservationId
            + " is not associated with any valid plan."
            + " Please try again with a valid reservation.";
    RMAuditLogger.logFailure("UNKNOWN", auditConstant,
        "validate reservation input", "ClientRMService", message);
    throw RPCUtil.getRemoteException(message);
  }
  return plan;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:ReservationInputValidator.java

示例11: getAppPriority

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
@GET
@Path("/apps/{appid}/priority")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public AppPriority getAppPriority(@Context HttpServletRequest hsr,
    @PathParam("appid") String appId) throws AuthorizationException {
  init();
  UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
  String userName = "UNKNOWN-USER";
  if (callerUGI != null) {
    userName = callerUGI.getUserName();
  }
  RMApp app = null;
  try {
    app = getRMAppForAppId(appId);
  } catch (NotFoundException e) {
    RMAuditLogger.logFailure(userName, AuditConstants.KILL_APP_REQUEST,
        "UNKNOWN", "RMWebService",
        "Trying to get state of an absent application " + appId);
    throw e;
  }

  AppPriority ret = new AppPriority();
  ret.setPriority(
      app.getApplicationSubmissionContext().getPriority().getPriority());

  return ret;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:28,代码来源:RMWebServices.java

示例12: releaseContainers

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
protected void releaseContainers(List<ContainerId> containers,
    SchedulerApplicationAttempt attempt) {
  for (ContainerId containerId : containers) {
    RMContainer rmContainer = getRMContainer(containerId);
    if (rmContainer == null) {
      if (System.currentTimeMillis() - ResourceManager.getClusterTimeStamp()
          < nmExpireInterval) {
        LOG.info(containerId + " doesn't exist. Add the container"
            + " to the release request cache as it maybe on recovery.");
        synchronized (attempt) {
          attempt.getPendingRelease().add(containerId);
        }
      } else {
        RMAuditLogger.logFailure(attempt.getUser(),
          AuditConstants.RELEASE_CONTAINER,
          "Unauthorized access or invalid container", "Scheduler",
          "Trying to release container not owned by app or with invalid id.",
          attempt.getApplicationId(), containerId);
      }
    }
    
    LOG.info("Container FINISHED by AbstractYarnScheduler by releaseContainers: " + containerId);
    completedContainer(rmContainer,
      SchedulerUtils.createAbnormalContainerStatus(containerId,
        SchedulerUtils.RELEASED_CONTAINER), RMContainerEventType.RELEASED);
  }
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:28,代码来源:AbstractYarnScheduler.java

示例13: getAppPriority

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
@GET
@Path("/apps/{appid}/priority")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public AppPriority getAppPriority(@Context HttpServletRequest hsr,
    @PathParam("appid") String appId) throws AuthorizationException {
  init();
  UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
  String userName = "UNKNOWN-USER";
  if (callerUGI != null) {
    userName = callerUGI.getUserName();
  }
  RMApp app = null;
  try {
    app = getRMAppForAppId(appId);
  } catch (NotFoundException e) {
    RMAuditLogger.logFailure(userName, AuditConstants.GET_APP_PRIORITY,
        "UNKNOWN", "RMWebService",
        "Trying to get priority of an absent application " + appId);
    throw e;
  }

  AppPriority ret = new AppPriority();
  ret.setPriority(
      app.getApplicationSubmissionContext().getPriority().getPriority());

  return ret;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:28,代码来源:RMWebServices.java

示例14: checkRMStatus

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
private void checkRMStatus(String user, String argName, String msg)
    throws StandbyException {
  if (!isRMActive()) {
    RMAuditLogger.logFailure(user, argName, "", 
        "AdminService", "ResourceManager is not active. Can not " + msg);
    throwStandbyException();
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:9,代码来源:GroupMembershipService.java

示例15: updateApplicationPriority

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入方法依赖的package包/类
@PUT
@Path("/apps/{appid}/priority")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response updateApplicationPriority(AppPriority targetPriority,
    @Context HttpServletRequest hsr, @PathParam("appid") String appId)
    throws AuthorizationException, YarnException, InterruptedException,
        IOException {
  init();
  if (targetPriority == null) {
    throw new YarnException("Target Priority cannot be null");
  }

  UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
  if (callerUGI == null) {
    throw new AuthorizationException(
        "Unable to obtain user name, user not authenticated");
  }

  if (UserGroupInformation.isSecurityEnabled() && isStaticUser(callerUGI)) {
    return Response.status(Status.FORBIDDEN)
        .entity("The default static user cannot carry out this operation.")
        .build();
  }

  String userName = callerUGI.getUserName();
  RMApp app = null;
  try {
    app = getRMAppForAppId(appId);
  } catch (NotFoundException e) {
    RMAuditLogger.logFailure(userName, AuditConstants.KILL_APP_REQUEST,
        "UNKNOWN", "RMWebService",
        "Trying to move an absent application " + appId);
    throw e;
  }
  Priority priority = app.getApplicationSubmissionContext().getPriority();
  if (priority == null
      || priority.getPriority() != targetPriority.getPriority()) {
    return modifyApplicationPriority(app, callerUGI,
        targetPriority.getPriority());
  }
  return Response.status(Status.OK).entity(targetPriority).build();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:44,代码来源:RMWebServices.java


注:本文中的org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger.logFailure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。