Changeset 1423 for DCWoRMS/branches/coolemall/src/schedframe/scheduling
- Timestamp:
- 07/30/14 12:25:00 (11 years ago)
- Location:
- DCWoRMS/branches/coolemall/src/schedframe/scheduling
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/schedframe/scheduling/ExecutionHistoryItem.java
r1362 r1423 5 5 public class ExecutionHistoryItem { 6 6 7 protected DateTimetimeStamp;7 protected long timeStamp; 8 8 protected double completionPercentage; 9 9 protected double estimatedDuration; … … 11 11 protected int resUsageIndex; 12 12 13 public ExecutionHistoryItem( DateTimetime){13 public ExecutionHistoryItem(long time){ 14 14 this.timeStamp = time; 15 15 } 16 16 17 public DateTimegetTimeStamp(){17 public long getTimeStamp(){ 18 18 return timeStamp; 19 19 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceItem.java
r1415 r1423 1 1 package schedframe.scheduling; 2 2 3 import java.util.HashSet; 3 4 import java.util.LinkedList; 4 5 import java.util.List; 5 6 import java.util.Map; 6 7 import java.util.Set; 7 import java.util.TreeSet;8 8 9 9 import schedframe.resources.computing.ComputingResource; … … 20 20 public ResourceItem(Map<ResourceUnitName, ResourceUnit> usedResources){ 21 21 this.usedResources = usedResources; 22 this.resourceNames = new TreeSet<String>(); 23 saveResourceNames(); 22 this.resourceNames = saveResourceNames(); 24 23 } 25 24 … … 32 31 } 33 32 34 private void saveResourceNames(){ 33 private Set<String> saveResourceNames(){ 34 Set<String> resourceNames; 35 35 ProcessingElements pes = (ProcessingElements) usedResources.get(StandardResourceUnitName.PE); 36 for (ComputingResource resource : pes) { 36 resourceNames = new HashSet<String>(pes.size(), 1); 37 for (ComputingResource resource: pes) { 37 38 38 39 LinkedList<ComputingResource> toExamine = new LinkedList<ComputingResource>(); … … 54 55 } 55 56 } 57 return resourceNames; 56 58 } 57 59 } -
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); -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionProfile.java
r1415 r1423 5 5 public class ExecutionProfile { 6 6 7 protected LinkedList<ExecutionPhase> resourceConsumptionList;7 protected LinkedList<ExecutionPhase> executionPhases; 8 8 protected long usefulWork; 9 9 protected double completionPercentage; … … 11 11 12 12 13 public ExecutionProfile(LinkedList<ExecutionPhase> resourceConsumptionList) {14 this. resourceConsumptionList = resourceConsumptionList;13 public ExecutionProfile(LinkedList<ExecutionPhase> execPhases) { 14 this.executionPhases = execPhases; 15 15 this.completionPercentage = 0; 16 16 this.currentPhase = 0; 17 17 } 18 18 19 public LinkedList<ExecutionPhase> get ResourceConsumptionList(){20 return resourceConsumptionList;19 public LinkedList<ExecutionPhase> getExecutionPhases(){ 20 return executionPhases; 21 21 } 22 22 23 public ExecutionPhase getCurrent ResourceConsumption(){24 return resourceConsumptionList.get(currentPhase);23 public ExecutionPhase getCurrentExecutionPhase(){ 24 return executionPhases.get(currentPhase); 25 25 } 26 26 … … 42 42 43 43 public boolean isLast(){ 44 if(currentPhase == resourceConsumptionList.size() - 1){44 if(currentPhase == executionPhases.size() - 1){ 45 45 return true; 46 46 } … … 58 58 public long getLength() { 59 59 long length = 0; 60 for(ExecutionPhase execPhase: resourceConsumptionList){60 for(ExecutionPhase execPhase: executionPhases){ 61 61 length = length + execPhase.getLenght(); 62 62 }
Note: See TracChangeset
for help on using the changeset viewer.