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


Java RMAuditLogger类代码示例

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


RMAuditLogger类属于org.apache.hadoop.yarn.server.resourcemanager包,在下文中一共展示了RMAuditLogger类的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: createReleaseCache

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入依赖的package包/类
protected void createReleaseCache() {
  // Cleanup the cache after nm expire interval.
  new Timer().schedule(new TimerTask() {
    @Override
    public void run() {
      for (SchedulerApplication<T> app : applications.values()) {

        T attempt = app.getCurrentAppAttempt();
        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();
        }
      }
      LOG.info("Release request cache is cleaned up");
    }
  }, nmExpireInterval);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:AbstractYarnScheduler.java

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: refreshAdminAcls

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入依赖的package包/类
private RefreshAdminAclsResponse refreshAdminAcls(boolean checkRMHAState)
    throws YarnException, IOException {
  String argName = "refreshAdminAcls";
  UserGroupInformation user = checkAcls(argName);

  if (checkRMHAState) {
    checkRMStatus(user.getShortUserName(), argName, "refresh Admin ACLs.");
  }
  Configuration conf =
      getConfiguration(new Configuration(false),
          YarnConfiguration.YARN_SITE_CONFIGURATION_FILE);
  authorizer.setAdmins(getAdminAclList(conf), UserGroupInformation
      .getCurrentUser());
  RMAuditLogger.logSuccess(user.getShortUserName(), argName,
      "AdminService");

  return recordFactory.newRecordInstance(RefreshAdminAclsResponse.class);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:19,代码来源:GroupMembershipService.java

示例12: 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

示例13: containerCompleted

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入依赖的package包/类
synchronized public void containerCompleted(RMContainer rmContainer,
    ContainerStatus containerStatus, RMContainerEventType event) {
  
  Container container = rmContainer.getContainer();
  ContainerId containerId = container.getId();
  
  // Remove from the list of newly allocated containers if found
  newlyAllocatedContainers.remove(rmContainer);
  
  // Inform the container
  rmContainer.handle(
      new RMContainerFinishedEvent(
          containerId,
          containerStatus, 
          event)
      );
  LOG.info("Completed container: " + rmContainer.getContainerId() + 
      " in state: " + rmContainer.getState() + " event:" + event);
  
  // Remove from the list of containers
  liveContainers.remove(rmContainer.getContainerId());

  RMAuditLogger.logSuccess(getUser(), 
      AuditConstants.RELEASE_CONTAINER, "SchedulerApp", 
      getApplicationId(), containerId);
  
  // Update usage metrics 
  Resource containerResource = rmContainer.getContainer().getResource();
  queue.getMetrics().releaseResources(getUser(), 1, containerResource);
  this.attemptResourceUsage.decUsed(containerResource);

  // remove from preemption map if it is completed
  preemptionMap.remove(rmContainer);

  // Clear resource utilization metrics cache.
  lastMemoryAggregateAllocationUpdateTime = -1;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:38,代码来源:FSAppAttempt.java

示例14: 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

示例15: containerCompleted

import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger; //导入依赖的package包/类
synchronized public boolean containerCompleted(RMContainer rmContainer,
    ContainerStatus containerStatus, RMContainerEventType event,
    String partition) {

  // Remove from the list of containers
  if (null == liveContainers.remove(rmContainer.getContainerId())) {
    return false;
  }
  
  // Remove from the list of newly allocated containers if found
  newlyAllocatedContainers.remove(rmContainer);

  Container container = rmContainer.getContainer();
  ContainerId containerId = container.getId();

  // Inform the container
  rmContainer.handle(
      new RMContainerFinishedEvent(containerId, containerStatus, event));

  containersToPreempt.remove(rmContainer.getContainerId());

  RMAuditLogger.logSuccess(getUser(),
      AuditConstants.RELEASE_CONTAINER, "SchedulerApp",
      getApplicationId(), containerId);
  
  // Update usage metrics 
  Resource containerResource = rmContainer.getContainer().getResource();
  queue.getMetrics().releaseResources(getUser(), 1, containerResource);
  attemptResourceUsage.decUsed(partition, containerResource);

  // Clear resource utilization metrics cache.
  lastMemoryAggregateAllocationUpdateTime = -1;

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


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