Changeset 1332 for DCWoRMS/branches


Ignore:
Timestamp:
03/31/14 17:17:59 (11 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java

    r1298 r1332  
    164164                        break; 
    165165                         
    166                 case DCWormsTags.UPDATE_PROCESSING: 
    167                         updateProcessingTimes(ev); 
    168                         break; 
    169166                         
    170167                case DCWormsTags.TASK_EXECUTION_CHANGED: 
    171168                        execTask = (ExecTask) ev.get_data(); 
    172169                        updateTaskExecution(execTask, SchedulingEventType.RESOURCE_STATE_CHANGED); 
     170                        break; 
     171                         
     172                case DCWormsTags.UPDATE_PROCESSING: 
     173                        updateProcessingTimes(ev); 
    173174                        break; 
    174175                         
     
    244245                DateTime currentTime = new DateTime(); 
    245246                ResourceHistoryItem resHistItem = new ResourceHistoryItem(choosenResources, currentTime); 
     247                resHistItem.setCompletionPercentage(0); 
    246248                exec.addUsedResources(resHistItem); 
    247249                 
     
    252254                        e.printStackTrace(); 
    253255                } 
     256                 
     257                PEUnit peUnit = (PEUnit)choosenResources.get(StandardResourceUnitName.PE); 
     258                notifyComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec); 
    254259                 
    255260                updateTaskExecution(exec, SchedulingEventType.START_TASK_EXECUTION); 
     
    265270 
    266271                log.info(DCWormsConstants.USAGE_MEASURE_NAME + ": " + calculateTotalLoad()); 
    267                  
    268                 PEUnit peUnit = (PEUnit)choosenResources.get(StandardResourceUnitName.PE); 
    269                  
    270                 notifyComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec); 
    271272                 
    272273        } 
     
    314315         
    315316        protected void updateProcessingProgress() { 
     317 
    316318                double timeSpan = DoubleMath.subtract(Sim_system.clock(), lastUpdateTime); 
    317319                if (timeSpan <= 0.0) { 
     
    324326                        ExecTask task = iter.next(); 
    325327                        Executable exec = (Executable)task; 
    326                         if( exec.getUsedResources().size() > 1){          
    327                                 exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * (timeSpan / exec.getEstimatedDuration() * (1.0 - exec.getCompletionPercentage()/100.0))); 
    328                         } 
     328 
     329                        if(exec.getUsedResources().size() > 1){ 
     330                                //System.out.println("--- upadteProgressX: " + Sim_system.sim_clock() ); 
     331                                //System.out.println("taskId: " + exec.getId() + "; completion percentage: " + exec.getCompletionPercentage() + "; timespan: " + timeSpan + "; estimatedDuration: " +  exec.getEstimatedDuration()); 
     332                                exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * (timeSpan / (exec.getEstimatedDuration()) * (1.0 - exec.getUsedResources().get(exec.getUsedResources().size()-1).getCompletionPercentage()/100.0))); 
     333                                //System.out.println("newProgress: " + exec.getCompletionPercentage()  );        
     334                        }  
    329335                        else { 
     336                                //System.out.println("--- upadteProgress2: " + Sim_system.sim_clock() ); 
     337                                //System.out.println("taskId: " + exec.getId() + "; completion percentage: " + exec.getCompletionPercentage() + "; timespan: " + timeSpan + "; estimatedDuration: " +  exec.getEstimatedDuration()); 
    330338                                exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * (timeSpan / exec.getEstimatedDuration())); 
     339                                //System.out.println("newProgress: " + exec.getCompletionPercentage()  );        
    331340                        } 
    332341                } 
     
    337346                        ProcessingElements pes = (ProcessingElements) peUnit; 
    338347                        for (ComputingResource resource : pes) { 
    339                                 resource.handleEvent(new EnergyEvent(eventType, obj)); 
     348                                resource.handleEvent(new EnergyEvent(eventType, obj, scheduler.getFullName())); 
    340349                                //DataCenterWorkloadSimulator.getEventManager().sendToResources(resource.getType(), 0, new EnergyEvent(eventType, obj)); 
    341350                        } 
     
    355364                                return; 
    356365                        } 
    357                         resource.handleEvent(new EnergyEvent(eventType, obj)); 
     366                        resource.handleEvent(new EnergyEvent(eventType, obj, scheduler.getFullName())); 
    358367                } 
    359368        } 
     
    371380                                continue; 
    372381                        } 
     382                        //System.out.println("=== upadteTIme: " + Sim_system.sim_clock() ); 
     383                        //System.out.println("execId: " + exec.getId() +  "; estimatedDuration " + exec.getEstimatedDuration()); 
     384                        //System.out.println("execId: " + exec.getId() + "; difference " + DoubleMath.subtract((lastTimeStamp + exec.getEstimatedDuration()), (new DateTime().getMillis()/1000 + phaseDuration))); 
     385                        //System.out.println("completionPercantage: " + exec.getCompletionPercentage() + "; basic duration: " +exec.getResourceConsumptionProfile().getCurrentResourceConsumption().getDuration() +   "; phaseDuration: " +  phaseDuration); 
    373386 
    374387                        exec.setEstimatedDuration(phaseDuration); 
    375388                        DateTime currentTime = new DateTime(); 
    376389                        ResourceHistoryItem resHistItem = new ResourceHistoryItem(choosenResources, currentTime); 
     390                        resHistItem.setCompletionPercentage(exec.getCompletionPercentage()); 
    377391                        exec.addUsedResources(resHistItem); 
    378392                         
     
    381395                                scheduler.sim_cancel(filter, null); 
    382396                                scheduler.sendInternal(phaseDuration , DCWormsTags.TASK_EXECUTION_FINISHED, execTask); 
    383                                 PEUnit peUnit = (PEUnit)exec.getUsedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE); 
    384                                 notifyComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec); 
     397                                //PEUnit peUnit = (PEUnit)exec.getUsedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE); 
     398                                //notifyComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec); 
    385399                        } else{ 
    386400                                ExecTaskFilter filter = new ExecTaskFilter(exec.getUniqueId(), DCWormsTags.TASK_EXECUTION_CHANGED); 
    387401                                scheduler.sim_cancel(filter, null); 
    388402                                scheduler.sendInternal(phaseDuration, DCWormsTags.TASK_EXECUTION_CHANGED, execTask); 
    389                                 PEUnit peUnit = (PEUnit)exec.getUsedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE); 
    390                                 notifyComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec); 
     403                                //PEUnit peUnit = (PEUnit)exec.getUsedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE); 
     404                                //notifyComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec); 
    391405                        } 
    392406                } 
     
    488502         
    489503        public void notifySubmittedWorkloadUnit(WorkloadUnit wu, boolean ack) { 
    490                 updateProcessingProgress(); 
     504                //250314 
     505                //updateProcessingProgress(); 
    491506                if (log.isInfoEnabled()) 
    492507                        log.info("Received job " + wu.getId() + " at " + new DateTime(DateTimeUtilsExt.currentTimeMillis())); 
Note: See TracChangeset for help on using the changeset viewer.