Changeset 497 for DCWoRMS/trunk/src/example
- Timestamp:
- 10/11/12 09:07:11 (13 years ago)
- Location:
- DCWoRMS/trunk/src/example
- Files:
-
- 1 deleted
- 13 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/src/example/energy/CPUEnergyEstimationPlugin.java
r477 r497 1 1 package example.energy; 2 2 3 import schedframe.resources.ResourceStatus;4 3 import schedframe.resources.computing.ComputingResource; 5 4 import schedframe.resources.computing.Processor; … … 14 13 ComputingResource resource) { 15 14 Processor cpu = (Processor)resource; 16 if(resource.getPowerInterface().getPowerState(). getName().equals(StandardPowerStateName.OFF))15 if(resource.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)) 17 16 return 0; 18 if(resource.getStatus() == ResourceStatus.BUSY)17 else { 19 18 try { 20 19 return cpu.getPowerInterface().getPowerConsumption(cpu.getPowerInterface().getPState()); 21 20 } catch (NoSuchFieldException e) { 22 return 0; 21 try { 22 return cpu.getPowerInterface().getPowerConsumption(StandardPowerStateName.ON); 23 } catch (NoSuchFieldException e1) { 24 } 23 25 } 24 else 25 return 1; 26 return 1; 27 } 28 26 29 } 27 30 28 public String getName() {29 return getClass().getName();30 }31 32 33 31 } -
DCWoRMS/trunk/src/example/energy/ComputingNodeEnergyEstimationPlugin.java
r477 r497 17 17 try{ 18 18 power = power + cpu.getPowerInterface().getRecentPowerUsage().getValue(); 19 } catch (Exception e){20 //power = power + cpu.getPowerInterface().getPowerConsumption(cpu.getPowerInterface().getPowerState());19 } catch (Exception e){ 20 21 21 } 22 22 } 23 24 23 try { 25 power +=node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState());24 power = power + node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState()); 26 25 } catch (NoSuchFieldException e) { 27 26 } … … 30 29 } 31 30 32 public String getName() {33 return getClass().getName();34 }35 31 36 32 } -
DCWoRMS/trunk/src/example/energy/DataCenterEnergyEstimationPlugin.java
r477 r497 18 18 power += (powerUsage == null ? 0 : powerUsage.getValue()); 19 19 } 20 21 //System.out.println( new DateTime() + "ENERGY CONSUMPT BY: " + resMan.getResourceName() +" IS: " + power); 20 22 21 return power; 23 22 } 24 23 25 public String getName() {26 return getClass().getName();27 }28 29 24 } -
DCWoRMS/trunk/src/example/globalplugin/BaseGlobalPlugin.java
r490 r497 46 46 } 47 47 48 public String getName() { 49 return getClass().getName(); 50 } 48 51 49 52 } -
DCWoRMS/trunk/src/example/globalplugin/GridFCFSLoadBalancingPlugin.java
r481 r497 74 74 } 75 75 76 public String getName() {77 return getClass().getName();78 }79 80 public void init(Properties properties) {81 // no extra initialization is expected.82 }83 84 76 private int findLeastLoadedResourceIdx(List<SchedulerDescription> availableResources){ 85 77 int resourceIdx = -1; -
DCWoRMS/trunk/src/example/globalplugin/GridFCFSRandomPlugin.java
r478 r497 75 75 } 76 76 77 78 public String getName() {79 return getClass().getName();80 }81 82 public void init(Properties properties) {83 // no extra initialization is expected.84 }85 86 77 } -
DCWoRMS/trunk/src/example/globalplugin/GridFCFSRoundRobinPlugin.java
r478 r497 75 75 } 76 76 77 public String getName() {78 return getClass().getName();79 }80 81 82 77 } -
DCWoRMS/trunk/src/example/localplugin/FCFSCPUFreqScalingClusterLocalPlugin.java
r493 r497 187 187 } 188 188 } 189 190 public String getName() {191 return getClass().getName();192 }193 189 194 190 } -
DCWoRMS/trunk/src/example/localplugin/FCFSClusterLocalPlugin.java
r493 r497 57 57 58 58 /****************1. Choosing particular resources to perform execution****************/ 59 Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution 2(resourceManager, task);59 Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(resourceManager, task); 60 60 if (choosenResources != null) { 61 61 addToSchedulingPlan(plan, task, choosenResources); … … 80 80 81 81 private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution( 82 ClusterResourceManager resourceManager, TaskInterface<?> task) {83 84 Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>();85 86 int cpuRequest;87 try {88 cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();89 } catch (NoSuchFieldException e) {90 cpuRequest = 1;91 }92 93 if (cpuRequest != 0) {94 List<ComputingResource> choosenResources = null;95 List<Processor> processors = null;96 processors = resourceManager.getProcessors();97 if (processors.size() < cpuRequest) {98 // log.warn("Task requires more cpus than is availiable in this resource.");99 return null;100 }101 102 choosenResources = new ArrayList<ComputingResource>();103 104 for (int i = 0; i < processors.size() && cpuRequest > 0; i++) {105 if (processors.get(i).getStatus() == ResourceStatus.FREE) {106 choosenResources.add(processors.get(i));107 cpuRequest--;108 }109 }110 if (cpuRequest > 0) {111 // log.info("Task " + task.getJobId() + "_" + task.getId() +112 // " requires more cpus than is availiable in this moment.");113 return null;114 }115 116 ProcessingElements result = new ProcessingElements(processors.get(0).getParent().getName());117 result.addAll(choosenResources);118 map.put(StandardResourceUnitName.PE, result);119 120 }121 int memoryRequest;122 try {123 memoryRequest = Double.valueOf(task.getMemoryRequest()).intValue();124 } catch (NoSuchFieldException e) {125 memoryRequest = 0;126 }127 if (memoryRequest != 0) {128 List<ComputingNode> nodes = resourceManager.getComputingNodes();129 130 Memory memory = null;131 for (ComputingNode node : nodes) {132 try{133 if (node.getFreeMemory() >= memoryRequest) {134 memory = new Memory(node.getMemory(), memoryRequest, memoryRequest);135 }136 } catch(NoSuchFieldException e){137 memory = null;138 }139 }140 if(memory != null)141 map.put(StandardResourceUnitName.MEMORY, memory);142 else return null;143 }144 145 return map;146 }147 148 149 private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution2(150 82 ClusterResourceManager resourceManager, TaskInterface<?> task) { 151 83 … … 204 136 return map; 205 137 } 206 } 138 } else return map; 207 139 } 208 140 } -
DCWoRMS/trunk/src/example/localplugin/FCFSConsolidationClusterLocalPlugin.java
r493 r497 140 140 return suitableNodes; 141 141 } 142 143 public String getName() {144 return getClass().getName();145 }146 142 147 143 } -
DCWoRMS/trunk/src/example/localplugin/FCFSNodePowerManagementClusterLocalPlugin.java
r493 r497 40 40 ClusterResourceManager resourceManager = (ClusterResourceManager) resManager; 41 41 SchedulingPlan plan = new SchedulingPlan(); 42 // chose the events types to serve. 43 // Different actions for different events are possible. 42 44 43 switch (event.getType()) { 45 44 case START_TASK_EXECUTION: 46 45 case TASK_FINISHED: 47 // our tasks are placed only in first queue (see 48 // BaseLocalPlugin.placeJobsInQueues() method) 46 49 47 TaskQueue q = queues.get(0); 50 // check all tasks in queue51 48 52 49 for (int i = 0; i < q.size(); i++) { 53 50 WorkloadUnit job = q.get(i); 54 51 TaskInterface<?> task = (TaskInterface<?>) job; 55 // if status of the tasks in READY56 52 if (task.getStatus() == DCWormsTags.READY) { 57 53 … … 65 61 } 66 62 } 67 68 63 turnOffIdleNodes(resourceManager.getComputingNodes()); 69 70 64 break; 71 65 } … … 151 145 return cpuRequest > 0 ? false : true; 152 146 } 153 154 public String getName() {155 return getClass().getName();156 }157 158 147 159 148 } -
DCWoRMS/trunk/src/example/localplugin/FCFSRackLocalPlugin.java
r493 r497 14 14 import schedframe.scheduling.tasks.WorkloadUnit; 15 15 16 public class RackLocalPlugin extends BaseLocalSchedulingPlugin {16 public class FCFSRackLocalPlugin extends BaseLocalSchedulingPlugin { 17 17 18 public RackLocalPlugin() {18 public FCFSRackLocalPlugin() { 19 19 } 20 20 … … 53 53 } 54 54 55 56 public String getName() {57 return getClass().getName();58 }59 60 55 61 56 } -
DCWoRMS/trunk/src/example/localplugin/FCFSRandomClusterLocalPlugin.java
r493 r497 41 41 // BaseLocalPlugin.placeJobsInQueues() method) 42 42 TaskQueue q = queues.get(0); 43 43 44 // check all tasks in queue 44 45 45 for (int i = 0; i < q.size(); i++) { 46 46 WorkloadUnit job = q.get(i); … … 48 48 // if status of the tasks in READY 49 49 if (task.getStatus() == DCWormsTags.READY) { 50 /*for(ResourceUnitName key:resManager.getSharedResourceUnits().keySet()){ 51 System.out.println(key.getName()); 52 }*/ 53 addToSchedulingPlan(plan, task); 54 /*String nodeName = chooseRandomProvider(resourceManager); 50 51 String nodeName = chooseRandomProvider(resourceManager); 55 52 if (nodeName != null) { 56 53 addToSchedulingPlan(plan, task, nodeName); 57 } */54 } 58 55 } 59 56 } … … 68 65 return nodes.get(nodeIdx).getName(); 69 66 } 70 71 public String getName() {72 return getClass().getName();73 }74 75 67 76 68 } -
DCWoRMS/trunk/src/example/timeestimation/DefaultTimeEstimationPlugin.java
r490 r497 44 44 45 45 // estimate remainingTaskLength 46 double remainingLength = task.getLength() * (1 - completionPercentage );46 double remainingLength = task.getLength() * (1 - completionPercentage/100); 47 47 48 48 // do the calculation
Note: See TracChangeset
for help on using the changeset viewer.