forked from apache/storm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'STORM-2792' of https://github.com/revans2/incubator-storm…
… into STORM-2792 STORM-2792: Remove RAS EvictionPolicy and cleanup This closes apache#2400
Showing
25 changed files
with
911 additions
and
705 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
storm-server/src/main/java/org/apache/storm/scheduler/SupervisorResources.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.storm.scheduler; | ||
|
||
import org.apache.storm.generated.WorkerResources; | ||
|
||
public class SupervisorResources { | ||
private final double totalMem; | ||
private final double totalCpu; | ||
private final double usedMem; | ||
private final double usedCpu; | ||
|
||
/** | ||
* Constructor for a Supervisor's resources. | ||
* | ||
* @param totalMem the total mem on the supervisor | ||
* @param totalCpu the total CPU on the supervisor | ||
* @param usedMem the used mem on the supervisor | ||
* @param usedCpu the used CPU on the supervisor | ||
*/ | ||
public SupervisorResources(double totalMem, double totalCpu, double usedMem, double usedCpu) { | ||
this.totalMem = totalMem; | ||
this.totalCpu = totalCpu; | ||
this.usedMem = usedMem; | ||
this.usedCpu = usedCpu; | ||
} | ||
|
||
public double getUsedMem() { | ||
return usedMem; | ||
} | ||
|
||
public double getUsedCpu() { | ||
return usedCpu; | ||
} | ||
|
||
public double getTotalMem() { | ||
return totalMem; | ||
} | ||
|
||
public double getTotalCpu() { | ||
return totalCpu; | ||
} | ||
|
||
public double getAvailableCpu() { | ||
return totalCpu - usedCpu; | ||
} | ||
|
||
public double getAvailableMem() { | ||
return totalMem - usedMem; | ||
} | ||
|
||
SupervisorResources add(WorkerResources wr) { | ||
return new SupervisorResources( | ||
totalMem, | ||
totalCpu, | ||
usedMem + wr.get_mem_off_heap() + wr.get_mem_on_heap(), | ||
usedCpu + wr.get_cpu()); | ||
} | ||
|
||
public SupervisorResources addMem(Double value) { | ||
return new SupervisorResources(totalMem, totalCpu, usedMem + value, usedCpu); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.