Search in sources :

Example 1 with SchedulerInfo

use of org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerInfo in project hadoop by apache.

the class RMWebServices method getSchedulerInfo.

@GET
@Path("/scheduler")
@Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8, MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8 })
public SchedulerTypeInfo getSchedulerInfo() {
    init();
    ResourceScheduler rs = rm.getResourceScheduler();
    SchedulerInfo sinfo;
    if (rs instanceof CapacityScheduler) {
        CapacityScheduler cs = (CapacityScheduler) rs;
        CSQueue root = cs.getRootQueue();
        sinfo = new CapacitySchedulerInfo(root, cs);
    } else if (rs instanceof FairScheduler) {
        FairScheduler fs = (FairScheduler) rs;
        sinfo = new FairSchedulerInfo(fs);
    } else if (rs instanceof FifoScheduler) {
        sinfo = new FifoSchedulerInfo(this.rm);
    } else {
        throw new NotFoundException("Unknown scheduler configured");
    }
    return new SchedulerTypeInfo(sinfo);
}
Also used : FairSchedulerInfo(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FairSchedulerInfo) CapacitySchedulerInfo(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.CapacitySchedulerInfo) FifoSchedulerInfo(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FifoSchedulerInfo) SchedulerInfo(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerInfo) SchedulerTypeInfo(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerTypeInfo) FairScheduler(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler) CapacitySchedulerInfo(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.CapacitySchedulerInfo) FairSchedulerInfo(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FairSchedulerInfo) NotFoundException(org.apache.hadoop.yarn.webapp.NotFoundException) ResourceScheduler(org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler) FifoScheduler(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fifo.FifoScheduler) FifoSchedulerInfo(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FifoSchedulerInfo) CapacityScheduler(org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler) CSQueue(org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CSQueue) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 2 with SchedulerInfo

use of org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerInfo in project hadoop by apache.

the class MetricsOverviewTable method render.

