public double getRequestedNonSharedOffHeap() { double totalMemOffHeap = 0.0; for (ExecutorDetails exec : this.getExecutors()) { Double execMem = getOffHeapMemoryRequirement(exec); if (execMem != null) { totalMemOffHeap += execMem; } } return totalMemOffHeap; }
/** * Note: The public API relevant to resource aware scheduling is unstable as of May 2015. We reserve the right to change them. * * @return the total on-heap memory requested for this topology */ public double getTotalRequestedMemOnHeap() { return getRequestedSharedOnHeap() + getRequestedNonSharedOnHeap(); }
public static void assertTopologiesNotScheduled(Cluster cluster, String... topoNames) { Topologies topologies = cluster.getTopologies(); for (String topoName : topoNames) { TopologyDetails td = topologies.getByName(topoName); assert (td != null) : topoName; String topoId = td.getId(); String status = cluster.getStatus(topoId); assert (status != null) : topoName; assert (!isStatusSuccess(status)) : topoName; assert (cluster.getAssignmentById(topoId) == null) : topoName; assert (cluster.needsSchedulingRas(td)) : topoName; } }
public static void assertTopologiesFullyScheduled(Cluster cluster, String... topoNames) { Topologies topologies = cluster.getTopologies(); for (String topoName : topoNames) { TopologyDetails td = topologies.getByName(topoName); assert (td != null) : topoName; String topoId = td.getId(); assertStatusSuccess(cluster, topoId); assert (cluster.getAssignmentById(topoId) != null) : topoName; assert (cluster.needsSchedulingRas(td) == false) : topoName; } }
public double getCpuResourceUsedByUser(ISchedulingState cluster) { double sum = 0.0; for (TopologyDetails td : cluster.getTopologies().getTopologiesOwnedBy(userId)) { SchedulerAssignment assignment = cluster.getAssignmentById(td.getId()); if (assignment != null) { TopologyResources tr = new TopologyResources(td, assignment); sum += tr.getAssignedCpu(); } } return sum; }
/** * Unassign everything for the given topology id. * * @param topoId the is of the topology to unassign */ public void unassign(String topoId) { assertValidTopologyForModification(topoId); freeSlots(getUsedSlotsByTopologyId(topoId)); }
public double getMemoryResourceRequest(ISchedulingState cluster) { double sum = 0.0; Set<TopologyDetails> topologyDetailsSet = new HashSet<>(cluster.getTopologies().getTopologiesOwnedBy(userId)); for (TopologyDetails topo : topologyDetailsSet) { sum += topo.getTotalRequestedMemOnHeap() + topo.getTotalRequestedMemOffHeap(); } return sum; }
public double getRequestedNonSharedOnHeap() { double totalMemOnHeap = 0.0; for (ExecutorDetails exec : this.getExecutors()) { Double execMem = getOnHeapMemoryRequirement(exec); if (execMem != null) { totalMemOnHeap += execMem; } } return totalMemOnHeap; }
public double getCpuResourceRequest(ISchedulingState cluster) { double sum = 0.0; Set<TopologyDetails> topologyDetailsSet = new HashSet<>(cluster.getTopologies().getTopologiesOwnedBy(userId)); for (TopologyDetails topo : topologyDetailsSet) { sum += topo.getTotalRequestedCpu(); } return sum; }
@Override public int compare(ExecutorDetails o1, ExecutorDetails o2) { return o1.getStartTask() - o2.getStartTask(); } });
@Override public String toString() { return getId(); } }
/** * free the slots. * * @param slots multiple slots to free */ public void freeSlots(Collection<WorkerSlot> slots) { if (slots != null) { for (WorkerSlot slot : slots) { freeSlot(slot); } } }
/** * Test Cluster.getAssignedMemoryForSlot with a single config value set. * @param key - the config key to set * @param value - the config value to set * @param expectedValue - the expected result */ private void singleValueTest(String key, String value, double expectedValue) { Map<String, Object> topConf = getConfig(key, value); Assert.assertEquals(expectedValue, Cluster.getAssignedMemoryForSlot(topConf), 0); }
/** * Note: The public API relevant to resource aware scheduling is unstable as of May 2015. We reserve the right to change them. * * @return the total off-heap memory requested for this topology */ public double getTotalRequestedMemOffHeap() { return getRequestedNonSharedOffHeap() + getRequestedSharedOffHeap(); }
/** * Create a new Topologies from a list of TopologyDetails. * * @param details the list of details to use. * @throws IllegalArgumentException if duplicate topology ids are found. */ public Topologies(TopologyDetails... details) { this(mkMap(details)); }
/** * Calculate the amount of shared off heap memory on a given nodes with the given assignment. * * @param nodeId the id of the node * @param assignment the current assignment * @return the amount of shared off heap memory for that node in MB */ private double calculateSharedOffHeapMemory(String nodeId, SchedulerAssignmentImpl assignment) { return calculateSharedOffHeapMemory(nodeId, assignment, null); }
public double getMemoryResourceUsedByUser(ISchedulingState cluster) { double sum = 0.0; for (TopologyDetails td : cluster.getTopologies().getTopologiesOwnedBy(userId)) { SchedulerAssignment assignment = cluster.getAssignmentById(td.getId()); if (assignment != null) { TopologyResources tr = new TopologyResources(td, assignment); sum += tr.getAssignedMemOnHeap() + tr.getAssignedMemOffHeap(); } } return sum; }