Ignore:
Timestamp:
10/31/12 13:52:06 (12 years ago)
Author:
wojtekp
Message:
 
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  
    3131 
    3232        @Override 
    33         public double estimateEnergyDissipation(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resourceManager) { 
     33        public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resourceManager) { 
    3434                throw new RuntimeException("Not implemented."); 
    3535        } 
     
    4444        } 
    4545 
     46        public String getName() { 
     47                return getClass().getName(); 
     48        } 
    4649} 
  • DCWoRMS/trunk/build/classes/example/energy/CPUEnergyEstimationPlugin.java

    r477 r539  
    11package example.energy; 
    22 
    3 import schedframe.resources.ResourceStatus; 
    43import schedframe.resources.computing.ComputingResource; 
    54import schedframe.resources.computing.Processor; 
     
    1413                        ComputingResource resource) { 
    1514                Processor cpu = (Processor)resource; 
    16                 if(resource.getPowerInterface().getPowerState().getName().equals(StandardPowerStateName.OFF)) 
     15                if(resource.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)) 
    1716                        return 0; 
    18                 if(resource.getStatus() == ResourceStatus.BUSY) 
     17                else { 
    1918                        try { 
    2019                                return cpu.getPowerInterface().getPowerConsumption(cpu.getPowerInterface().getPState()); 
    2120                        } catch (NoSuchFieldException e) { 
    22                                 return 0; 
     21                                try { 
     22                                        return cpu.getPowerInterface().getPowerConsumption(StandardPowerStateName.ON); 
     23                                } catch (NoSuchFieldException e1) { 
     24                                } 
    2325                        } 
    24                 else  
    25                         return 1;  
     26                        return 1; 
     27                } 
     28 
    2629        } 
    2730 
    28         public String getName() { 
    29                 return getClass().getName(); 
    30         } 
    31  
    32  
    3331} 
  • DCWoRMS/trunk/build/classes/example/energy/ComputingNodeEnergyEstimationPlugin.java

    r477 r539  
    1717                        try{ 
    1818                                power = power + cpu.getPowerInterface().getRecentPowerUsage().getValue(); 
    19                         } catch(Exception e){ 
    20                                 //power = power + cpu.getPowerInterface().getPowerConsumption(cpu.getPowerInterface().getPowerState()); 
     19                        } catch (Exception e){ 
     20                                 
    2121                        } 
    2222                } 
    23  
    2423                try { 
    25                         power += node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState()); 
     24                        power = power + node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState()); 
    2625                } catch (NoSuchFieldException e) { 
    2726                } 
     
    3029        } 
    3130 
    32         public String getName() { 
    33                 return getClass().getName(); 
    34         } 
    3531 
    3632} 
  • DCWoRMS/trunk/build/classes/example/energy/DataCenterEnergyEstimationPlugin.java

    r477 r539  
    1818                        power += (powerUsage == null ? 0 : powerUsage.getValue()); 
    1919                } 
    20                  
    21                 //System.out.println( new DateTime() + "ENERGY CONSUMPT BY: " + resMan.getResourceName() +" IS: " + power); 
     20 
    2221                return power; 
    2322        } 
    2423 
    25         public String getName() { 
    26                 return getClass().getName(); 
    27         } 
    28  
    2924} 
  • DCWoRMS/trunk/build/classes/example/globalplugin/BaseGlobalPlugin.java

    r477 r539  
    44import schedframe.PluginConfiguration; 
    55import schedframe.events.scheduling.SchedulingEventType; 
    6 import schedframe.scheduling.WorkloadUnitListImpl; 
     6import schedframe.scheduling.TaskList; 
    77import schedframe.scheduling.manager.resources.ResourceManager; 
    88import schedframe.scheduling.plugin.SchedulingPluginConfiguration; 
     
    1111import schedframe.scheduling.queue.TaskQueue; 
    1212import schedframe.scheduling.queue.TaskQueueList; 
    13 import schedframe.scheduling.tasks.WorkloadUnit; 
     13import schedframe.scheduling.tasks.TaskInterface; 
    1414import schemas.StringValueWithUnit; 
    1515 
     
    2222        } 
    2323         
    24         public int placeJobsInQueues(WorkloadUnitListImpl newJobs, TaskQueueList queues, ResourceManager resourceManager, 
     24        public int placeTasksInQueues(TaskList newTasks, TaskQueueList queues, ResourceManager resourceManager, 
    2525                        ModuleList moduleList) { 
    2626 
     
    2828                TaskQueue queue = queues.get(0); 
    2929 
    30                 for (int i = 0; i < newJobs.size(); i++) { 
    31                         WorkloadUnit<?> task = newJobs.get(i); 
     30                for (int i = 0; i < newTasks.size(); i++) { 
     31                        TaskInterface<?> task = newTasks.get(i); 
    3232                        queue.add(task); 
    3333                } 
     
    4646        } 
    4747         
     48        public String getName() { 
     49                return getClass().getName(); 
     50        } 
    4851         
    4952} 
  • DCWoRMS/trunk/build/classes/example/globalplugin/GridFCFSLoadBalancingPlugin.java

    r477 r539  
    1919import schedframe.scheduling.plugin.grid.ModuleList; 
    2020import schedframe.scheduling.plugin.grid.ResourceDiscovery; 
     21import schedframe.scheduling.queue.QueueDescription; 
    2122import schedframe.scheduling.queue.TaskQueue; 
    22 import schedframe.scheduling.queue.QueueDescription; 
    2323import schedframe.scheduling.queue.TaskQueueList; 
    2424import schedframe.scheduling.tasks.TaskInterface; 
     
    2929        private Log log = LogFactory.getLog(GridFCFSLoadBalancingPlugin.class); 
    3030         
    31         public SchedulingPlanInterface schedule(SchedulingEvent event, 
     31        public SchedulingPlanInterface<?> schedule(SchedulingEvent event, 
    3232                        TaskQueueList queues,  
    3333                        JobRegistry jobRegistry, 
     
    5353                 
    5454                for(int i = 0; i < size; i++) { 
    55                         WorkloadUnit<?> job = q.remove(0); 
     55                        WorkloadUnit job = q.remove(0); 
    5656                        TaskInterface<?> task = (TaskInterface<?>)job; 
    5757 
     
    7474        } 
    7575 
    76         public String getName() { 
    77                 return getClass().getName(); 
    78         } 
    79  
    80         public void init(Properties properties) { 
    81                 // no extra initialization is expected. 
    82         } 
    83          
    8476        private int findLeastLoadedResourceIdx(List<SchedulerDescription> availableResources){ 
    85                  
    8677                int resourceIdx = -1; 
    8778                long minLoad = Long.MAX_VALUE; 
     79                 
    8880                for(int i = 0; i < availableResources.size(); i++){ 
    8981                        SchedulerDescription sd = availableResources.get(i); 
  • DCWoRMS/trunk/build/classes/example/globalplugin/GridFCFSRandomPlugin.java

    r477 r539  
    5353                 
    5454                for(int i = 0; i < size; i++) { 
    55                         WorkloadUnit<?> job = q.remove(0); 
     55                        WorkloadUnit job = q.remove(0); 
    5656                        TaskInterface<?> task = (TaskInterface<?>)job; 
    5757                         
     
    7575        } 
    7676 
    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  
    8677} 
  • DCWoRMS/trunk/build/classes/example/globalplugin/GridFCFSRoundRobinPlugin.java

    r477 r539  
    4747                 
    4848                for(int i = 0; i < size; i++) { 
    49                         WorkloadUnit<?> job = q.remove(0); 
     49                        WorkloadUnit job = q.remove(0); 
    5050                        TaskInterface<?> task = (TaskInterface<?>)job; 
    5151                         
     
    6565                        allocation.setProcessesCount(1); 
    6666                        allocation.setProviderName(sd.getProvider().getProviderId()); 
    67                         System.out.println("----" + sd.getProvider().getProviderId()); 
    6867                        ScheduledTask scheduledTask = new ScheduledTask(task); 
    6968                        scheduledTask.setTaskId(task.getId()); 
     
    7675        } 
    7776 
    78         public String getName() { 
    79                 return getClass().getName(); 
    80         } 
    81  
    82  
    8377} 
  • DCWoRMS/trunk/build/classes/example/localplugin/FCFSCPUFreqScalingClusterLocalPlugin.java

    r477 r539  
    11package example.localplugin; 
    22 
    3 import gridsim.Gridlet; 
     3import gridsim.dcworms.DCWormsTags; 
    44 
    55import java.util.ArrayList; 
     
    1818import schedframe.resources.units.ResourceUnitName; 
    1919import schedframe.resources.units.StandardResourceUnitName; 
    20 import schedframe.scheduling.ResourceHistoryItem; 
    21 import schedframe.scheduling.UsedResourceList; 
     20import schedframe.scheduling.UsedResourcesList; 
    2221import schedframe.scheduling.manager.resources.ClusterResourceManager; 
    2322import schedframe.scheduling.manager.resources.ResourceManager; 
     
    2827import schedframe.scheduling.queue.TaskQueue; 
    2928import schedframe.scheduling.queue.TaskQueueList; 
    30 import schedframe.scheduling.tasks.SubmittedTask; 
    3129import schedframe.scheduling.tasks.TaskInterface; 
    3230import schedframe.scheduling.tasks.WorkloadUnit; 
     31import dcworms.schedframe.scheduling.Executable; 
    3332 
    34 public class FCFSCPUFreqScalingClusterLocalPlugin extends BaseLocalPlugin { 
     33public class FCFSCPUFreqScalingClusterLocalPlugin extends BaseLocalSchedulingPlugin { 
    3534 
    3635        List<Processor> allocatedCPUs; 
     
    3938        } 
    4039 
    41         public SchedulingPlanInterface schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 
     40        public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 
    4241                        ResourceManager resManager, ModuleList modules) { 
    4342 
     
    5554                        // check all tasks in queue 
    5655                        for (int i = 0; i < q.size(); i++) { 
    57                                 WorkloadUnit<?> job = q.get(i); 
     56                                WorkloadUnit job = q.get(i); 
    5857                                TaskInterface<?> task = (TaskInterface<?>) job; 
    5958                                // if status of the tasks in READY 
    60                                 if (task.getStatus() == Gridlet.READY) { 
     59                                if (task.getStatus() == DCWormsTags.READY) { 
    6160 
    6261                                        Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(resourceManager, task); 
     
    7675                case TASK_FINISHED: 
    7776                        TaskFinishedEvent finEvent = (TaskFinishedEvent) event; 
    78                         SubmittedTask subTask = (SubmittedTask )jobRegistry.getSubmittedTask(finEvent.getJobId(), finEvent.getTaskId()); 
    79                         UsedResourceList<ResourceHistoryItem> usedResourcesList = subTask.getUsedResources(); 
     77                        Executable exec = (Executable) jobRegistry.getExecutable(finEvent.getJobId(), finEvent.getTaskId()); 
     78                        UsedResourcesList usedResourcesList = exec.getUsedResources(); 
    8079                        ProcessingElements pes = (ProcessingElements)usedResourcesList.getLast().getResourceUnits().get(StandardResourceUnitName.PE); 
    8180                        List<Processor> processors =  new ArrayList<Processor>(); 
     
    8988                case TASK_REQUESTED_TIME_EXPIRED: 
    9089                        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(); 
    9392                        pes = (ProcessingElements)usedResourcesList.getLast().getResourceUnits().get(StandardResourceUnitName.PE); 
    9493                        processors =  new ArrayList<Processor>(); 
     
    9897                        // check all tasks in queue 
    9998                        for (int i = 0; i < q.size(); i++) { 
    100                                 WorkloadUnit<?> job = q.get(i); 
     99                                WorkloadUnit job = q.get(i); 
    101100                                TaskInterface<?> task = (TaskInterface<?>) job; 
    102101                                // if status of the tasks in READY 
    103                                 if (task.getStatus() == Gridlet.READY) { 
     102                                if (task.getStatus() == DCWormsTags.READY) { 
    104103 
    105104                                        Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(resourceManager, task); 
     
    188187                } 
    189188        } 
    190          
    191         public String getName() { 
    192                 return getClass().getName(); 
    193         } 
    194189 
    195190} 
  • DCWoRMS/trunk/build/classes/example/localplugin/FCFSClusterLocalPlugin.java

    r477 r539  
    11package example.localplugin; 
    22 
    3 import gridsim.Gridlet; 
     3import gridsim.dcworms.DCWormsTags; 
    44 
    55import java.util.ArrayList; 
     
    3131import schedframe.scheduling.tasks.WorkloadUnit; 
    3232 
    33 public class FCFSClusterLocalPlugin extends BaseLocalPlugin { 
     33public class FCFSClusterLocalPlugin extends BaseLocalSchedulingPlugin { 
    3434 
    3535        public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 
     
    4949 
    5050                        for (int i = 0; i < q.size(); i++) { 
    51                                 WorkloadUnit<?> job = q.get(i); 
     51                                WorkloadUnit job = q.get(i); 
    5252                                TaskInterface<?> task = (TaskInterface<?>) job; 
    5353                                // if status of the tasks in READY 
    54                                 if (task.getStatus() == Gridlet.READY) { 
     54                                if (task.getStatus() == DCWormsTags.READY) { 
    5555                                         
    5656                                        /****************3 ways to schedule task****************/ 
    5757                                         
    5858                                        /****************1. Choosing particular resources to perform execution****************/ 
    59                                         Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution2(resourceManager, task); 
     59                                        Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(resourceManager, task); 
    6060                                        if (choosenResources != null) { 
    6161                                                addToSchedulingPlan(plan, task, choosenResources); 
     
    8080 
    8181        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( 
    15082                        ClusterResourceManager resourceManager, TaskInterface<?> task) { 
    15183 
     
    178110                                } 
    179111 
    180                                 ProcessingElements result = new ProcessingElements(processors.get(0).getParent().getName()); 
     112                                ProcessingElements result = new ProcessingElements(); 
    181113                                result.addAll(choosenResources); 
    182114                                map.put(StandardResourceUnitName.PE, result); 
     
    204136                                                return map; 
    205137                                        } 
    206                                 } 
     138                                } else return map; 
    207139                        } 
    208140                } 
     
    221153        } 
    222154 
    223         public String getName() { 
    224                 return getClass().getName(); 
    225         } 
    226  
    227155} 
  • DCWoRMS/trunk/build/classes/example/localplugin/FCFSConsolidationClusterLocalPlugin.java

    r477 r539  
    11package example.localplugin; 
    22 
    3 import gridsim.Gridlet; 
     3import gridsim.dcworms.DCWormsTags; 
    44 
    55import java.util.ArrayList; 
     
    3030import schedframe.scheduling.tasks.WorkloadUnit; 
    3131 
    32 public class FCFSConsolidationClusterLocalPlugin extends BaseLocalPlugin { 
     32public class FCFSConsolidationClusterLocalPlugin extends BaseLocalSchedulingPlugin { 
    3333 
    3434        public FCFSConsolidationClusterLocalPlugin () { 
    3535        } 
    3636 
    37         public SchedulingPlanInterface schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 
     37        public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 
    3838                        ResourceManager resManager, ModuleList modules) { 
    3939 
     
    5151 
    5252                        for (int i = 0; i < q.size(); i++) { 
    53                                 WorkloadUnit<?> job = q.get(i); 
     53                                WorkloadUnit job = q.get(i); 
    5454                                TaskInterface<?> task = (TaskInterface<?>) job; 
    5555                                // if status of the tasks in READY 
    56                                 if (task.getStatus() == Gridlet.READY) { 
     56                                if (task.getStatus() == DCWormsTags.READY) { 
    5757 
    5858                                        Map<ResourceUnitName, ResourceUnit> choosenResources = null; 
     
    140140                return suitableNodes; 
    141141        } 
    142          
    143         public String getName() { 
    144                 return getClass().getName(); 
    145         } 
    146142 
    147143} 
  • DCWoRMS/trunk/build/classes/example/localplugin/FCFSNodePowerManagementClusterLocalPlugin.java

    r477 r539  
    11package example.localplugin; 
    22 
    3 import gridsim.Gridlet; 
     3import gridsim.dcworms.DCWormsTags; 
    44 
    55import java.util.ArrayList; 
     
    3030import schedframe.scheduling.tasks.WorkloadUnit; 
    3131 
    32 public class FCFSNodePowerManagementClusterLocalPlugin extends BaseLocalPlugin { 
     32public class FCFSNodePowerManagementClusterLocalPlugin extends BaseLocalSchedulingPlugin { 
    3333 
    3434        public FCFSNodePowerManagementClusterLocalPlugin () { 
    3535        } 
    3636 
    37         public SchedulingPlanInterface schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 
     37        public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 
    3838                        ResourceManager resManager, ModuleList modules) { 
    3939 
    4040                ClusterResourceManager resourceManager = (ClusterResourceManager) resManager; 
    4141                SchedulingPlan plan = new SchedulingPlan(); 
    42                 // chose the events types to serve. 
    43                 // Different actions for different events are possible. 
     42 
    4443                switch (event.getType()) { 
    4544                case START_TASK_EXECUTION: 
    4645                case TASK_FINISHED: 
    47                         // our tasks are placed only in first queue (see 
    48                         // BaseLocalPlugin.placeJobsInQueues() method) 
     46 
    4947                        TaskQueue q = queues.get(0); 
    50                         // check all tasks in queue 
    5148 
    5249                        for (int i = 0; i < q.size(); i++) { 
    53                                 WorkloadUnit<?> job = q.get(i); 
     50                                WorkloadUnit job = q.get(i); 
    5451                                TaskInterface<?> task = (TaskInterface<?>) job; 
    55                                 // if status of the tasks in READY 
    56                                 if (task.getStatus() == Gridlet.READY) { 
     52                                if (task.getStatus() == DCWormsTags.READY) { 
    5753 
    5854                                        Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(resourceManager, task); 
     
    6561                                } 
    6662                        } 
    67  
    6863                        turnOffIdleNodes(resourceManager.getComputingNodes()); 
    69  
    7064                        break; 
    7165                } 
     
    151145                return cpuRequest > 0 ? false : true; 
    152146        } 
    153          
    154         public String getName() { 
    155                 return getClass().getName(); 
    156         } 
    157  
    158147 
    159148} 
  • DCWoRMS/trunk/build/classes/example/localplugin/FCFSRandomClusterLocalPlugin.java

    r477 r539  
    11package example.localplugin; 
    22 
    3 import gridsim.Gridlet; 
     3import gridsim.dcworms.DCWormsTags; 
    44 
    55import java.util.List; 
     
    1919import schedframe.scheduling.tasks.WorkloadUnit; 
    2020 
    21 public class FCFSRandomClusterLocalPlugin extends BaseLocalPlugin { 
     21public class FCFSRandomClusterLocalPlugin extends BaseLocalSchedulingPlugin { 
    2222 
    2323        private Random rand; 
     
    4141                        // BaseLocalPlugin.placeJobsInQueues() method) 
    4242                        TaskQueue q = queues.get(0); 
     43                         
    4344                        // check all tasks in queue 
    44  
    4545                        for (int i = 0; i < q.size(); i++) { 
    46                                 WorkloadUnit<?> job = q.get(i); 
     46                                WorkloadUnit job = q.get(i); 
    4747                                TaskInterface<?> task = (TaskInterface<?>) job; 
    4848                                // 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); 
    5552                                        if (nodeName != null) { 
    5653                                                addToSchedulingPlan(plan, task, nodeName); 
    57                                         }*/ 
     54                                        } 
    5855                                } 
    5956                        } 
     
    6865                return nodes.get(nodeIdx).getName(); 
    6966        } 
    70          
    71         public String getName() { 
    72                 return getClass().getName(); 
    73         } 
    74  
    7567 
    7668} 
  • DCWoRMS/trunk/build/classes/example/localplugin/FCFS_BFLocalPlugin.java

    r477 r539  
    11package example.localplugin; 
    22 
    3 import gridsim.Gridlet; 
     3import gridsim.dcworms.DCWormsTags; 
    44import schedframe.events.scheduling.SchedulingEvent; 
    55import schedframe.scheduling.manager.resources.ResourceManager; 
    66import schedframe.scheduling.manager.tasks.JobRegistry; 
    7 import schedframe.scheduling.plan.SchedulingPlanInterface; 
    87import schedframe.scheduling.plan.impl.SchedulingPlan; 
    98import schedframe.scheduling.plugin.grid.ModuleList; 
     
    1312import schedframe.scheduling.tasks.WorkloadUnit; 
    1413 
    15 public class FCFS_BFLocalPlugin extends BaseLocalPlugin { 
     14public class FCFS_BFLocalPlugin extends BaseLocalSchedulingPlugin { 
    1615 
    17         public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 
     16        public SchedulingPlan schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 
    1817                         ResourceManager resManager, ModuleList modules) { 
    1918 
    2019                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. 
    2321                switch (event.getType()) { 
    2422                case START_TASK_EXECUTION: 
    2523                case TASK_FINISHED: 
    26                 //case TIMER: 
     24                         
    2725                        // our tasks are placed only in first queue (see BaseLocalPlugin.placeJobsInQueues() method) 
     26                        TaskQueue q = queues.get(0); 
    2827                         
    29                         TaskQueue q = queues.get(0); 
    3028                        // check all tasks in queue 
    3129                        for (int i = 0; i < q.size(); i++) { 
    32                                 WorkloadUnit<?> job = q.get(i); 
     30                                WorkloadUnit job = q.get(i); 
    3331                                TaskInterface<?> task = (TaskInterface<?>) job; 
    3432                                 
    3533                                // if status of the tasks in READY 
    36                                 if (task.getStatus() == Gridlet.READY) { 
     34                                if (task.getStatus() == DCWormsTags.READY) { 
    3735                                        addToSchedulingPlan(plan, task); 
    3836                                } 
     
    4341        } 
    4442 
    45         public String getName() { 
    46                 return getClass().getName(); 
    47         } 
    48  
    49  
    5043} 
    5144 
  • DCWoRMS/trunk/build/classes/example/timeestimation/DefaultTimeEstimationPlugin.java

    r477 r539  
    11package example.timeestimation; 
    22 
    3 import gssim.schedframe.scheduling.ExecTask; 
    43 
    54import java.util.Map; 
    65 
    7 import schedframe.Parameters; 
    8 import schedframe.PluginConfiguration; 
     6import dcworms.schedframe.scheduling.ExecTask; 
     7 
    98import schedframe.events.scheduling.SchedulingEvent; 
    109import schedframe.resources.units.PEUnit; 
     
    1615/** 
    1716 *  
    18  * @author Marcin Krystek 
     17 * @author Marcin Krystek && Wojciech Piatek 
    1918 * 
    2019 */ 
    21 public class DefaultTimeEstimationPlugin implements schedframe.scheduling.plugin.estimation.ExecutionTimeEstimationPlugin{ 
     20 
     21public class DefaultTimeEstimationPlugin extends BaseTimeEstimationPlugin{ 
    2222 
    2323        /* 
    2424         * This method should return an estimation of time required to execute the task. 
    2525         * 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. 
    2727         *  
    2828         * Example implementation calculate the estimation based on cpu processing power. 
     
    3030         * of number of allocated cpus and their speed. 
    3131         */ 
    32         public double execTimeEstimation(SchedulingEvent event, 
     32        public double execTimeEstimation(SchedulingEvent event, ExecTask task, 
    3333                        Map<ResourceUnitName, ResourceUnit> allocatedResources, 
    34                         ExecTask task, double completionPercentage) { 
     34                        double completionPercentage) { 
    3535                 
    3636                // collect all information necessary to do the calculation 
     
    4343                int cnt = peUnit.getUsedAmount(); 
    4444 
    45                 double remainingLength =  task.getLength() * (1- completionPercentage); 
     45                // estimate remainingTaskLength 
     46                double remainingLength =  task.getLength() * (1 - completionPercentage/100); 
     47                 
    4648                // do the calculation 
    4749                double execTime = (remainingLength / (cnt * speed)); 
     
    5759        } 
    5860 
    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  
    7061} 
Note: See TracChangeset for help on using the changeset viewer.