Changeset 1207 for DCWoRMS/branches/coolemall/src/schedframe/scheduling
- Timestamp:
- 11/26/13 11:56:07 (11 years ago)
- Location:
- DCWoRMS/branches/coolemall/src/schedframe/scheduling
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceHistoryItem.java
r477 r1207 8 8 import schedframe.resources.units.ResourceUnitName; 9 9 10 //TODO - change name 10 11 public class ResourceHistoryItem { 11 12 -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/SchedulerDescription.java
r477 r1207 2 2 3 3 import java.util.ArrayList; 4 import java.util.Collection; 4 5 import java.util.HashMap; 5 6 import java.util.Iterator; … … 9 10 import schedframe.resources.StandardResourceType; 10 11 import schedframe.resources.computing.description.ExecutingResourceDescription; 12 import schedframe.resources.computing.description.ResourceDescription; 11 13 import schedframe.resources.providers.ResourceProvider; 12 import schedframe.resources.units.AbstractResourceUnit;13 14 import schedframe.resources.units.ResourceUnit; 14 15 import schedframe.resources.units.ResourceUnitName; 15 16 import schedframe.scheduling.queue.QueueDescription; 16 17 17 public class SchedulerDescription extends ExecutingResourceDescription{18 public class SchedulerDescription extends ResourceDescription implements ExecutingResourceDescription{ 18 19 19 20 protected ResourceProvider provider; 20 21 protected List<QueueDescription> accesQueues; 22 protected Map<ResourceUnitName, List<ResourceUnit>> resUnits; 21 23 22 24 public SchedulerDescription(ResourceProvider provider){ … … 62 64 return provider; 63 65 } 66 67 public void addResourceUnit(ResourceUnit unit) { 68 if (this.resUnits == null) 69 this.resUnits = new HashMap<ResourceUnitName, List<ResourceUnit>>(1); 70 List<ResourceUnit> list = null; 71 if (this.resUnits.containsKey(unit.getName())) { 72 list = this.resUnits.get(unit.getName()); 73 } else { 74 list = new ArrayList<ResourceUnit>(1); 75 this.resUnits.put(unit.getName(), list); 76 } 77 list.add(unit); 78 } 79 80 public ResourceUnit getResourceUnit(ResourceUnitName unitName) throws NoSuchFieldException { 81 return getResourceUnitList(unitName).get(0); 82 } 83 84 public List<ResourceUnit> getResourceUnitList(ResourceUnitName unitName) throws NoSuchFieldException { 85 if (resUnits.containsKey(unitName)) 86 return resUnits.get(unitName); 87 else 88 throw new NoSuchFieldException("Resource unit " + unitName + " is not available in resource " + this.id); 89 } 90 91 public Collection<ResourceUnit> getResourceUnit() { 92 if (resUnits == null) 93 return null; 94 List<ResourceUnit> values = new ArrayList<ResourceUnit>(); 95 Collection<List<ResourceUnit>> lists = resUnits.values(); 96 Iterator<List<ResourceUnit>> itr = lists.iterator(); 97 98 while (itr.hasNext()) { 99 List<ResourceUnit> list = itr.next(); 100 values.addAll(list); 101 } 102 103 return values; 104 } 105 106 public Map<ResourceUnitName, List<ResourceUnit>> getResourceUnits() { 107 return resUnits; 108 } 64 109 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/ClusterResourceManager.java
r477 r1207 23 23 public List<ComputingNode> getComputingNodes(){ 24 24 try { 25 return (List<ComputingNode>) getResourcesOfType(StandardResourceType. ComputingNode);25 return (List<ComputingNode>) getResourcesOfType(StandardResourceType.Node); 26 26 } catch (ResourceException e) { 27 27 return new ArrayList<ComputingNode>(); … … 40 40 @SuppressWarnings("unchecked") 41 41 public List<ComputingNode> getComputingNodes(Properties properties){ 42 properties.setProperty("type", StandardResourceType. ComputingNode.toString());42 properties.setProperty("type", StandardResourceType.Node.toString()); 43 43 return (List<ComputingNode>) filterResources(properties); 44 44 -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/LocalResourceManager.java
r1054 r1207 19 19 import schedframe.resources.StandardResourceType; 20 20 import schedframe.resources.computing.ComputingResource; 21 import schedframe.resources.computing.ComputingResourceCharacteristics; 21 22 import schedframe.resources.computing.ResourceCharacteristics; 22 23 import schedframe.resources.computing.validator.ResourcePropertiesValidator; … … 138 139 for (int i = 0; i < computingResources.size() && resourceWithName == null; i++) { 139 140 ComputingResource resource = computingResources.get(i); 140 if (resource.get Name().equals(resourceName))141 if (resource.getFullName().equals(resourceName)) 141 142 resourceWithName = resource; 142 143 else … … 154 155 while (!toExamine.isEmpty()) { 155 156 ComputingResource resource = toExamine.pop(); 156 ResourceCharacteristics resourceCharacteristic =resource.getResourceCharacteristic();157 ComputingResourceCharacteristics resourceCharacteristic = (ComputingResourceCharacteristics)resource.getResourceCharacteristic(); 157 158 List<ResourceUnit> units = null; 158 159 units = resourceCharacteristic.getResourceUnits().get(unitName); … … 266 267 for(int i = 0 ; i < computingResources.size() && resourceWithName == null; i++){ 267 268 ComputingResource resource = computingResources.get(i); 268 if(resource.get Name().equals(resName))269 if(resource.getFullName().equals(resName)) 269 270 resourceWithName = resource; 270 271 else -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java
r1162 r1207 24 24 25 25 import qcg.shared.constants.BrokerConstants; 26 import schedframe. ResourceController;26 import schedframe.SimulatedEnvironment; 27 27 import schedframe.events.scheduling.SchedulingEvent; 28 28 import schedframe.events.scheduling.SchedulingEventType; … … 323 323 ExecTask task = iter.next(); 324 324 Executable exec = (Executable)task; 325 //exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * timeSpan/exec.getEstimatedDuration());326 325 exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * (timeSpan / exec.getEstimatedDuration())); 327 326 UsedResourcesList usedResourcesList = exec.getUsedResources(); … … 338 337 for (ComputingResource resource : pes) { 339 338 resource.handleEvent(new EnergyEvent(eventType, obj)); 339 //DataCenterWorkloadSimulator.getEventManager().sendToResources(resource.getType(), 0, new EnergyEvent(eventType, obj)); 340 340 } 341 341 /*try { … … 350 350 ComputingResource resource = null; 351 351 try { 352 resource = ResourceController.getComputingResourceByName(peUnit.getResourceId());352 resource = SimulatedEnvironment.getComputingResourceByName(peUnit.getResourceId()); 353 353 } catch (ResourceException e) { 354 354 return; … … 428 428 if(exec.getResourceConsumptionProfile().getCurrentResourceConsumption() == exec.getResourceConsumptionProfile().getResourceConsumptionList().getLast()){ 429 429 scheduler.sendInternal(phaseDuration, DCWormsTags.TASK_EXECUTION_FINISHED, execTask); 430 PEUnit peUnit = (PEUnit)exec.getUsedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE); 431 notifyComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec); 430 432 } else { 431 433 scheduler.sendInternal(phaseDuration, DCWormsTags.TASK_EXECUTION_CHANGED, execTask); 434 PEUnit peUnit = (PEUnit)exec.getUsedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE); 435 notifyComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec); 432 436 } 433 437 } … … 540 544 job.setStatus((int)BrokerConstants.JOB_STATUS_SUBMITTED); 541 545 } catch (Exception e) { 542 // TODO Auto-generated catch block543 546 e.printStackTrace(); 544 547 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/Job.java
r1159 r1207 7 7 import org.qcg.broker.schemas.resreqs.types.TaskStatesName; 8 8 9 import gridsim.dcworms.DCWormsTags;10 9 11 10 import java.io.StringWriter; -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/Task.java
r1194 r1207 4 4 import java.io.StringWriter; 5 5 import java.util.ArrayList; 6 import java.util.LinkedList;7 6 import java.util.List; 8 7 … … 22 21 import org.qcg.broker.schemas.resreqs.ProcessesResourceRequirements; 23 22 import org.qcg.broker.schemas.resreqs.Requirements; 24 import org.qcg.broker.schemas.resreqs.ResourceConsumptionType;25 23 import org.qcg.broker.schemas.resreqs.TaskResourceRequirements; 26 24 import org.qcg.broker.schemas.resreqs.TimePeriod; … … 31 29 import schedframe.scheduling.WorkloadUnitHandler; 32 30 import schedframe.scheduling.manager.tasks.JobRegistryImpl; 33 import schedframe.scheduling.tasks.phases.ResourceConsumption;34 import schedframe.scheduling.tasks.phases.ResourceConsumptionProfile;35 31 import schedframe.scheduling.tasks.requirements.ResourceParameterName; 36 32 … … 75 71 private long workloadLogWaitTime; 76 72 77 private ResourceConsumptionProfile resourceConsumptionProfile;78 73 79 74 public Task(org.qcg.broker.schemas.resreqs.Task task){ … … 96 91 } 97 92 98 private void preparePhases() { 99 LinkedList<ResourceConsumption> resourceConsumptionList = new LinkedList<ResourceConsumption>(); 100 101 if(task.getExecution() == null || task.getExecution().getResourceConsumptionProfile() == null){ 102 ResourceConsumption resConsumption = null; 103 try { 104 resConsumption = new ResourceConsumption(this.length, getComputingResourceRequirements()); 105 } catch (NoSuchFieldException e) { 106 // TODO Auto-generated catch block 107 e.printStackTrace(); 108 } 109 resourceConsumptionList.add(resConsumption); 110 } 111 else{ 112 for(ResourceConsumptionType resConsumption: task.getExecution().getResourceConsumptionProfile().getResourceConsumption()){ 113 ResourceConsumption resourceConsumption = new ResourceConsumption(resConsumption); 114 resourceConsumptionList.add(resourceConsumption); 115 } 116 } 117 this.resourceConsumptionProfile = new ResourceConsumptionProfile(resourceConsumptionList); 118 119 // System.out.println("======"+task.getExecution().getExecutable().getApplication().getName()); 120 } 93 121 94 122 95 public DateTime getExecutionStartTime() throws NoSuchFieldException { … … 310 283 } 311 284 312 p rotectedComputingResourceBaseTypeItem[] getComputingResourceRequirements() throws NoSuchFieldException{285 public ComputingResourceBaseTypeItem[] getComputingResourceRequirements() throws NoSuchFieldException{ 313 286 314 287 Requirements req = this.task.getRequirements(); … … 450 423 public void setLength(long length) { 451 424 this.length = length; 452 preparePhases();453 425 } 454 426 … … 515 487 wuh.handleTask(this); 516 488 } 517 518 public ResourceConsumptionProfile getResourceConsumptionProfile(){ 519 return resourceConsumptionProfile; 520 } 521 489 522 490 public String getApplicationName(){ 523 491 try{ -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/TaskInterface.java
r1190 r1207 7 7 8 8 import schedframe.DescriptionContainer; 9 import schedframe.scheduling.tasks.phases.ResourceConsumptionProfile;10 9 import schedframe.scheduling.tasks.requirements.ResourceParameterName; 11 10 … … 111 110 public long getWorkloadLogWaitTime(); 112 111 113 public ResourceConsumptionProfile getResourceConsumptionProfile();112 //public ResourceConsumptionProfile getResourceConsumptionProfile(); 114 113 115 114 public String getApplicationName(); -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumption.java
r1129 r1207 9 9 import org.qcg.broker.schemas.resreqs.ComputingResourceParameterType; 10 10 import org.qcg.broker.schemas.resreqs.PhaseBehaviourType; 11 import org.qcg.broker.schemas.resreqs.ReferenceType; 11 import org.qcg.broker.schemas.resreqs.StringParameterType; 12 12 13 import org.qcg.broker.schemas.resreqs.ResourceConsumptionType; 13 14 … … 36 37 if(resConsumptionType.getReferenceHardware() != null){ 37 38 for (int i = 0; i < resConsumptionType.getReferenceHardware().getReference().length; i++){ 38 ReferenceType rt = resConsumptionType.getReferenceHardware().getReference(i);39 referenceHardware.put( rt.getName(), rt.getContent());39 StringParameterType spt = resConsumptionType.getReferenceHardware().getReference(i); 40 referenceHardware.put(spt.getName(), spt.getContent()); 40 41 } 41 42 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumptionProfile.java
r896 r1207 2 2 3 3 import java.util.LinkedList; 4 import java.util.List;5 4 6 5 public class ResourceConsumptionProfile { 7 6 8 7 protected LinkedList<ResourceConsumption> resourceConsumptionList; 9 protected int currentPhase; 8 protected long usefulWork; 9 private int currentPhase; 10 10 11 11 public ResourceConsumptionProfile() { … … 37 37 this.currentPhase = currentPhase; 38 38 } 39 40 public long getUsefulWork() { 41 return usefulWork; 42 } 43 44 public void setUsefulWork(long usefulWork) { 45 this.usefulWork = usefulWork; 46 } 39 47 }
Note: See TracChangeset
for help on using the changeset viewer.