Ignore:
Timestamp:
06/06/14 10:48:32 (11 years ago)
Author:
wojtekp
Message:
 
Location:
DCWoRMS/branches/coolemall/src/schedframe/scheduling
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/LocalResourceManager.java

    r1374 r1377  
    2929import schedframe.resources.units.StandardResourceUnitName; 
    3030import schedframe.scheduling.Scheduler; 
    31 import schedframe.scheduling.plugin.local.ResourceAllocation; 
    3231 
    3332 
     
    297296        } 
    298297         
    299         public boolean allocateResources(Map<ResourceUnitName, ResourceUnit> resources) { 
     298 
     299        public boolean allocateResources(Map<ResourceUnitName, ResourceUnit> resources, boolean exclusive) { 
    300300                 
    301301                if (resources == null) { 
     
    303303                } 
    304304                 
    305                 for(ResourceUnitName resUnitName: resources.keySet()){ 
    306                         ResourceUnit resUnit = resources.get(resUnitName); 
    307                         resUnit.getProvisioner().setState(ResourceUnitState.BUSY); 
    308                 } 
    309                 return true; 
    310         } 
    311  
    312  
    313         public void freeResources(Map<ResourceUnitName, ResourceUnit> resources) { 
     305                if(exclusive){ 
     306                        for(ResourceUnitName resUnitName: resources.keySet()){ 
     307                                ResourceUnit resUnit = resources.get(resUnitName); 
     308                                if(resUnit.getName().getName().equals(StandardResourceUnitName.PE.getName())){ 
     309                                        ProcessingElements pe = (ProcessingElements)resUnit; 
     310                                        for(ComputingResource cr: pe){ 
     311                                                if(cr.getStatus().equals(ResourceStatus.BUSY)){ 
     312                                                        return false; 
     313                                                } 
     314                                        } 
     315                                } 
     316                                resUnit.getProvisioner().setState(ResourceUnitState.BUSY); 
     317                        } 
     318                         
     319                        return true; 
     320                } else { 
     321                        for(ResourceUnitName resUnitName: resources.keySet()){ 
     322                                ResourceUnit resUnit = resources.get(resUnitName); 
     323                                resUnit.getProvisioner().setState(ResourceUnitState.BUSY); 
     324                        } 
     325                        return true;     
     326                } 
     327        } 
     328 
     329        public void freeResources(Map<ResourceUnitName, ResourceUnit> resources, boolean exclusive) { 
    314330                 
    315331                for(ResourceUnitName resUnitName: resources.keySet()){ 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/ResourceAllocation.java

    r477 r1377  
    11package schedframe.scheduling.manager.resources; 
    22 
    3 import java.util.List; 
     3import java.util.Map; 
    44 
    5 import schedframe.resources.computing.ComputingResource; 
     5import schedframe.resources.units.ResourceUnit; 
     6import schedframe.resources.units.ResourceUnitName; 
    67 
    78public interface ResourceAllocation { 
    8         public void allocateResources(List<ComputingResource> resources); 
     9         
     10        /** 
     11         * Allocates resource units( marks as used) on the basis of given resource 
     12         * units. 
     13         *  
     14         * @param freeRes 
     15         *            resource units to be consumed 
     16         * @param exclusive 
     17         *           allocate resources in exclusive mode 
     18         */ 
     19        public boolean allocateResources(Map<ResourceUnitName, ResourceUnit> freeRes, boolean exclusive); 
    920 
     21        /** 
     22         * Frees given resource units. 
     23         *  
     24         * @param lastUsedResources 
     25         *            resource units to be free 
     26         * @param exclusive 
     27         *            free resources allocated in exclusive mode 
     28         */ 
     29        public void freeResources(Map<ResourceUnitName, ResourceUnit> lastUsedResources, boolean exclusive); 
    1030 
    11         public void freeResources(List<ComputingResource> resources); 
    1231         
    1332} 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/AbstractManagementSystem.java

    r1362 r1377  
    2626import schedframe.scheduling.plugin.estimation.ExecutionTimeEstimationPlugin; 
    2727import schedframe.scheduling.plugin.grid.ModuleList; 
    28 import schedframe.scheduling.plugin.local.ResourceAllocation; 
     28import schedframe.scheduling.manager.resources.ResourceAllocation; 
    2929import schedframe.scheduling.queue.TaskQueue; 
    3030import schedframe.scheduling.queue.TaskQueueList; 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java

    r1374 r1377  
    238238                                Executable exec = (Executable) execTask; 
    239239                                Map<ResourceUnitName, ResourceUnit> lastUsed = exec.getAllocatedResources().getLast().getResourceUnits(); 
    240                                 getAllocationManager().freeResources(lastUsed); 
     240                                getAllocationManager().freeResources(lastUsed, true); 
    241241                                 
    242242                                saveExecutionHistory(exec, exec.getCompletionPercentage(), exec.getEstimatedDuration()); 
     
    262262                                Executable exec = (Executable) execTask; 
    263263 
    264                                 boolean status = allocateResources(exec, resources); 
     264                                boolean status = allocateResources(exec, resources, true); 
    265265                                if(status == false){ 
    266266                                        TaskList newTasks = new TaskListImpl(); 
     
    332332 
    333333                Executable exec = (Executable)task; 
    334                 boolean allocationStatus = allocateResources(exec, choosenResources); 
     334                boolean allocationStatus = allocateResources(exec, choosenResources, false); 
    335335                if(allocationStatus == false){ 
    336336                        log.info("Task " + task.getJobId() + "_" + task.getId() + " requires more resources than is available at this moment."); 
     
    417417 
    418418                Map<ResourceUnitName, ResourceUnit> lastUsed = exec.getAllocatedResources().getLast().getResourceUnits(); 
    419                 getAllocationManager().freeResources(lastUsed); 
     419                getAllocationManager().freeResources(lastUsed, true); 
    420420                 
    421421                //TODO calculate the value of completion 
     
    727727        } 
    728728         
    729         public boolean allocateResources(Executable exec, Map<ResourceUnitName, ResourceUnit> choosenResources){ 
    730                 boolean allocationStatus = getAllocationManager().allocateResources(choosenResources); 
     729        public boolean allocateResources(Executable exec, Map<ResourceUnitName, ResourceUnit> choosenResources, boolean exclusive){ 
     730                boolean allocationStatus = getAllocationManager().allocateResources(choosenResources, exclusive); 
    731731                if(allocationStatus){ 
    732732                        ResourceHistoryItem resourceHistoryItem = new ResourceHistoryItem(choosenResources); 
Note: See TracChangeset for help on using the changeset viewer.