blob: 9b34aaee553bef0701ee1156d9452f7bc062bcc2 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="de">
<head>
<!-- Generated by javadoc (17) -->
<title>NormalizedResources (Storm 2.6.2 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: package: org.apache.storm.scheduler.resource.normalization, class: NormalizedResources">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../../script-dir/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="../../../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var evenRowColor = "even-row-color";
var oddRowColor = "odd-row-color";
var tableTab = "table-tab";
var activeTableTab = "active-table-tab";
var pathtoroot = "../../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">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#class">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div>
<ul class="sub-nav-list">
<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="sub-nav-list">
<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>
<div class="nav-list-search"><label for="search-input">SEARCH:</label>
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.storm.scheduler.resource.normalization</a></div>
<h1 title="Class NormalizedResources" class="title">Class NormalizedResources</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
<div class="inheritance">org.apache.storm.scheduler.resource.normalization.NormalizedResources</div>
</div>
<section class="class-description" id="class-description">
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">NormalizedResources</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div>
<div class="block">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.</div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- =========== FIELD SUMMARY =========== -->
<li>
<section class="field-summary" id="field-summary">
<h2>Field Summary</h2>
<div class="caption"><span>Fields</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Field</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>static <a href="ResourceNameNormalizer.html" title="class in org.apache.storm.scheduler.resource.normalization">ResourceNameNormalizer</a></code></div>
<div class="col-second even-row-color"><code><a href="#RESOURCE_NAME_NORMALIZER" class="member-name-link">RESOURCE_NAME_NORMALIZER</a></code></div>
<div class="col-last even-row-color">&nbsp;</div>
</div>
</section>
</li>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(java.util.Map)" class="member-name-link">NormalizedResources</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a>&lt;<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link">Double</a>&gt;&nbsp;normalizedResources)</code></div>
<div class="col-last even-row-color">
<div class="block">Create a new normalized set of resources.</div>
</div>
<div class="col-constructor-name odd-row-color"><code><a href="#%3Cinit%3E(org.apache.storm.scheduler.resource.normalization.NormalizedResources)" class="member-name-link">NormalizedResources</a><wbr>(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other)</code></div>
<div class="col-last odd-row-color">
<div class="block">Copy constructor.</div>
</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab1" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab1', 3)" class="table-tab">Static Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#add(org.apache.storm.generated.WorkerResources)" class="member-name-link">add</a><wbr>(<a href="../../../generated/WorkerResources.html" title="class in org.apache.storm.generated">WorkerResources</a>&nbsp;value)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Add the resources from a worker to this.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#add(org.apache.storm.scheduler.resource.normalization.NormalizedResources)" class="member-name-link">add</a><wbr>(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#anyNonCpuOverZero()" class="member-name-link">anyNonCpuOverZero</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Are any of the non cpu resources positive.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#areAnyOverZero()" class="member-name-link">areAnyOverZero</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Are any of the resources positive.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#calculateAveragePercentageUsedBy(org.apache.storm.scheduler.resource.normalization.NormalizedResources,double,double)" class="member-name-link">calculateAveragePercentageUsedBy</a><wbr>(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;used,
double&nbsp;totalMemoryMb,
double&nbsp;usedMemoryMb)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Calculate the average resource usage percentage with this being the total resources and used being the amounts used.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#calculateMinPercentageUsedBy(org.apache.storm.scheduler.resource.normalization.NormalizedResources,double,double)" class="member-name-link">calculateMinPercentageUsedBy</a><wbr>(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;used,
double&nbsp;totalMemoryMb,
double&nbsp;usedMemoryMb)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Calculate the minimum resource usage percentage with this being the total resources and used being the amounts used.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#clear()" class="member-name-link">clear</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Set all resources to 0.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#couldHoldIgnoringSharedMemory(org.apache.storm.scheduler.resource.normalization.NormalizedResources,double,double)" class="member-name-link">couldHoldIgnoringSharedMemory</a><wbr>(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other,
double&nbsp;thisTotalMemoryMb,
double&nbsp;otherTotalMemoryMb)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<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>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#couldHoldIgnoringSharedMemoryAndCpu(org.apache.storm.scheduler.resource.normalization.NormalizedResources,double,double)" class="member-name-link">couldHoldIgnoringSharedMemoryAndCpu</a><wbr>(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other,
double&nbsp;thisTotalMemoryMb,
double&nbsp;otherTotalMemoryMb)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<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>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getTotalCpu()" class="member-name-link">getTotalCpu</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Get the total amount of cpu.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#remove(org.apache.storm.generated.WorkerResources)" class="member-name-link">remove</a><wbr>(<a href="../../../generated/WorkerResources.html" title="class in org.apache.storm.generated">WorkerResources</a>&nbsp;value)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Remove the resources of a worker from this.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#remove(org.apache.storm.scheduler.resource.normalization.NormalizedResources,org.apache.storm.scheduler.resource.normalization.ResourceMetrics)" class="member-name-link">remove</a><wbr>(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other,
<a href="ResourceMetrics.html" title="class in org.apache.storm.scheduler.resource.normalization">ResourceMetrics</a>&nbsp;resourceMetrics)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Remove the other resources from this.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#resetResourceNames()" class="member-name-link">resetResourceNames</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">This is for testing only.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a>&lt;<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link">Double</a>&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#toNormalizedMap()" class="member-name-link">toNormalizedMap</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Return a Map of the normalized resource name to a double.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#toString()" class="member-name-link">toString</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#updateForRareResourceAffinity(org.apache.storm.scheduler.resource.normalization.NormalizedResources)" class="member-name-link">updateForRareResourceAffinity</a><wbr>(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;request)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<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>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ FIELD DETAIL =========== -->
<li>
<section class="field-details" id="field-detail">
<h2>Field Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="RESOURCE_NAME_NORMALIZER">
<h3>RESOURCE_NAME_NORMALIZER</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type"><a href="ResourceNameNormalizer.html" title="class in org.apache.storm.scheduler.resource.normalization">ResourceNameNormalizer</a></span>&nbsp;<span class="element-name">RESOURCE_NAME_NORMALIZER</span></div>
</section>
</li>
</ul>
</section>
</li>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;(org.apache.storm.scheduler.resource.normalization.NormalizedResources)">
<h3>NormalizedResources</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">NormalizedResources</span><wbr><span class="parameters">(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other)</span></div>
<div class="block">Copy constructor.</div>
</section>
</li>
<li>
<section class="detail" id="&lt;init&gt;(java.util.Map)">
<h3>NormalizedResources</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">NormalizedResources</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a>&lt;<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link">Double</a>&gt;&nbsp;normalizedResources)</span></div>
<div class="block">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.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>normalizedResources</code> - the normalized resource map</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="resetResourceNames()">
<h3>resetResourceNames</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">resetResourceNames</span>()</div>
<div class="block">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.</div>
</section>
</li>
<li>
<section class="detail" id="getTotalCpu()">
<h3>getTotalCpu</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">getTotalCpu</span>()</div>
<div class="block">Get the total amount of cpu.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the amount of cpu.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="add(org.apache.storm.scheduler.resource.normalization.NormalizedResources)">
<h3>add</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">add</span><wbr><span class="parameters">(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other)</span></div>
</section>
</li>
<li>
<section class="detail" id="add(org.apache.storm.generated.WorkerResources)">
<h3>add</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">add</span><wbr><span class="parameters">(<a href="../../../generated/WorkerResources.html" title="class in org.apache.storm.generated">WorkerResources</a>&nbsp;value)</span></div>
<div class="block">Add the resources from a worker to this.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>value</code> - the worker resources that should be added to this.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="remove(org.apache.storm.scheduler.resource.normalization.NormalizedResources,org.apache.storm.scheduler.resource.normalization.ResourceMetrics)">
<h3>remove</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">remove</span><wbr><span class="parameters">(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other,
<a href="ResourceMetrics.html" title="class in org.apache.storm.scheduler.resource.normalization">ResourceMetrics</a>&nbsp;resourceMetrics)</span></div>
<div class="block">Remove the other resources from this. This is the same as subtracting the resources in other from this.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>other</code> - the resources we want removed.</dd>
<dd><code>resourceMetrics</code> - The resource related metrics</dd>
<dt>Returns:</dt>
<dd>true if the resources would have gone negative, but were clamped to 0.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="remove(org.apache.storm.generated.WorkerResources)">
<h3>remove</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">remove</span><wbr><span class="parameters">(<a href="../../../generated/WorkerResources.html" title="class in org.apache.storm.generated">WorkerResources</a>&nbsp;value)</span></div>
<div class="block">Remove the resources of a worker from this.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>value</code> - the worker resources that should be removed from this.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="toString()">
<h3>toString</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">toString</span>()</div>
<dl class="notes">
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="toNormalizedMap()">
<h3>toNormalizedMap</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a>&lt;<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link">Double</a>&gt;</span>&nbsp;<span class="element-name">toNormalizedMap</span>()</div>
<div class="block">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.</div>
</section>
</li>
<li>
<section class="detail" id="couldHoldIgnoringSharedMemory(org.apache.storm.scheduler.resource.normalization.NormalizedResources,double,double)">
<h3>couldHoldIgnoringSharedMemory</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">couldHoldIgnoringSharedMemory</span><wbr><span class="parameters">(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other,
double&nbsp;thisTotalMemoryMb,
double&nbsp;otherTotalMemoryMb)</span></div>
<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. It
does not check memory because with shared memory it is beyond the scope of this.</div>
<dl class="notes">
<dt>Parameters:</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>Returns:</dt>
<dd>true if it might fit, else false if it could not possibly fit.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="couldHoldIgnoringSharedMemoryAndCpu(org.apache.storm.scheduler.resource.normalization.NormalizedResources,double,double)">
<h3>couldHoldIgnoringSharedMemoryAndCpu</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">couldHoldIgnoringSharedMemoryAndCpu</span><wbr><span class="parameters">(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;other,
double&nbsp;thisTotalMemoryMb,
double&nbsp;otherTotalMemoryMb)</span></div>
<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. It
does not check memory because with shared memory it is beyond the scope of this. It also does not check CPU.</div>
<dl class="notes">
<dt>Parameters:</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>Returns:</dt>
<dd>true if it might fit, else false if it could not possibly fit.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="calculateAveragePercentageUsedBy(org.apache.storm.scheduler.resource.normalization.NormalizedResources,double,double)">
<h3>calculateAveragePercentageUsedBy</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">calculateAveragePercentageUsedBy</span><wbr><span class="parameters">(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;used,
double&nbsp;totalMemoryMb,
double&nbsp;usedMemoryMb)</span></div>
<div class="block">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.</div>
<dl class="notes">
<dt>Parameters:</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>Returns:</dt>
<dd>the average percentage used 0.0 to 100.0.</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">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>
</section>
</li>
<li>
<section class="detail" id="calculateMinPercentageUsedBy(org.apache.storm.scheduler.resource.normalization.NormalizedResources,double,double)">
<h3>calculateMinPercentageUsedBy</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">calculateMinPercentageUsedBy</span><wbr><span class="parameters">(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;used,
double&nbsp;totalMemoryMb,
double&nbsp;usedMemoryMb)</span></div>
<div class="block">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.</div>
<dl class="notes">
<dt>Parameters:</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>Returns:</dt>
<dd>the minimum percentage used 0.0 to 100.0.</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">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>
</section>
</li>
<li>
<section class="detail" id="updateForRareResourceAffinity(org.apache.storm.scheduler.resource.normalization.NormalizedResources)">
<h3>updateForRareResourceAffinity</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">updateForRareResourceAffinity</span><wbr><span class="parameters">(<a href="NormalizedResources.html" title="class in org.apache.storm.scheduler.resource.normalization">NormalizedResources</a>&nbsp;request)</span></div>
<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. If the resource is in the request, make that resource positive.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>request</code> - the requested resources.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="clear()">
<h3>clear</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">clear</span>()</div>
<div class="block">Set all resources to 0.</div>
</section>
</li>
<li>
<section class="detail" id="areAnyOverZero()">
<h3>areAnyOverZero</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">areAnyOverZero</span>()</div>
<div class="block">Are any of the resources positive.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>true of any of the resources are positive. False if they are all &lt;= 0.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="anyNonCpuOverZero()">
<h3>anyNonCpuOverZero</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">anyNonCpuOverZero</span>()</div>
<div class="block">Are any of the non cpu resources positive.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>true of any of the non cpu resources are positive. False if they are all &lt;= 0.</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &#169; 2023 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>