Changeset 1378 for DCWoRMS/branches/coolemall/src/test/pausing_resuming
- Timestamp:
- 06/06/14 10:48:49 (11 years ago)
- Location:
- DCWoRMS/branches/coolemall/src/test/pausing_resuming
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/test/pausing_resuming/FCFSBF_RandomPluginPausing.java
r1376 r1378 1 1 package test.pausing_resuming; 2 3 import dcworms.schedframe.scheduling.ExecTask;4 import dcworms.schedframe.scheduling.Executable;5 import example.localplugin.BaseLocalSchedulingPlugin;6 import gridsim.Gridlet;7 import gridsim.dcworms.DCWormsTags;8 2 9 3 import java.util.ArrayList; … … 11 5 import java.util.List; 12 6 import java.util.Map; 13 import java.util.Properties;14 15 import org.joda.time.DateTime;16 7 17 8 import schedframe.events.scheduling.SchedulingEvent; 18 import schedframe.exceptions.ResourceException;19 9 import schedframe.resources.ResourceStatus; 20 import schedframe.resources.StandardResourceType;21 import schedframe.resources.computing.Node;22 10 import schedframe.resources.computing.ComputingResource; 23 11 import schedframe.resources.computing.Processor; 24 import schedframe.resources.computing.profiles.energy.EnergyEventType;25 import schedframe.resources.units.Memory;26 import schedframe.resources.units.PEUnit;27 12 import schedframe.resources.units.ProcessingElements; 28 13 import schedframe.resources.units.ResourceUnit; … … 35 20 import schedframe.scheduling.plan.impl.SchedulingPlan; 36 21 import schedframe.scheduling.plugin.grid.ModuleList; 37 import schedframe.scheduling.plugin.local.ResourceAllocation;38 22 import schedframe.scheduling.queue.TaskQueue; 39 23 import schedframe.scheduling.queue.TaskQueueList; 40 24 import schedframe.scheduling.tasks.TaskInterface; 41 import simulator.DataCenterWorkloadSimulator; 25 import dcworms.schedframe.scheduling.ExecTask; 26 import example.localplugin.BaseLocalSchedulingPlugin; 27 import gridsim.dcworms.DCWormsTags; 42 28 43 29 public class FCFSBF_RandomPluginPausing extends BaseLocalSchedulingPlugin { … … 67 53 addToSchedulingPlan(plan, task, choosenResources); 68 54 } else { 69 if(jobRegistry.getRunningTasks().size() > 0) { 70 for(ExecTask exec: jobRegistry.getRunningTasks()){ 71 jobRegistry.pauseTask(exec.getJobId(), exec.getId()); 72 } 73 } 55 ExecTask taskToPause = getTaskWithLowestPriority(jobRegistry.getRunningTasks()); 56 if(getTaskPriority(task) > getTaskPriority(taskToPause)){ 57 jobRegistry.pauseTask(taskToPause.getJobId(), taskToPause.getId()); 58 } 74 59 } 75 60 } … … 154 139 return null; 155 140 } 156 141 142 143 private int getTaskPriority(TaskInterface<?> task){ 144 int priority; 145 146 try { 147 double cpuRequest = task.getCpuCntRequest(); 148 priority = (-1) * Double.valueOf(cpuRequest).intValue(); 149 } catch (NoSuchFieldException e) { 150 priority = Integer.MIN_VALUE; 151 } 152 153 return priority; 154 } 155 156 private ExecTask getTaskWithLowestPriority(List<ExecTask> tasks){ 157 ExecTask lowestPriorityTask = null; 158 int lowestPriority = Integer.MAX_VALUE; 159 for(ExecTask execTask: tasks){ 160 int taskPriority = getTaskPriority(execTask); 161 if(taskPriority < lowestPriority){ 162 lowestPriority = getTaskPriority(execTask); 163 lowestPriorityTask = execTask; 164 } 165 } 166 167 return lowestPriorityTask; 168 } 157 169 158 170 -
DCWoRMS/branches/coolemall/src/test/pausing_resuming/resources1.xml
r1376 r1378 6 6 <resources> 7 7 <computingResource class="DataCenter" name="compRes"> 8 <!-- Defined data center contains only 6processors -->9 <computingResource class="Processor" count=" 1"/>8 <!-- Defined data center contains only 4 processors --> 9 <computingResource class="Processor" count="4"/> 10 10 </computingResource> 11 11 <scheduler class="Cluster" name="cluster"> -
DCWoRMS/branches/coolemall/src/test/pausing_resuming/workload.swf
r1375 r1378 13 13 ;PUSpeed: 1 14 14 ; 15 16 17 1 0 -1 7200 1 -1 -1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 18 2 3600 -1 7200 1 -1 -1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 15 0 0 -1 7200 4 -1 -1 4 7200 -1 -1 -1 -1 -1 -1 -1 -1 -1 16 1 360 -1 7200 2 -1 -1 2 7200 -1 -1 -1 -1 -1 -1 -1 -1 -1 17 2 1200 -1 7200 1 -1 -1 1 7200 -1 -1 -1 -1 -1 -1 -1 -1 -1 18 3 3600 -1 7200 1 -1 -1 1 7200 -1 -1 -1 -1 -1 -1 -1 -1 -1 19 4 5400 -1 7200 1 -1 -1 1 7200 -1 -1 -1 -1 -1 -1 -1 -1 -1
Note: See TracChangeset
for help on using the changeset viewer.