Changeset 1332 for DCWoRMS/branches
- Timestamp:
- 03/31/14 17:17:59 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java
r1298 r1332 164 164 break; 165 165 166 case DCWormsTags.UPDATE_PROCESSING:167 updateProcessingTimes(ev);168 break;169 166 170 167 case DCWormsTags.TASK_EXECUTION_CHANGED: 171 168 execTask = (ExecTask) ev.get_data(); 172 169 updateTaskExecution(execTask, SchedulingEventType.RESOURCE_STATE_CHANGED); 170 break; 171 172 case DCWormsTags.UPDATE_PROCESSING: 173 updateProcessingTimes(ev); 173 174 break; 174 175 … … 244 245 DateTime currentTime = new DateTime(); 245 246 ResourceHistoryItem resHistItem = new ResourceHistoryItem(choosenResources, currentTime); 247 resHistItem.setCompletionPercentage(0); 246 248 exec.addUsedResources(resHistItem); 247 249 … … 252 254 e.printStackTrace(); 253 255 } 256 257 PEUnit peUnit = (PEUnit)choosenResources.get(StandardResourceUnitName.PE); 258 notifyComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec); 254 259 255 260 updateTaskExecution(exec, SchedulingEventType.START_TASK_EXECUTION); … … 265 270 266 271 log.info(DCWormsConstants.USAGE_MEASURE_NAME + ": " + calculateTotalLoad()); 267 268 PEUnit peUnit = (PEUnit)choosenResources.get(StandardResourceUnitName.PE);269 270 notifyComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec);271 272 272 273 } … … 314 315 315 316 protected void updateProcessingProgress() { 317 316 318 double timeSpan = DoubleMath.subtract(Sim_system.clock(), lastUpdateTime); 317 319 if (timeSpan <= 0.0) { … … 324 326 ExecTask task = iter.next(); 325 327 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 } 329 335 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()); 330 338 exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * (timeSpan / exec.getEstimatedDuration())); 339 //System.out.println("newProgress: " + exec.getCompletionPercentage() ); 331 340 } 332 341 } … … 337 346 ProcessingElements pes = (ProcessingElements) peUnit; 338 347 for (ComputingResource resource : pes) { 339 resource.handleEvent(new EnergyEvent(eventType, obj ));348 resource.handleEvent(new EnergyEvent(eventType, obj, scheduler.getFullName())); 340 349 //DataCenterWorkloadSimulator.getEventManager().sendToResources(resource.getType(), 0, new EnergyEvent(eventType, obj)); 341 350 } … … 355 364 return; 356 365 } 357 resource.handleEvent(new EnergyEvent(eventType, obj ));366 resource.handleEvent(new EnergyEvent(eventType, obj, scheduler.getFullName())); 358 367 } 359 368 } … … 371 380 continue; 372 381 } 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); 373 386 374 387 exec.setEstimatedDuration(phaseDuration); 375 388 DateTime currentTime = new DateTime(); 376 389 ResourceHistoryItem resHistItem = new ResourceHistoryItem(choosenResources, currentTime); 390 resHistItem.setCompletionPercentage(exec.getCompletionPercentage()); 377 391 exec.addUsedResources(resHistItem); 378 392 … … 381 395 scheduler.sim_cancel(filter, null); 382 396 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); 385 399 } else{ 386 400 ExecTaskFilter filter = new ExecTaskFilter(exec.getUniqueId(), DCWormsTags.TASK_EXECUTION_CHANGED); 387 401 scheduler.sim_cancel(filter, null); 388 402 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); 391 405 } 392 406 } … … 488 502 489 503 public void notifySubmittedWorkloadUnit(WorkloadUnit wu, boolean ack) { 490 updateProcessingProgress(); 504 //250314 505 //updateProcessingProgress(); 491 506 if (log.isInfoEnabled()) 492 507 log.info("Received job " + wu.getId() + " at " + new DateTime(DateTimeUtilsExt.currentTimeMillis()));
Note: See TracChangeset
for help on using the changeset viewer.