Ignore:
Timestamp:
06/06/14 10:48:49 (11 years ago)
Author:
wojtekp
Message:
 
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  
    11package 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; 
    82 
    93import java.util.ArrayList; 
     
    115import java.util.List; 
    126import java.util.Map; 
    13 import java.util.Properties; 
    14  
    15 import org.joda.time.DateTime; 
    167 
    178import schedframe.events.scheduling.SchedulingEvent; 
    18 import schedframe.exceptions.ResourceException; 
    199import schedframe.resources.ResourceStatus; 
    20 import schedframe.resources.StandardResourceType; 
    21 import schedframe.resources.computing.Node; 
    2210import schedframe.resources.computing.ComputingResource; 
    2311import schedframe.resources.computing.Processor; 
    24 import schedframe.resources.computing.profiles.energy.EnergyEventType; 
    25 import schedframe.resources.units.Memory; 
    26 import schedframe.resources.units.PEUnit; 
    2712import schedframe.resources.units.ProcessingElements; 
    2813import schedframe.resources.units.ResourceUnit; 
     
    3520import schedframe.scheduling.plan.impl.SchedulingPlan; 
    3621import schedframe.scheduling.plugin.grid.ModuleList; 
    37 import schedframe.scheduling.plugin.local.ResourceAllocation; 
    3822import schedframe.scheduling.queue.TaskQueue; 
    3923import schedframe.scheduling.queue.TaskQueueList; 
    4024import schedframe.scheduling.tasks.TaskInterface; 
    41 import simulator.DataCenterWorkloadSimulator; 
     25import dcworms.schedframe.scheduling.ExecTask; 
     26import example.localplugin.BaseLocalSchedulingPlugin; 
     27import gridsim.dcworms.DCWormsTags; 
    4228 
    4329public class FCFSBF_RandomPluginPausing extends BaseLocalSchedulingPlugin { 
     
    6753                                                addToSchedulingPlan(plan, task, choosenResources); 
    6854                                        } 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                                                } 
    7459                                        } 
    7560                                } 
     
    154139                return null; 
    155140        } 
    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        } 
    157169 
    158170 
  • DCWoRMS/branches/coolemall/src/test/pausing_resuming/resources1.xml

    r1376 r1378  
    66        <resources> 
    77                <computingResource class="DataCenter" name="compRes"> 
    8                         <!-- Defined data center contains only 6 processors --> 
    9                         <computingResource class="Processor" count="1"/> 
     8                        <!-- Defined data center contains only 4 processors --> 
     9                        <computingResource class="Processor" count="4"/> 
    1010                </computingResource> 
    1111                <scheduler class="Cluster" name="cluster"> 
  • DCWoRMS/branches/coolemall/src/test/pausing_resuming/workload.swf

    r1375 r1378  
    1313;PUSpeed: 1 
    1414; 
    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.