Changeset 539 for DCWoRMS/trunk/build/classes/example
- Timestamp:
- 10/31/12 13:52:06 (12 years ago)
- Location:
- DCWoRMS/trunk/build/classes/example
- Files:
-
- 8 added
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/build/classes/example/energy/BaseEnergyEstimationPlugin.java
r477 r539 31 31 32 32 @Override 33 public double estimate EnergyDissipation(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resourceManager) {33 public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resourceManager) { 34 34 throw new RuntimeException("Not implemented."); 35 35 } … … 44 44 } 45 45 46 public String getName() { 47 return getClass().getName(); 48 } 46 49 } -
DCWoRMS/trunk/build/classes/example/energy/CPUEnergyEstimationPlugin.java
r477 r539 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/build/classes/example/energy/ComputingNodeEnergyEstimationPlugin.java
r477 r539 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/build/classes/example/energy/DataCenterEnergyEstimationPlugin.java
r477 r539 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/build/classes/example/globalplugin/BaseGlobalPlugin.java
r477 r539 4 4 import schedframe.PluginConfiguration; 5 5 import schedframe.events.scheduling.SchedulingEventType; 6 import schedframe.scheduling. WorkloadUnitListImpl;6 import schedframe.scheduling.TaskList; 7 7 import schedframe.scheduling.manager.resources.ResourceManager; 8 8 import schedframe.scheduling.plugin.SchedulingPluginConfiguration; … … 11 11 import schedframe.scheduling.queue.TaskQueue; 12 12 import schedframe.scheduling.queue.TaskQueueList; 13 import schedframe.scheduling.tasks. WorkloadUnit;13 import schedframe.scheduling.tasks.TaskInterface; 14 14 import schemas.StringValueWithUnit; 15 15 … … 22 22 } 23 23 24 public int place JobsInQueues(WorkloadUnitListImpl newJobs, TaskQueueList queues, ResourceManager resourceManager,24 public int placeTasksInQueues(TaskList newTasks, TaskQueueList queues, ResourceManager resourceManager, 25 25 ModuleList moduleList) { 26 26 … … 28 28 TaskQueue queue = queues.get(0); 29 29 30 for (int i = 0; i < new Jobs.size(); i++) {31 WorkloadUnit<?> task = newJobs.get(i);30 for (int i = 0; i < newTasks.size(); i++) { 31 TaskInterface<?> task = newTasks.get(i); 32 32 queue.add(task); 33 33 } … … 46 46 } 47 47 48 public String getName() { 49 return getClass().getName(); 50 } 48 51 49 52 } -
DCWoRMS/trunk/build/classes/example/globalplugin/GridFCFSLoadBalancingPlugin.java
r477 r539 19 19 import schedframe.scheduling.plugin.grid.ModuleList; 20 20 import schedframe.scheduling.plugin.grid.ResourceDiscovery; 21 import schedframe.scheduling.queue.QueueDescription; 21 22 import schedframe.scheduling.queue.TaskQueue; 22 import schedframe.scheduling.queue.QueueDescription;23 23 import schedframe.scheduling.queue.TaskQueueList; 24 24 import schedframe.scheduling.tasks.TaskInterface; … … 29 29 private Log log = LogFactory.getLog(GridFCFSLoadBalancingPlugin.class); 30 30 31 public SchedulingPlanInterface schedule(SchedulingEvent event,31 public SchedulingPlanInterface<?> schedule(SchedulingEvent event, 32 32 TaskQueueList queues, 33 33 JobRegistry jobRegistry, … … 53 53 54 54 for(int i = 0; i < size; i++) { 55 WorkloadUnit <?>job = q.remove(0);55 WorkloadUnit job = q.remove(0); 56 56 TaskInterface<?> task = (TaskInterface<?>)job; 57 57 … … 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 86 77 int resourceIdx = -1; 87 78 long minLoad = Long.MAX_VALUE; 79 88 80 for(int i = 0; i < availableResources.size(); i++){ 89 81 SchedulerDescription sd = availableResources.get(i); -
DCWoRMS/trunk/build/classes/example/globalplugin/GridFCFSRandomPlugin.java
r477 r539 53 53 54 54 for(int i = 0; i < size; i++) { 55 WorkloadUnit <?>job = q.remove(0);55 WorkloadUnit job = q.remove(0); 56 56 TaskInterface<?> task = (TaskInterface<?>)job; 57 57 … … 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/build/classes/example/globalplugin/GridFCFSRoundRobinPlugin.java
r477 r539 47 47 48 48 for(int i = 0; i < size; i++) { 49 WorkloadUnit <?>job = q.remove(0);49 WorkloadUnit job = q.remove(0); 50 50 TaskInterface<?> task = (TaskInterface<?>)job; 51 51 … … 65 65 allocation.setProcessesCount(1); 66 66 allocation.setProviderName(sd.getProvider().getProviderId()); 67 System.out.println("----" + sd.getProvider().getProviderId());68 67 ScheduledTask scheduledTask = new ScheduledTask(task); 69 68 scheduledTask.setTaskId(task.getId()); … … 76 75 } 77 76 78 public String getName() {79 return getClass().getName();80 }81 82 83 77 } -
DCWoRMS/trunk/build/classes/example/localplugin/FCFSCPUFreqScalingClusterLocalPlugin.java
r477 r539 1 1 package example.localplugin; 2 2 3 import gridsim. Gridlet;3 import gridsim.dcworms.DCWormsTags; 4 4 5 5 import java.util.ArrayList; … … 18 18 import schedframe.resources.units.ResourceUnitName; 19 19 import schedframe.resources.units.StandardResourceUnitName; 20 import schedframe.scheduling.ResourceHistoryItem; 21 import schedframe.scheduling.UsedResourceList; 20 import schedframe.scheduling.UsedResourcesList; 22 21 import schedframe.scheduling.manager.resources.ClusterResourceManager; 23 22 import schedframe.scheduling.manager.resources.ResourceManager; … … 28 27 import schedframe.scheduling.queue.TaskQueue; 29 28 import schedframe.scheduling.queue.TaskQueueList; 30 import schedframe.scheduling.tasks.SubmittedTask;31 29 import schedframe.scheduling.tasks.TaskInterface; 32 30 import schedframe.scheduling.tasks.WorkloadUnit; 31 import dcworms.schedframe.scheduling.Executable; 33 32 34 public class FCFSCPUFreqScalingClusterLocalPlugin extends BaseLocal Plugin {33 public class FCFSCPUFreqScalingClusterLocalPlugin extends BaseLocalSchedulingPlugin { 35 34 36 35 List<Processor> allocatedCPUs; … … 39 38 } 40 39 41 public SchedulingPlanInterface schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,40 public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 42 41 ResourceManager resManager, ModuleList modules) { 43 42 … … 55 54 // check all tasks in queue 56 55 for (int i = 0; i < q.size(); i++) { 57 WorkloadUnit <?>job = q.get(i);56 WorkloadUnit job = q.get(i); 58 57 TaskInterface<?> task = (TaskInterface<?>) job; 59 58 // if status of the tasks in READY 60 if (task.getStatus() == Gridlet.READY) {59 if (task.getStatus() == DCWormsTags.READY) { 61 60 62 61 Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(resourceManager, task); … … 76 75 case TASK_FINISHED: 77 76 TaskFinishedEvent finEvent = (TaskFinishedEvent) event; 78 SubmittedTask subTask = (SubmittedTask )jobRegistry.getSubmittedTask(finEvent.getJobId(), finEvent.getTaskId());79 UsedResource List<ResourceHistoryItem> usedResourcesList = subTask.getUsedResources();77 Executable exec = (Executable) jobRegistry.getExecutable(finEvent.getJobId(), finEvent.getTaskId()); 78 UsedResourcesList usedResourcesList = exec.getUsedResources(); 80 79 ProcessingElements pes = (ProcessingElements)usedResourcesList.getLast().getResourceUnits().get(StandardResourceUnitName.PE); 81 80 List<Processor> processors = new ArrayList<Processor>(); … … 89 88 case TASK_REQUESTED_TIME_EXPIRED: 90 89 TaskRequestedTimeExpiredEvent timExpEvent = (TaskRequestedTimeExpiredEvent) event; 91 subTask = (SubmittedTask )jobRegistry.getSubmittedTask(timExpEvent.getJobId(), timExpEvent.getTaskId());92 usedResourcesList = subTask.getUsedResources();90 exec = (Executable) jobRegistry.getExecutable(timExpEvent.getJobId(), timExpEvent.getTaskId()); 91 usedResourcesList = exec.getUsedResources(); 93 92 pes = (ProcessingElements)usedResourcesList.getLast().getResourceUnits().get(StandardResourceUnitName.PE); 94 93 processors = new ArrayList<Processor>(); … … 98 97 // check all tasks in queue 99 98 for (int i = 0; i < q.size(); i++) { 100 WorkloadUnit <?>job = q.get(i);99 WorkloadUnit job = q.get(i); 101 100 TaskInterface<?> task = (TaskInterface<?>) job; 102 101 // if status of the tasks in READY 103 if (task.getStatus() == Gridlet.READY) {102 if (task.getStatus() == DCWormsTags.READY) { 104 103 105 104 Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(resourceManager, task); … … 188 187 } 189 188 } 190 191 public String getName() {192 return getClass().getName();193 }194 189 195 190 } -
DCWoRMS/trunk/build/classes/example/localplugin/FCFSClusterLocalPlugin.java
r477 r539 1 1 package example.localplugin; 2 2 3 import gridsim. Gridlet;3 import gridsim.dcworms.DCWormsTags; 4 4 5 5 import java.util.ArrayList; … … 31 31 import schedframe.scheduling.tasks.WorkloadUnit; 32 32 33 public class FCFSClusterLocalPlugin extends BaseLocal Plugin {33 public class FCFSClusterLocalPlugin extends BaseLocalSchedulingPlugin { 34 34 35 35 public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, … … 49 49 50 50 for (int i = 0; i < q.size(); i++) { 51 WorkloadUnit <?>job = q.get(i);51 WorkloadUnit job = q.get(i); 52 52 TaskInterface<?> task = (TaskInterface<?>) job; 53 53 // if status of the tasks in READY 54 if (task.getStatus() == Gridlet.READY) {54 if (task.getStatus() == DCWormsTags.READY) { 55 55 56 56 /****************3 ways to schedule task****************/ 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 … … 178 110 } 179 111 180 ProcessingElements result = new ProcessingElements( processors.get(0).getParent().getName());112 ProcessingElements result = new ProcessingElements(); 181 113 result.addAll(choosenResources); 182 114 map.put(StandardResourceUnitName.PE, result); … … 204 136 return map; 205 137 } 206 } 138 } else return map; 207 139 } 208 140 } … … 221 153 } 222 154 223 public String getName() {224 return getClass().getName();225 }226 227 155 } -
DCWoRMS/trunk/build/classes/example/localplugin/FCFSConsolidationClusterLocalPlugin.java
r477 r539 1 1 package example.localplugin; 2 2 3 import gridsim. Gridlet;3 import gridsim.dcworms.DCWormsTags; 4 4 5 5 import java.util.ArrayList; … … 30 30 import schedframe.scheduling.tasks.WorkloadUnit; 31 31 32 public class FCFSConsolidationClusterLocalPlugin extends BaseLocal Plugin {32 public class FCFSConsolidationClusterLocalPlugin extends BaseLocalSchedulingPlugin { 33 33 34 34 public FCFSConsolidationClusterLocalPlugin () { 35 35 } 36 36 37 public SchedulingPlanInterface schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,37 public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 38 38 ResourceManager resManager, ModuleList modules) { 39 39 … … 51 51 52 52 for (int i = 0; i < q.size(); i++) { 53 WorkloadUnit <?>job = q.get(i);53 WorkloadUnit job = q.get(i); 54 54 TaskInterface<?> task = (TaskInterface<?>) job; 55 55 // if status of the tasks in READY 56 if (task.getStatus() == Gridlet.READY) {56 if (task.getStatus() == DCWormsTags.READY) { 57 57 58 58 Map<ResourceUnitName, ResourceUnit> choosenResources = null; … … 140 140 return suitableNodes; 141 141 } 142 143 public String getName() {144 return getClass().getName();145 }146 142 147 143 } -
DCWoRMS/trunk/build/classes/example/localplugin/FCFSNodePowerManagementClusterLocalPlugin.java
r477 r539 1 1 package example.localplugin; 2 2 3 import gridsim. Gridlet;3 import gridsim.dcworms.DCWormsTags; 4 4 5 5 import java.util.ArrayList; … … 30 30 import schedframe.scheduling.tasks.WorkloadUnit; 31 31 32 public class FCFSNodePowerManagementClusterLocalPlugin extends BaseLocal Plugin {32 public class FCFSNodePowerManagementClusterLocalPlugin extends BaseLocalSchedulingPlugin { 33 33 34 34 public FCFSNodePowerManagementClusterLocalPlugin () { 35 35 } 36 36 37 public SchedulingPlanInterface schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,37 public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 38 38 ResourceManager resManager, ModuleList modules) { 39 39 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 WorkloadUnit <?>job = q.get(i);50 WorkloadUnit job = q.get(i); 54 51 TaskInterface<?> task = (TaskInterface<?>) job; 55 // if status of the tasks in READY 56 if (task.getStatus() == Gridlet.READY) { 52 if (task.getStatus() == DCWormsTags.READY) { 57 53 58 54 Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(resourceManager, task); … … 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/build/classes/example/localplugin/FCFSRandomClusterLocalPlugin.java
r477 r539 1 1 package example.localplugin; 2 2 3 import gridsim. Gridlet;3 import gridsim.dcworms.DCWormsTags; 4 4 5 5 import java.util.List; … … 19 19 import schedframe.scheduling.tasks.WorkloadUnit; 20 20 21 public class FCFSRandomClusterLocalPlugin extends BaseLocal Plugin {21 public class FCFSRandomClusterLocalPlugin extends BaseLocalSchedulingPlugin { 22 22 23 23 private Random rand; … … 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 WorkloadUnit <?>job = q.get(i);46 WorkloadUnit job = q.get(i); 47 47 TaskInterface<?> task = (TaskInterface<?>) job; 48 48 // if status of the tasks in READY 49 if (task.getStatus() == Gridlet.READY) { 50 /*for(ResourceUnitName key:resManager.getSharedResourceUnits().keySet()){ 51 System.out.println(key.getName()); 52 }*/ 53 addToSchedulingPlan(plan, task); 54 /*String nodeName = chooseRandomProvider(resourceManager); 49 if (task.getStatus() == DCWormsTags.READY) { 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/build/classes/example/localplugin/FCFS_BFLocalPlugin.java
r477 r539 1 1 package example.localplugin; 2 2 3 import gridsim. Gridlet;3 import gridsim.dcworms.DCWormsTags; 4 4 import schedframe.events.scheduling.SchedulingEvent; 5 5 import schedframe.scheduling.manager.resources.ResourceManager; 6 6 import schedframe.scheduling.manager.tasks.JobRegistry; 7 import schedframe.scheduling.plan.SchedulingPlanInterface;8 7 import schedframe.scheduling.plan.impl.SchedulingPlan; 9 8 import schedframe.scheduling.plugin.grid.ModuleList; … … 13 12 import schedframe.scheduling.tasks.WorkloadUnit; 14 13 15 public class FCFS_BFLocalPlugin extends BaseLocal Plugin {14 public class FCFS_BFLocalPlugin extends BaseLocalSchedulingPlugin { 16 15 17 public SchedulingPlan Interface<?>schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,16 public SchedulingPlan schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 18 17 ResourceManager resManager, ModuleList modules) { 19 18 20 19 SchedulingPlan plan = new SchedulingPlan(); 21 // chose the events types to serve. 22 // Different actions for different events are possible. 20 // Chose the events types to serve. Different actions for different events are possible. 23 21 switch (event.getType()) { 24 22 case START_TASK_EXECUTION: 25 23 case TASK_FINISHED: 26 //case TIMER:24 27 25 // our tasks are placed only in first queue (see BaseLocalPlugin.placeJobsInQueues() method) 26 TaskQueue q = queues.get(0); 28 27 29 TaskQueue q = queues.get(0);30 28 // check all tasks in queue 31 29 for (int i = 0; i < q.size(); i++) { 32 WorkloadUnit <?>job = q.get(i);30 WorkloadUnit job = q.get(i); 33 31 TaskInterface<?> task = (TaskInterface<?>) job; 34 32 35 33 // if status of the tasks in READY 36 if (task.getStatus() == Gridlet.READY) {34 if (task.getStatus() == DCWormsTags.READY) { 37 35 addToSchedulingPlan(plan, task); 38 36 } … … 43 41 } 44 42 45 public String getName() {46 return getClass().getName();47 }48 49 50 43 } 51 44 -
DCWoRMS/trunk/build/classes/example/timeestimation/DefaultTimeEstimationPlugin.java
r477 r539 1 1 package example.timeestimation; 2 2 3 import gssim.schedframe.scheduling.ExecTask;4 3 5 4 import java.util.Map; 6 5 7 import schedframe.Parameters;8 import schedframe.PluginConfiguration; 6 import dcworms.schedframe.scheduling.ExecTask; 7 9 8 import schedframe.events.scheduling.SchedulingEvent; 10 9 import schedframe.resources.units.PEUnit; … … 16 15 /** 17 16 * 18 * @author Marcin Krystek 17 * @author Marcin Krystek && Wojciech Piatek 19 18 * 20 19 */ 21 public class DefaultTimeEstimationPlugin implements schedframe.scheduling.plugin.estimation.ExecutionTimeEstimationPlugin{ 20 21 public class DefaultTimeEstimationPlugin extends BaseTimeEstimationPlugin{ 22 22 23 23 /* 24 24 * This method should return an estimation of time required to execute the task. 25 25 * Requested calculation should be done based on the resources allocated for the task, 26 * task description and task remaining length (in instructions).26 * task description and task completion percentage. 27 27 * 28 28 * Example implementation calculate the estimation based on cpu processing power. … … 30 30 * of number of allocated cpus and their speed. 31 31 */ 32 public double execTimeEstimation(SchedulingEvent event, 32 public double execTimeEstimation(SchedulingEvent event, ExecTask task, 33 33 Map<ResourceUnitName, ResourceUnit> allocatedResources, 34 ExecTask task,double completionPercentage) {34 double completionPercentage) { 35 35 36 36 // collect all information necessary to do the calculation … … 43 43 int cnt = peUnit.getUsedAmount(); 44 44 45 double remainingLength = task.getLength() * (1- completionPercentage); 45 // estimate remainingTaskLength 46 double remainingLength = task.getLength() * (1 - completionPercentage/100); 47 46 48 // do the calculation 47 49 double execTime = (remainingLength / (cnt * speed)); … … 57 59 } 58 60 59 public PluginConfiguration getConfiguration() {60 return null;61 }62 63 public String getName() {64 return "ExampleTimeEstimationPlugin";65 }66 67 public void init(Parameters parameters) {68 }69 70 61 }
Note: See TracChangeset
for help on using the changeset viewer.