blob: 453433efc9fb5612b2476cf03d0671a48d5bfa7e [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>NormalizedResources (Storm 2.4.0 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="NormalizedResources (Storm 2.4.0 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":9,"i13":10,"i14":10,"i15":10};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/NormalizedResources.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResourceRequest.html" title="class in org.apache.storm.scheduler.resource.normalization"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResourcesWithMemory.html" title="interface in org.apache.storm.scheduler.resource.normalization"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" target="_top">Frames</a></li>
<li><a href="NormalizedResources.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.storm.scheduler.resource.normalization</div>
<h2 title="Class NormalizedResources" class="title">Class NormalizedResources</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.storm.scheduler.resource.normalization.NormalizedResources</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">NormalizedResources</span>
extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block"><p>Resources that have been normalized. This class is intended as a delegate for more specific types of normalized resource set, since it does not keep track of memory as a resource.</p></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../../org/apache/storm/scheduler/resource/normalization/ResourceNameNormalizer.html" title="class in org.apache.storm.scheduler.resource.normalization">ResourceNameNormalizer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#RESOURCE_NAME_NORMALIZER">RESOURCE_NAME_NORMALIZER</a></span></code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#NormalizedResources-java.util.Map-">NormalizedResources</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html?is-external=true" title="class or interface in java.lang">Double</a>&gt;&nbsp;normalizedResources)</code>
<div class="block">Create a new normalized set of resources.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#NormalizedResources-org.apache.storm.scheduler.resource.normalization.NormalizedResources-">NormalizedResources</a></span>(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other)</code>
<div class="block">Copy constructor.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#add-org.apache.storm.scheduler.resource.normalization.NormalizedResources-">add</a></span>(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other)</code>&nbsp;</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#add-org.apache.storm.generated.WorkerResources-">add</a></span>(<a href="../../../../../../org/apache/storm/generated/WorkerResources.html" title="class in org.apache.storm.generated">WorkerResources</a>&nbsp;value)</code>
<div class="block">Add the resources from a worker to this.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#anyNonCpuOverZero--">anyNonCpuOverZero</a></span>()</code>
<div class="block">Are any of the non cpu resources positive.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#areAnyOverZero--">areAnyOverZero</a></span>()</code>
<div class="block">Are any of the resources positive.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#calculateAveragePercentageUsedBy-org.apache.storm.scheduler.resource.normalization.NormalizedResources-double-double-">calculateAveragePercentageUsedBy</a></span>(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;used,
double&nbsp;totalMemoryMb,
double&nbsp;usedMemoryMb)</code>
<div class="block">Calculate the average resource usage percentage with this being the total resources and used being the amounts used.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#calculateMinPercentageUsedBy-org.apache.storm.scheduler.resource.normalization.NormalizedResources-double-double-">calculateMinPercentageUsedBy</a></span>(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;used,
double&nbsp;totalMemoryMb,
double&nbsp;usedMemoryMb)</code>
<div class="block">Calculate the minimum resource usage percentage with this being the total resources and used being the amounts used.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#clear--">clear</a></span>()</code>
<div class="block">Set all resources to 0.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#couldHoldIgnoringSharedMemory-org.apache.storm.scheduler.resource.normalization.NormalizedResources-double-double-">couldHoldIgnoringSharedMemory</a></span>(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other,
double&nbsp;thisTotalMemoryMb,
double&nbsp;otherTotalMemoryMb)</code>
<div class="block">A simple sanity check to see if all of the resources in this would be large enough to hold the resources in other ignoring memory.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#couldHoldIgnoringSharedMemoryAndCpu-org.apache.storm.scheduler.resource.normalization.NormalizedResources-double-double-">couldHoldIgnoringSharedMemoryAndCpu</a></span>(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other,
double&nbsp;thisTotalMemoryMb,
double&nbsp;otherTotalMemoryMb)</code>
<div class="block">A simple sanity check to see if all of the resources in this would be large enough to hold the resources in other ignoring memory.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#getTotalCpu--">getTotalCpu</a></span>()</code>
<div class="block">Get the total amount of cpu.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#remove-org.apache.storm.scheduler.resource.normalization.NormalizedResources-org.apache.storm.scheduler.resource.normalization.ResourceMetrics-">remove</a></span>(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other,
<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/ResourceMetrics.html" title="class in org.apache.storm.scheduler.resource.normalization">ResourceMetrics</a>&nbsp;resourceMetrics)</code>
<div class="block">Remove the other resources from this.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#remove-org.apache.storm.generated.WorkerResources-">remove</a></span>(<a href="../../../../../../org/apache/storm/generated/WorkerResources.html" title="class in org.apache.storm.generated">WorkerResources</a>&nbsp;value)</code>
<div class="block">Remove the resources of a worker from this.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#resetResourceNames--">resetResourceNames</a></span>()</code>
<div class="block">This is for testing only.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html?is-external=true" title="class or interface in java.lang">Double</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#toNormalizedMap--">toNormalizedMap</a></span>()</code>
<div class="block">Return a Map of the normalized resource name to a double.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#toString--">toString</a></span>()</code>&nbsp;</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html#updateForRareResourceAffinity-org.apache.storm.scheduler.resource.normalization.NormalizedResources-">updateForRareResourceAffinity</a></span>(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;request)</code>
<div class="block">If a node or rack has a kind of resource not in a request, make that resource negative so when sorting that node or rack will be less likely to be selected.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="RESOURCE_NAME_NORMALIZER">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>RESOURCE_NAME_NORMALIZER</h4>
<pre>public static&nbsp;<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/ResourceNameNormalizer.html" title="class in org.apache.storm.scheduler.resource.normalization">ResourceNameNormalizer</a> RESOURCE_NAME_NORMALIZER</pre>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="NormalizedResources-org.apache.storm.scheduler.resource.normalization.NormalizedResources-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>NormalizedResources</h4>
<pre>public&nbsp;NormalizedResources(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other)</pre>
<div class="block"><p>Copy constructor.</p></div>
</li>
</ul>
<a name="NormalizedResources-java.util.Map-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>NormalizedResources</h4>
<pre>public&nbsp;NormalizedResources(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html?is-external=true" title="class or interface in java.lang">Double</a>&gt;&nbsp;normalizedResources)</pre>
<div class="block"><p>Create a new normalized set of resources. Note that memory is not managed by this class, as it is not consistent in requests vs offers because of how on heap vs off heap is used.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>normalizedResources</code> - the normalized resource map</dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="resetResourceNames--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>resetResourceNames</h4>
<pre>public static&nbsp;void&nbsp;resetResourceNames()</pre>
<div class="block"><p>This is for testing only. It allows a test to reset the static state relating to resource names. We reset the mapping because some algorithms sadly have different behavior if a resource exists or not.</p></div>
</li>
</ul>
<a name="getTotalCpu--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTotalCpu</h4>
<pre>public&nbsp;double&nbsp;getTotalCpu()</pre>
<div class="block"><p>Get the total amount of cpu.</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the amount of cpu.</dd>
</dl>
</li>
</ul>
<a name="add-org.apache.storm.scheduler.resource.normalization.NormalizedResources-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;void&nbsp;add(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other)</pre>
</li>
</ul>
<a name="add-org.apache.storm.generated.WorkerResources-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;void&nbsp;add(<a href="../../../../../../org/apache/storm/generated/WorkerResources.html" title="class in org.apache.storm.generated">WorkerResources</a>&nbsp;value)</pre>
<div class="block"><p>Add the resources from a worker to this.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>value</code> - the worker resources that should be added to this.</dd>
</dl>
</li>
</ul>
<a name="remove-org.apache.storm.scheduler.resource.normalization.NormalizedResources-org.apache.storm.scheduler.resource.normalization.ResourceMetrics-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>remove</h4>
<pre>public&nbsp;boolean&nbsp;remove(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other,
<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/ResourceMetrics.html" title="class in org.apache.storm.scheduler.resource.normalization">ResourceMetrics</a>&nbsp;resourceMetrics)</pre>
<div class="block"><p>Remove the other resources from this. This is the same as subtracting the resources in other from this.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>other</code> - the resources we want removed.</dd>
<dd><code>resourceMetrics</code> - The resource related metrics</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the resources would have gone negative, but were clamped to 0.</dd>
</dl>
</li>
</ul>
<a name="remove-org.apache.storm.generated.WorkerResources-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>remove</h4>
<pre>public&nbsp;boolean&nbsp;remove(<a href="../../../../../../org/apache/storm/generated/WorkerResources.html" title="class in org.apache.storm.generated">WorkerResources</a>&nbsp;value)</pre>
<div class="block"><p>Remove the resources of a worker from this.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>value</code> - the worker resources that should be removed from this.</dd>
</dl>
</li>
</ul>
<a name="toString--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;toString()</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></dd>
</dl>
</li>
</ul>
<a name="toNormalizedMap--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toNormalizedMap</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html?is-external=true" title="class or interface in java.lang">Double</a>&gt;&nbsp;toNormalizedMap()</pre>
<div class="block"><p>Return a Map of the normalized resource name to a double. This should only be used when returning thrift resource requests to the end user.</p></div>
</li>
</ul>
<a name="couldHoldIgnoringSharedMemory-org.apache.storm.scheduler.resource.normalization.NormalizedResources-double-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>couldHoldIgnoringSharedMemory</h4>
<pre>public&nbsp;boolean&nbsp;couldHoldIgnoringSharedMemory(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other,
double&nbsp;thisTotalMemoryMb,
double&nbsp;otherTotalMemoryMb)</pre>
<div class="block"><p>A simple sanity check to see if all of the resources in this would be large enough to hold the resources in other ignoring memory. It does not check memory because with shared memory it is beyond the scope of this.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>other</code> - the resources that we want to check if they would fit in this.</dd>
<dd><code>thisTotalMemoryMb</code> - The total memory in MB of this</dd>
<dd><code>otherTotalMemoryMb</code> - The total memory in MB of other</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if it might fit, else false if it could not possibly fit.</dd>
</dl>
</li>
</ul>
<a name="couldHoldIgnoringSharedMemoryAndCpu-org.apache.storm.scheduler.resource.normalization.NormalizedResources-double-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>couldHoldIgnoringSharedMemoryAndCpu</h4>
<pre>public&nbsp;boolean&nbsp;couldHoldIgnoringSharedMemoryAndCpu(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other,
double&nbsp;thisTotalMemoryMb,
double&nbsp;otherTotalMemoryMb)</pre>
<div class="block"><p>A simple sanity check to see if all of the resources in this would be large enough to hold the resources in other ignoring memory. It does not check memory because with shared memory it is beyond the scope of this. It also does not check CPU.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>other</code> - the resources that we want to check if they would fit in this.</dd>
<dd><code>thisTotalMemoryMb</code> - The total memory in MB of this</dd>
<dd><code>otherTotalMemoryMb</code> - The total memory in MB of other</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if it might fit, else false if it could not possibly fit.</dd>
</dl>
</li>
</ul>
<a name="calculateAveragePercentageUsedBy-org.apache.storm.scheduler.resource.normalization.NormalizedResources-double-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>calculateAveragePercentageUsedBy</h4>
<pre>public&nbsp;double&nbsp;calculateAveragePercentageUsedBy(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;used,
double&nbsp;totalMemoryMb,
double&nbsp;usedMemoryMb)</pre>
<div class="block"><p>Calculate the average resource usage percentage with this being the total resources and used being the amounts used. Used must be a subset of the total resources. If a resource in the total has a value of zero, it will be skipped in the calculation to avoid division by 0. If all resources are skipped the result is defined to be 100.0.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>used</code> - the amount of resources used.</dd>
<dd><code>totalMemoryMb</code> - The total memory in MB</dd>
<dd><code>usedMemoryMb</code> - The used memory in MB</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the average percentage used 0.0 to 100.0.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if any resource in used has a greater value than the same resource in the total, or used has generic resources that are not present in the total.</dd>
</dl>
</li>
</ul>
<a name="calculateMinPercentageUsedBy-org.apache.storm.scheduler.resource.normalization.NormalizedResources-double-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>calculateMinPercentageUsedBy</h4>
<pre>public&nbsp;double&nbsp;calculateMinPercentageUsedBy(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;used,
double&nbsp;totalMemoryMb,
double&nbsp;usedMemoryMb)</pre>
<div class="block"><p>Calculate the minimum resource usage percentage with this being the total resources and used being the amounts used. Used must be a subset of the total resources. If a resource in the total has a value of zero, it will be skipped in the calculation to avoid division by 0. If all resources are skipped the result is defined to be 100.0.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>used</code> - the amount of resources used.</dd>
<dd><code>totalMemoryMb</code> - The total memory in MB</dd>
<dd><code>usedMemoryMb</code> - The used memory in MB</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the minimum percentage used 0.0 to 100.0.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if any resource in used has a greater value than the same resource in the total, or used has generic resources that are not present in the total.</dd>
</dl>
</li>
</ul>
<a name="updateForRareResourceAffinity-org.apache.storm.scheduler.resource.normalization.NormalizedResources-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>updateForRareResourceAffinity</h4>
<pre>public&nbsp;void&nbsp;updateForRareResourceAffinity(<a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;request)</pre>
<div class="block"><p>If a node or rack has a kind of resource not in a request, make that resource negative so when sorting that node or rack will be less likely to be selected. If the resource is in the request, make that resource positive.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>request</code> - the requested resources.</dd>
</dl>
</li>
</ul>
<a name="clear--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clear</h4>
<pre>public&nbsp;void&nbsp;clear()</pre>
<div class="block"><p>Set all resources to 0.</p></div>
</li>
</ul>
<a name="areAnyOverZero--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>areAnyOverZero</h4>
<pre>public&nbsp;boolean&nbsp;areAnyOverZero()</pre>
<div class="block"><p>Are any of the resources positive.</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true of any of the resources are positive. False if they are all &lt;= 0.</dd>
</dl>
</li>
</ul>
<a name="anyNonCpuOverZero--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>anyNonCpuOverZero</h4>
<pre>public&nbsp;boolean&nbsp;anyNonCpuOverZero()</pre>
<div class="block"><p>Are any of the non cpu resources positive.</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true of any of the non cpu resources are positive. False if they are all &lt;= 0.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/NormalizedResources.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><script type="text/javascript" src="../../../../../../highlight.pack.js"></script>
<script type="text/javascript"><!--
hljs.initHighlightingOnLoad();
//--></script></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResourceRequest.html" title="class in org.apache.storm.scheduler.resource.normalization"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../../org/apache/storm/scheduler/resource/normalization/NormalizedResourcesWithMemory.html" title="interface in org.apache.storm.scheduler.resource.normalization"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/storm/scheduler/resource/normalization/NormalizedResources.html" target="_top">Frames</a></li>
<li><a href="NormalizedResources.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>