- Timestamp:
- 07/30/14 12:25:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java
r1415 r1423 4 4 import java.util.HashMap; 5 5 import java.util.Iterator; 6 import java.util.LinkedHashSet; 6 7 import java.util.List; 7 8 import java.util.Map; 9 import java.util.Set; 8 10 9 11 import org.apache.commons.logging.Log; … … 93 95 94 96 int tag = ev.get_tag(); 95 96 97 switch (tag) { 97 98 … … 139 140 getWorkloadUnitHandler().handleJob(job); 140 141 } 141 //SUPPORTS PRECEDING CONSTRAINST COMING BOTHFROM SWF FILES142 //SUPPORTS PRECEDING CONSTRAINST COMING ALSO FROM SWF FILES 142 143 /*else { 143 144 try { … … 394 395 PEUnit peUnit = (PEUnit)resources.get(StandardResourceUnitName.PE); 395 396 updateComputingResources(peUnit, ResourceEventType.TASK_STARTED, exec); 396 397 } 397 } 398 398 399 protected void finalizeExecutable(ExecTask execTask){ 399 400 … … 459 460 //System.out.println("taskId: " + exec.getId() + "; completion percentage: " + exec.getCompletionPercentage() + "; timespan: " + timeSpan + "; estimatedDuration: " + execHistItem.getCompletionPercentage()); 460 461 exec.getExecutionProfile().setCompletionPercentage(exec.getExecutionProfile().getCompletionPercentage() + 100 * (timeSpan / (execHistItem.getEstimatedDuration()) * (1.0 - execHistItem.getCompletionPercentage()/100.0))); 461 exec.setTotalCompletionPercentage(exec.getTotalCompletionPercentage() + 100 * (timeSpan / execHistItem.getEstimatedDuration()) * exec.getExecutionProfile().getCurrent ResourceConsumption().getLenght() / exec.getExecutionProfile().getLength());462 exec.setTotalCompletionPercentage(exec.getTotalCompletionPercentage() + 100 * (timeSpan / execHistItem.getEstimatedDuration()) * exec.getExecutionProfile().getCurrentExecutionPhase().getLenght() / exec.getExecutionProfile().getLength()); 462 463 //System.out.println("newProgress: " + exec.getCompletionPercentage() ); 463 464 … … 467 468 private void updateComputingResources(PEUnit peUnit, ResourceEventType eventType, Object obj){ 468 469 if(peUnit instanceof ProcessingElements){ 469 ProcessingElements pes = (ProcessingElements) peUnit;470 /*ProcessingElements pes = (ProcessingElements) peUnit; 470 471 for (ComputingResource resource : pes) { 471 472 resource.handleEvent(new ResourceEvent(eventType, obj, scheduler.getFullName())); 472 473 //DataCenterWorkloadSimulator.getEventManager().sendToResources(resource.getType(), 0, new EnergyEvent(eventType, obj)); 473 } 474 }*/ 474 475 /*try { 475 476 for (ComputingResource resource : resourceManager.getResourcesOfType(pes.get(0).getType())) { … … 480 481 e.printStackTrace(); 481 482 }*/ 483 484 ProcessingElements pes = (ProcessingElements) peUnit; 485 ResourceEvent resEvent = new ResourceEvent(eventType, obj, scheduler.getFullName()); 486 try{ 487 Set<ComputingResource> resourcesToUpdate = new LinkedHashSet<ComputingResource>(); 488 489 for (ComputingResource compResource : pes) { 490 resourcesToUpdate.add(compResource); 491 } 492 while(resourcesToUpdate.size() > 0){ 493 Set<ComputingResource> newSet = new LinkedHashSet<ComputingResource>(); 494 for(ComputingResource compResource: resourcesToUpdate){ 495 compResource.updateState(resEvent); 496 if(compResource.getParent() != null){ 497 newSet.add(compResource.getParent()); 498 } 499 } 500 resourcesToUpdate = new LinkedHashSet<ComputingResource>(newSet); 501 } 502 }catch(Exception e){ 503 } 482 504 } else { 483 505 ComputingResource resource = null; … … 492 514 493 515 protected void updateProcessingTimes() { 494 for (ExecTask execTask 516 for (ExecTask execTask: jobRegistry.getRunningTasks()) { 495 517 Executable exec = (Executable)execTask; 496 518 … … 502 524 503 525 ExecutionHistoryItem execHistItem = exec.getExecutionHistory().getLast(); 504 double lastTimeStamp = execHistItem.getTimeStamp() .getMillis()/ 1000;526 double lastTimeStamp = execHistItem.getTimeStamp() / 1000; 505 527 if(DoubleMath.subtract((lastTimeStamp + execHistItem.getEstimatedDuration()), (new DateTime().getMillis() / 1000 + phaseDuration)) == 0.0){ 506 528 continue; … … 706 728 707 729 private void saveExecutionHistory(Executable exec, double completionPercentage, double estimatedDuration){ 708 ExecutionHistoryItem execHistoryItem = new ExecutionHistoryItem(new DateTime() );730 ExecutionHistoryItem execHistoryItem = new ExecutionHistoryItem(new DateTime().getMillis()); 709 731 execHistoryItem.setCompletionPercentage(completionPercentage); 710 732 execHistoryItem.setEstimatedDuration(estimatedDuration);
Note: See TracChangeset
for help on using the changeset viewer.