@Override
protected void render(Block html) {
    //Yes this is a hack, but there is no other way to insert
    //CSS in the correct spot
    html.style(".metrics {margin-bottom:5px}");
    ClusterMetricsInfo clusterMetrics = new ClusterMetricsInfo(this.rm);
    DIV<Hamlet> div = html.div().$class("metrics");
    div.h3("Cluster Metrics").table("#metricsoverview").thead().$class("ui-widget-header").tr().th().$class("ui-state-default")._("Apps Submitted")._().th().$class("ui-state-default")._("Apps Pending")._().th().$class("ui-state-default")._("Apps Running")._().th().$class("ui-state-default")._("Apps Completed")._().th().$class("ui-state-default")._("Containers Running")._().th().$class("ui-state-default")._("Memory Used")._().th().$class("ui-state-default")._("Memory Total")._().th().$class("ui-state-default")._("Memory Reserved")._().th().$class("ui-state-default")._("VCores Used")._().th().$class("ui-state-default")._("VCores Total")._().th().$class("ui-state-default")._("VCores Reserved")._()._()._().tbody().$class("ui-widget-content").tr().td(String.valueOf(clusterMetrics.getAppsSubmitted())).td(String.valueOf(clusterMetrics.getAppsPending())).td(String.valueOf(clusterMetrics.getAppsRunning())).td(String.valueOf(clusterMetrics.getAppsCompleted() + clusterMetrics.getAppsFailed() + clusterMetrics.getAppsKilled())).td(String.valueOf(clusterMetrics.getContainersAllocated())).td(StringUtils.byteDesc(clusterMetrics.getAllocatedMB() * BYTES_IN_MB)).td(StringUtils.byteDesc(clusterMetrics.getTotalMB() * BYTES_IN_MB)).td(StringUtils.byteDesc(clusterMetrics.getReservedMB() * BYTES_IN_MB)).td(String.valueOf(clusterMetrics.getAllocatedVirtualCores())).td(String.valueOf(clusterMetrics.getTotalVirtualCores())).td(String.valueOf(clusterMetrics.getReservedVirtualCores()))._()._()._();
    div.h3("Cluster Nodes Metrics").table("#nodemetricsoverview").thead().$class("ui-widget-header").tr().th().$class("ui-state-default")._("Active Nodes")._().th().$class("ui-state-default")._("Decommissioning Nodes")._().th().$class("ui-state-default")._("Decommissioned Nodes")._().th().$class("ui-state-default")._("Lost Nodes")._().th().$class("ui-state-default")._("Unhealthy Nodes")._().th().$class("ui-state-default")._("Rebooted Nodes")._().th().$class("ui-state-default")._("Shutdown Nodes")._()._()._().tbody().$class("ui-widget-content").tr().td().a(url("nodes"), String.valueOf(clusterMetrics.getActiveNodes()))._().td().a(url("nodes/decommissioning"), String.valueOf(clusterMetrics.getDecommissioningNodes()))._().td().a(url("nodes/decommissioned"), String.valueOf(clusterMetrics.getDecommissionedNodes()))._().td().a(url("nodes/lost"), String.valueOf(clusterMetrics.getLostNodes()))._().td().a(url("nodes/unhealthy"), String.valueOf(clusterMetrics.getUnhealthyNodes()))._().td().a(url("nodes/rebooted"), String.valueOf(clusterMetrics.getRebootedNodes()))._().td().a(url("nodes/shutdown"), String.valueOf(clusterMetrics.getShutdownNodes()))._()._()._()._();
    String user = request().getRemoteUser();
    if (user != null) {
        UserMetricsInfo userMetrics = new UserMetricsInfo(this.rm, user);
        if (userMetrics.metricsAvailable()) {
            div.h3("User Metrics for " + user).table("#usermetricsoverview").thead().$class("ui-widget-header").tr().th().$class("ui-state-default")._("Apps Submitted")._().th().$class("ui-state-default")._("Apps Pending")._().th().$class("ui-state-default")._("Apps Running")._().th().$class("ui-state-default")._("Apps Completed")._().th().$class("ui-state-default")._("Containers Running")._().th().$class("ui-state-default")._("Containers Pending")._().th().$class("ui-state-default")._("Containers Reserved")._().th().$class("ui-state-default")._("Memory Used")._().th().$class("ui-state-default")._("Memory Pending")._().th().$class("ui-state-default")._("Memory Reserved")._().th().$class("ui-state-default")._("VCores Used")._().th().$class("ui-state-default")._("VCores Pending")._().th().$class("ui-state-default")._("VCores Reserved")._()._()._().tbody().$class("ui-widget-content").tr().td(String.valueOf(userMetrics.getAppsSubmitted())).td(String.valueOf(userMetrics.getAppsPending())).td(String.valueOf(userMetrics.getAppsRunning())).td(String.valueOf((userMetrics.getAppsCompleted() + userMetrics.getAppsFailed() + userMetrics.getAppsKilled()))).td(String.valueOf(userMetrics.getRunningContainers())).td(String.valueOf(userMetrics.getPendingContainers())).td(String.valueOf(userMetrics.getReservedContainers())).td(StringUtils.byteDesc(userMetrics.getAllocatedMB() * BYTES_IN_MB)).td(StringUtils.byteDesc(userMetrics.getPendingMB() * BYTES_IN_MB)).td(StringUtils.byteDesc(userMetrics.getReservedMB() * BYTES_IN_MB)).td(String.valueOf(userMetrics.getAllocatedVirtualCores())).td(String.valueOf(userMetrics.getPendingVirtualCores())).td(String.valueOf(userMetrics.getReservedVirtualCores()))._()._()._();
        }
    }
    SchedulerInfo schedulerInfo = new SchedulerInfo(this.rm);
    div.h3("Scheduler Metrics").table("#schedulermetricsoverview").thead().$class("ui-widget-header").tr().th().$class("ui-state-default")._("Scheduler Type")._().th().$class("ui-state-default")._("Scheduling Resource Type")._().th().$class("ui-state-default")._("Minimum Allocation")._().th().$class("ui-state-default")._("Maximum Allocation")._().th().$class("ui-state-default")._("Maximum Cluster Application Priority")._()._()._().tbody().$class("ui-widget-content").tr().td(String.valueOf(schedulerInfo.getSchedulerType())).td(String.valueOf(schedulerInfo.getSchedulerResourceTypes())).td(schedulerInfo.getMinAllocation().toString()).td(schedulerInfo.getMaxAllocation().toString()).td(String.valueOf(schedulerInfo.getMaxClusterLevelAppPriority()))._()._()._();
    div._();
}
Also used : Hamlet(org.apache.hadoop.yarn.webapp.hamlet.Hamlet) SchedulerInfo(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerInfo) ClusterMetricsInfo(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo) UserMetricsInfo(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.UserMetricsInfo)

Aggregations

SchedulerInfo (org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerInfo)2 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 ResourceScheduler (org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler)1 CSQueue (org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CSQueue)1 CapacityScheduler (org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler)1 FairScheduler (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler)1 FifoScheduler (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fifo.FifoScheduler)1 CapacitySchedulerInfo (org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.CapacitySchedulerInfo)1 ClusterMetricsInfo (org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo)1 FairSchedulerInfo (org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FairSchedulerInfo)1 FifoSchedulerInfo (org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FifoSchedulerInfo)1 SchedulerTypeInfo (org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerTypeInfo)1 UserMetricsInfo (org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.UserMetricsInfo)1 NotFoundException (org.apache.hadoop.yarn.webapp.NotFoundException)1 Hamlet (org.apache.hadoop.yarn.webapp.hamlet.Hamlet)1