Changeset 1396 for DCWoRMS/branches/coolemall/src/schedframe/scheduling
- Timestamp:
- 06/26/14 14:18:01 (11 years ago)
- Location:
- DCWoRMS/branches/coolemall/src/schedframe/scheduling
- Files:
-
- 10 edited
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/schedframe/scheduling/GridResourceDiscovery.java
r493 r1396 20 20 import schedframe.resources.units.ResourceUnitName; 21 21 import schedframe.scheduling.manager.resources.ResourceManager; 22 import schedframe.scheduling.plugin. grid.ModuleType;22 import schedframe.scheduling.plugin.ModuleType; 23 23 import schedframe.scheduling.plugin.grid.ResourceDiscovery; 24 24 import schedframe.scheduling.tasks.requirements.AbstractResourceRequirements; -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceItem.java
r1362 r1396 2 2 3 3 import java.util.HashSet; 4 import java.util.LinkedList; 5 import java.util.List; 4 6 import java.util.Map; 5 7 import java.util.Set; 6 8 9 import schedframe.resources.computing.ComputingResource; 10 import schedframe.resources.units.ProcessingElements; 7 11 import schedframe.resources.units.ResourceUnit; 8 12 import schedframe.resources.units.ResourceUnitName; 13 import schedframe.resources.units.StandardResourceUnitName; 9 14 10 public class Resource HistoryItem {15 public class ResourceItem { 11 16 12 17 protected Map<ResourceUnitName, ResourceUnit> usedResources; 13 18 protected Set<String> visitedResources; 14 19 15 public Resource HistoryItem(Map<ResourceUnitName, ResourceUnit> usedResources){20 public ResourceItem(Map<ResourceUnitName, ResourceUnit> usedResources){ 16 21 this.usedResources = usedResources; 17 22 this.visitedResources = new HashSet<String>(); 23 saveResourceNames(); 18 24 } 19 25 … … 22 28 } 23 29 24 public void trackResource(String resName){ 25 visitedResources.add(resName); 26 } 27 28 public Set<String> getVisitedResources(){ 30 public Set<String> getResourceNames(){ 29 31 return visitedResources; 30 32 } 31 33 34 private void saveResourceNames(){ 35 ProcessingElements pes = (ProcessingElements) usedResources.get(StandardResourceUnitName.PE); 36 for (ComputingResource resource : pes) { 37 38 LinkedList<ComputingResource> toExamine = new LinkedList<ComputingResource>(); 39 toExamine.push(resource); 40 41 while (!toExamine.isEmpty()) { 42 ComputingResource compResource = toExamine.pop(); 43 List<ComputingResource> resources = compResource.getChildren(); 44 if(resources.isEmpty()){ 45 if(!visitedResources.contains(compResource.getFullName())){ 46 visitedResources.add(compResource.getFullName()); 47 } 48 } else { 49 for (int i = 0; i < resources.size(); i++) { 50 ComputingResource resourceChild = resources.get(i); 51 toExamine.addLast(resourceChild); 52 } 53 } 54 } 55 } 56 } 32 57 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/LocalResourceManager.java
r1392 r1396 306 306 for(ResourceUnitName resUnitName: resources.keySet()){ 307 307 ResourceUnit resUnit = resources.get(resUnitName); 308 if(resUnit.getName().get Name().equals(StandardResourceUnitName.PE.getName())){308 if(resUnit.getName().getLabel().equals(StandardResourceUnitName.PE.getLabel())){ 309 309 ProcessingElements pe = (ProcessingElements)resUnit; 310 310 for(ComputingResource cr: pe){ -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistryImpl.java
r1362 r1396 53 53 for (ExecTask task: executables) { 54 54 if (task.getStatus() == status) { 55 Set<String> visitedResource = task.getAllocatedResources().getLast().get VisitedResources();55 Set<String> visitedResource = task.getAllocatedResources().getLast().getResourceNames(); 56 56 for(String res: visitedResource){ 57 57 if(res.contains(context)){ -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/plugin/Module.java
r477 r1396 1 package schedframe.scheduling.plugin .grid;1 package schedframe.scheduling.plugin; 2 2 3 3 import java.util.Properties; 4 5 import eduni.simjava.Sim_event;6 4 7 5 import schedframe.exceptions.ModuleException; -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/plugin/ModuleList.java
r477 r1396 1 package schedframe.scheduling.plugin .grid;1 package schedframe.scheduling.plugin; 2 2 3 3 import java.util.List; -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/plugin/ModuleListImpl.java
r477 r1396 1 package schedframe.scheduling.plugin .grid;1 package schedframe.scheduling.plugin; 2 2 3 3 import java.util.ArrayList; -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/plugin/ModuleType.java
r777 r1396 1 package schedframe.scheduling.plugin .grid;1 package schedframe.scheduling.plugin; 2 2 3 import schedframe.StaticResourceLoadCalendar; 3 4 import schedframe.scheduling.plugin.grid.ResourceDiscovery; 4 5 import test.EventManager; 5 6 … … 13 14 14 15 RESOURCE_DISCOVERY("Resource_discovery", ResourceDiscovery.class), 15 RESOURCE_CALENDAR("Resource calendar", StaticResourceLoadCalendar.class),16 16 EVENT_MANAGER("Event manager", EventManager.class); 17 17 //DATA_MANAGER("Data Manager", DataManager.class), -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/plugin/SchedulingPlugin.java
r516 r1396 7 7 import schedframe.scheduling.manager.tasks.JobRegistry; 8 8 import schedframe.scheduling.plan.SchedulingPlanInterface; 9 import schedframe.scheduling.plugin.grid.ModuleList;10 9 import schedframe.scheduling.queue.TaskQueueList; 11 10 -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/plugin/grid/ResourceDiscovery.java
r477 r1396 6 6 import schedframe.scheduling.SchedulerDescription; 7 7 import schedframe.scheduling.SecurityContext; 8 import schedframe.scheduling.plugin.Module; 8 9 import schedframe.scheduling.tasks.requirements.AbstractResourceRequirements; 9 10 -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/plugin/local/LocalSchedulingPlugin.java
r515 r1396 5 5 import schedframe.scheduling.manager.resources.ResourceManager; 6 6 import schedframe.scheduling.manager.tasks.JobRegistry; 7 import schedframe.scheduling.plugin.ModuleList; 7 8 import schedframe.scheduling.plugin.SchedulingPlugin; 8 import schedframe.scheduling.plugin.grid.ModuleList;9 9 import schedframe.scheduling.queue.TaskQueueList; 10 10 -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/AbstractManagementSystem.java
r1377 r1396 23 23 import schedframe.scheduling.plan.AllocationInterface; 24 24 import schedframe.scheduling.plan.SchedulingPlanInterface; 25 import schedframe.scheduling.plugin.ModuleList; 25 26 import schedframe.scheduling.plugin.SchedulingPlugin; 26 27 import schedframe.scheduling.plugin.estimation.ExecutionTimeEstimationPlugin; 27 import schedframe.scheduling.plugin.grid.ModuleList;28 28 import schedframe.scheduling.manager.resources.ResourceAllocation; 29 29 import schedframe.scheduling.queue.TaskQueue; -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/global/GridBroker.java
r1385 r1396 12 12 import schedframe.scheduling.Scheduler; 13 13 import schedframe.scheduling.manager.resources.ManagedResources; 14 import schedframe.scheduling.plugin.ModuleListImpl; 14 15 import schedframe.scheduling.plugin.SchedulingPlugin; 15 16 import schedframe.scheduling.plugin.estimation.ExecutionTimeEstimationPlugin; 16 import schedframe.scheduling.plugin.grid.ModuleListImpl;17 17 import schedframe.scheduling.queue.TaskQueueList; 18 18 -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java
r1392 r1396 4 4 import java.util.HashMap; 5 5 import java.util.Iterator; 6 import java.util.LinkedList;7 6 import java.util.List; 8 7 import java.util.Map; 9 import java.util.Set;10 8 11 9 import org.apache.commons.logging.Log; … … 33 31 import schedframe.resources.units.StandardResourceUnitName; 34 32 import schedframe.scheduling.ExecutionHistoryItem; 35 import schedframe.scheduling.Resource HistoryItem;33 import schedframe.scheduling.ResourceItem; 36 34 import schedframe.scheduling.Scheduler; 37 35 import schedframe.scheduling.TaskList; … … 44 42 import schedframe.scheduling.plan.ScheduledTaskInterface; 45 43 import schedframe.scheduling.plan.SchedulingPlanInterface; 44 import schedframe.scheduling.plugin.ModuleListImpl; 46 45 import schedframe.scheduling.plugin.SchedulingPlugin; 47 46 import schedframe.scheduling.plugin.estimation.ExecutionTimeEstimationPlugin; 48 import schedframe.scheduling.plugin.grid.ModuleListImpl;49 47 import schedframe.scheduling.policy.AbstractManagementSystem; 50 48 import schedframe.scheduling.queue.TaskQueueList; … … 56 54 import schedframe.scheduling.tasks.WorkloadUnit; 57 55 import simulator.DCWormsConstants; 58 import simulator.stats. GSSAccumulator;56 import simulator.stats.DCwormsAccumulator; 59 57 import simulator.utils.DoubleMath; 60 58 import dcworms.schedframe.scheduling.ExecTask; … … 382 380 383 381 saveExecutionHistory(exec, exec.getCompletionPercentage(), phaseDuration); 384 if(exec.get ResourceConsumptionProfile().isLast()){382 if(exec.getExecutionProfile().isLast()){ 385 383 scheduler.sendInternal(phaseDuration, DCWormsTags.TASK_EXECUTION_FINISHED, execTask);; 386 384 } else { … … 451 449 ExecTask task = iter.next(); 452 450 Executable exec = (Executable)task; 453 ExecutionHistoryItem execHistItem = exec.getExec History().getLast();451 ExecutionHistoryItem execHistItem = exec.getExecutionHistory().getLast(); 454 452 //System.out.println("--- upadteProgressX: " + Sim_system.sim_clock() ); 455 453 //System.out.println("taskId: " + exec.getId() + "; completion percentage: " + exec.getCompletionPercentage() + "; timespan: " + timeSpan + "; estimatedDuration: " + execHistItem.getCompletionPercentage()); … … 496 494 execTask, choosenResources, exec.getCompletionPercentage())).intValue(); 497 495 498 ExecutionHistoryItem execHistItem = exec.getExec History().getLast();496 ExecutionHistoryItem execHistItem = exec.getExecutionHistory().getLast(); 499 497 double lastTimeStamp = execHistItem.getTimeStamp().getMillis()/1000; 500 498 if(DoubleMath.subtract((lastTimeStamp + execHistItem.getEstimatedDuration()), (new DateTime().getMillis()/1000 + phaseDuration)) == 0.0){ … … 508 506 saveExecutionHistory(exec, exec.getCompletionPercentage(), phaseDuration); 509 507 510 if(exec.get ResourceConsumptionProfile().isLast()){508 if(exec.getExecutionProfile().isLast()){ 511 509 ExecTaskFilter filter = new ExecTaskFilter(exec.getUniqueId(), DCWormsTags.TASK_EXECUTION_FINISHED); 512 510 scheduler.sim_cancel(filter, null); … … 542 540 saveExecutionHistory(exec, exec.getCompletionPercentage(), phaseDuration); 543 541 544 if(exec.get ResourceConsumptionProfile().isLast()){542 if(exec.getExecutionProfile().isLast()){ 545 543 scheduler.sendInternal(phaseDuration, DCWormsTags.TASK_EXECUTION_FINISHED, execTask); 546 544 } else { … … 555 553 public double calculateTotalLoad() { 556 554 557 GSSAccumulator loadAcc = new GSSAccumulator();555 DCwormsAccumulator loadAcc = new DCwormsAccumulator(); 558 556 try { 559 557 for(ComputingResource compRes: getResourceManager().getResourcesOfType(StandardResourceType.Node)){ … … 718 716 boolean allocationStatus = getAllocationManager().allocateResources(choosenResources, exclusive); 719 717 if(allocationStatus){ 720 Resource HistoryItem resourceHistoryItem = new ResourceHistoryItem(choosenResources);718 ResourceItem resourceHistoryItem = new ResourceItem(choosenResources); 721 719 exec.addAllocatedResources(resourceHistoryItem); 722 saveResourceHistory(exec);723 720 return true; 724 721 } … … 726 723 } 727 724 728 private void saveResourceHistory(Executable exec){ 729 ProcessingElements pes = (ProcessingElements) exec.getAllocatedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE); 730 for (ComputingResource resource : pes) { 731 732 LinkedList<ComputingResource> toExamine = new LinkedList<ComputingResource>(); 733 toExamine.push(resource); 734 735 while (!toExamine.isEmpty()) { 736 ComputingResource compResource = toExamine.pop(); 737 List<ComputingResource> resources = compResource.getChildren(); 738 if(resources.isEmpty()){ 739 Set<String> visitedResources = exec.getAllocatedResources().getLast().getVisitedResources(); 740 if(!visitedResources.contains(compResource.getFullName())){ 741 exec.getAllocatedResources().getLast().trackResource(compResource.getFullName()); 742 } 743 } else { 744 for (int i = 0; i < resources.size(); i++) { 745 ComputingResource resourceChild = resources.get(i); 746 toExamine.addLast(resourceChild); 747 } 748 } 749 } 750 } 751 } 725 752 726 753 727 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/Job.java
r1374 r1396 1 1 package schedframe.scheduling.tasks; 2 3 4 import org.qcg.broker.schemas.resreqs.ParentType;5 import org.qcg.broker.schemas.resreqs.ResourceRequirements;6 import org.qcg.broker.schemas.resreqs.Workflow;7 import org.qcg.broker.schemas.resreqs.types.TaskStatesName;8 2 9 3 … … 15 9 16 10 import org.joda.time.DateTime; 11 import org.qcg.broker.schemas.resreqs.ResourceRequirements; 17 12 18 13 import qcg.shared.constants.BrokerConstants; 19 20 14 import schedframe.scheduling.WorkloadUnitHandler; 21 15 import schedframe.scheduling.manager.tasks.JobRegistryImpl; … … 210 204 } 211 205 212 private List<Task> getReadyTasks() throws NoSuchFieldException{213 214 List<Task> availableTasks = new ArrayList<Task>();215 int size = tasks.size();216 217 for(int i = 0; i < size; i++){218 int parCnt;219 int previousTaskSucceedCnt = 0;220 Task task = tasks.get(i);221 if(task.getStatus() != (int)BrokerConstants.TASK_STATUS_UNSUBMITTED)222 continue;223 //the following procedure supports only one nested structure224 Workflow w = task.getDescription().getWorkflow();225 if (w == null){226 availableTasks.add(task);227 continue;228 }229 if(w.getAnd() != null) {230 parCnt = w.getAnd().getParentOpTypeItemCount();231 if(parCnt == 0){232 availableTasks.add(task);233 }else234 {235 for(int j = 0; j < parCnt; j++){236 ParentType par = w.getAnd().getParentOpTypeItem(j).getParent();237 if(par.getTriggerState().compareTo(TaskStatesName.FINISHED) == 0){238 if(!getTask(par.getContent()).isFinished()){239 break;240 }241 }242 previousTaskSucceedCnt++;243 }244 245 if(previousTaskSucceedCnt == parCnt)246 availableTasks.add(task);247 }248 }249 else if(w.getOr() != null) {250 parCnt = w.getOr().getParentOpTypeItemCount();251 if(parCnt == 0){252 availableTasks.add(task);253 }254 else{255 for(int j = 0; j < parCnt; j++){256 ParentType par = w.getOr().getParentOpTypeItem(j).getParent();257 if(par.getTriggerState().compareTo(TaskStatesName.FINISHED) == 0){258 if(!getTask(par.getContent()).isFinished()){259 continue;260 }261 }262 previousTaskSucceedCnt++;263 }264 265 if(previousTaskSucceedCnt > 0)266 availableTasks.add(task);267 }268 }269 else {270 parCnt = w.getParentCount();271 if(parCnt == 0){272 availableTasks.add(task);273 }else{274 for(int j = 0; j < parCnt; j++){275 ParentType par = w.getParent(j);276 if(par.getTriggerState().compareTo(TaskStatesName.FINISHED) == 0){277 if(!getTask(par.getContent()).isFinished()){278 continue;279 }280 }281 previousTaskSucceedCnt++;282 }283 284 if(previousTaskSucceedCnt == parCnt)285 availableTasks.add(task);286 }287 }288 }289 return availableTasks;290 }291 292 206 }
Note: See TracChangeset
for help on using the changeset viewer.