Changeset 1392 for DCWoRMS/branches


Ignore:
Timestamp:
06/23/14 16:57:26 (11 years ago)
Author:
wojtekp
Message:
 
Location:
DCWoRMS/branches/coolemall/src/schedframe
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/schedframe/resources/computing/ComputingResource.java

    r1374 r1392  
    1616import schedframe.events.scheduling.SchedulingEvent; 
    1717import schedframe.events.scheduling.SchedulingEventCommand; 
    18 import schedframe.exceptions.ResourceException; 
    1918import schedframe.resources.ResourceStatus; 
    2019import schedframe.resources.ResourceType; 
     
    256255                                ResourceStateChangedEvent rscEvent = (ResourceStateChangedEvent) event; 
    257256                                EnergyEventType eeType = (EnergyEventType)rscEvent.getEventType(); 
    258                                 scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.RESOURCE_STATE_CHANGED, src); 
     257                                //scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE_PROCESSING, src); 
    259258                                switch(eeType){ 
    260259                                 
     260                                        case RESOURCE_UTILIZATION_CHANGED: { 
     261                                                scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE_PROCESSING, src); 
     262                                                break; 
     263                                        } 
    261264                                        case FREQUENCY_CHANGED: { 
    262265                                                scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE_PROCESSING, src); 
     
    310313        } 
    311314 
    312  
    313315} 
  • DCWoRMS/branches/coolemall/src/schedframe/resources/units/ProcessingElements.java

    r1384 r1392  
    1010import schedframe.resources.ResourceType; 
    1111import schedframe.resources.computing.ComputingResource; 
     12import schedframe.scheduling.manager.tasks.JobRegistryImpl; 
    1213 
    1314public class ProcessingElements extends PEUnit implements List<ComputingResource> { 
     
    215216                //allocate resources 
    216217                if(delta > 0){ 
    217                                 for(int i = 0; i < this.resources.size() && delta > 0; i++){ 
    218                                         ComputingResource r = this.resources.get(i); 
    219                                         if(r.getStatus() == ResourceStatus.FREE || r.getStatus() == ResourceStatus.PENDING){ 
    220                                                 r.setStatus(ResourceStatus.BUSY); 
    221                                                 delta--; 
    222                                         } 
     218                        for(int i = 0; i < this.resources.size() && delta > 0; i++){ 
     219                                ComputingResource r = this.resources.get(i); 
     220                                if(r.getStatus() == ResourceStatus.FREE || r.getStatus() == ResourceStatus.PENDING){ 
     221                                        r.setStatus(ResourceStatus.BUSY); 
     222                                        delta--; 
    223223                                } 
     224                        } 
    224225                } 
    225226                //free resources 
     
    228229                                ComputingResource r = this.resources.get(i); 
    229230                                if(r.getStatus() == ResourceStatus.BUSY){ 
    230                                         r.setStatus(ResourceStatus.FREE); 
    231                                         delta++; 
     231                                        if(new JobRegistryImpl(r.getFullName()).getRunningTasks().size() == 0){ 
     232                                                r.setStatus(ResourceStatus.FREE); 
     233                                                delta++;         
     234                                        } 
    232235                                } 
    233236                        } 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/LocalResourceManager.java

    r1377 r1392  
    310310                                        for(ComputingResource cr: pe){ 
    311311                                                if(cr.getStatus().equals(ResourceStatus.BUSY)){ 
     312                                                        freeResources(resources, true); 
    312313                                                        return false; 
    313314                                                } 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java

    r1385 r1392  
    353353                 
    354354                PEUnit peUnit = (PEUnit)choosenResources.get(StandardResourceUnitName.PE); 
    355                 updateComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec); 
     355                updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec); 
    356356                 
    357357 
     
    435435                log.debug(execTask.getJobId() + "_" + execTask.getId() + " finished execution on " + new DateTime()); 
    436436                log.info(DCWormsConstants.USAGE_MEASURE_NAME + ": " + calculateTotalLoad()); 
     437                 
     438                updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec); 
    437439        } 
    438440         
     
    702704         
    703705         
    704         public void saveExecutionHistory(Executable exec, double completionPercentage, double estimatedDuration){ 
     706        private void saveExecutionHistory(Executable exec, double completionPercentage, double estimatedDuration){ 
    705707 
    706708                ExecutionHistoryItem execHistoryItem = new ExecutionHistoryItem(new DateTime()); 
     
    711713                exec.addExecHistory(execHistoryItem); 
    712714                 
     715        } 
     716         
     717        public boolean allocateResources(Executable exec, Map<ResourceUnitName, ResourceUnit> choosenResources, boolean exclusive){ 
     718                boolean allocationStatus = getAllocationManager().allocateResources(choosenResources, exclusive); 
     719                if(allocationStatus){ 
     720                        ResourceHistoryItem resourceHistoryItem = new ResourceHistoryItem(choosenResources); 
     721                        exec.addAllocatedResources(resourceHistoryItem); 
     722                        saveResourceHistory(exec); 
     723                        return true; 
     724                } 
     725                return false; 
     726        } 
     727         
     728        private void saveResourceHistory(Executable exec){ 
    713729                ProcessingElements pes = (ProcessingElements) exec.getAllocatedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE); 
    714730                for (ComputingResource resource : pes) { 
     
    735751        } 
    736752         
    737         public boolean allocateResources(Executable exec, Map<ResourceUnitName, ResourceUnit> choosenResources, boolean exclusive){ 
    738                 boolean allocationStatus = getAllocationManager().allocateResources(choosenResources, exclusive); 
    739                 if(allocationStatus){ 
    740                         ResourceHistoryItem resourceHistoryItem = new ResourceHistoryItem(choosenResources); 
    741                         exec.addAllocatedResources(resourceHistoryItem); 
    742                         return true; 
    743                 } 
    744                 return false; 
    745         } 
    746753} 
Note: See TracChangeset for help on using the changeset viewer.