Changeset 1392 for DCWoRMS/branches
- Timestamp:
- 06/23/14 16:57:26 (11 years ago)
- Location:
- DCWoRMS/branches/coolemall/src/schedframe
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/ComputingResource.java
r1374 r1392 16 16 import schedframe.events.scheduling.SchedulingEvent; 17 17 import schedframe.events.scheduling.SchedulingEventCommand; 18 import schedframe.exceptions.ResourceException;19 18 import schedframe.resources.ResourceStatus; 20 19 import schedframe.resources.ResourceType; … … 256 255 ResourceStateChangedEvent rscEvent = (ResourceStateChangedEvent) event; 257 256 EnergyEventType eeType = (EnergyEventType)rscEvent.getEventType(); 258 scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.RESOURCE_STATE_CHANGED, src);257 //scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE_PROCESSING, src); 259 258 switch(eeType){ 260 259 260 case RESOURCE_UTILIZATION_CHANGED: { 261 scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE_PROCESSING, src); 262 break; 263 } 261 264 case FREQUENCY_CHANGED: { 262 265 scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE_PROCESSING, src); … … 310 313 } 311 314 312 313 315 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/units/ProcessingElements.java
r1384 r1392 10 10 import schedframe.resources.ResourceType; 11 11 import schedframe.resources.computing.ComputingResource; 12 import schedframe.scheduling.manager.tasks.JobRegistryImpl; 12 13 13 14 public class ProcessingElements extends PEUnit implements List<ComputingResource> { … … 215 216 //allocate resources 216 217 if(delta > 0){ 217 for(int i = 0; i < this.resources.size() && delta > 0; i++){ 218 ComputingResource r = this.resources.get(i); 219 if(r.getStatus() == ResourceStatus.FREE || r.getStatus() == ResourceStatus.PENDING){ 220 r.setStatus(ResourceStatus.BUSY); 221 delta--; 222 } 218 for(int i = 0; i < this.resources.size() && delta > 0; i++){ 219 ComputingResource r = this.resources.get(i); 220 if(r.getStatus() == ResourceStatus.FREE || r.getStatus() == ResourceStatus.PENDING){ 221 r.setStatus(ResourceStatus.BUSY); 222 delta--; 223 223 } 224 } 224 225 } 225 226 //free resources … … 228 229 ComputingResource r = this.resources.get(i); 229 230 if(r.getStatus() == ResourceStatus.BUSY){ 230 r.setStatus(ResourceStatus.FREE); 231 delta++; 231 if(new JobRegistryImpl(r.getFullName()).getRunningTasks().size() == 0){ 232 r.setStatus(ResourceStatus.FREE); 233 delta++; 234 } 232 235 } 233 236 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/LocalResourceManager.java
r1377 r1392 310 310 for(ComputingResource cr: pe){ 311 311 if(cr.getStatus().equals(ResourceStatus.BUSY)){ 312 freeResources(resources, true); 312 313 return false; 313 314 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java
r1385 r1392 353 353 354 354 PEUnit peUnit = (PEUnit)choosenResources.get(StandardResourceUnitName.PE); 355 updateComputingResources(peUnit, EnergyEventType. TASK_STARTED, exec);355 updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec); 356 356 357 357 … … 435 435 log.debug(execTask.getJobId() + "_" + execTask.getId() + " finished execution on " + new DateTime()); 436 436 log.info(DCWormsConstants.USAGE_MEASURE_NAME + ": " + calculateTotalLoad()); 437 438 updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec); 437 439 } 438 440 … … 702 704 703 705 704 p ublicvoid saveExecutionHistory(Executable exec, double completionPercentage, double estimatedDuration){706 private void saveExecutionHistory(Executable exec, double completionPercentage, double estimatedDuration){ 705 707 706 708 ExecutionHistoryItem execHistoryItem = new ExecutionHistoryItem(new DateTime()); … … 711 713 exec.addExecHistory(execHistoryItem); 712 714 715 } 716 717 public boolean allocateResources(Executable exec, Map<ResourceUnitName, ResourceUnit> choosenResources, boolean exclusive){ 718 boolean allocationStatus = getAllocationManager().allocateResources(choosenResources, exclusive); 719 if(allocationStatus){ 720 ResourceHistoryItem resourceHistoryItem = new ResourceHistoryItem(choosenResources); 721 exec.addAllocatedResources(resourceHistoryItem); 722 saveResourceHistory(exec); 723 return true; 724 } 725 return false; 726 } 727 728 private void saveResourceHistory(Executable exec){ 713 729 ProcessingElements pes = (ProcessingElements) exec.getAllocatedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE); 714 730 for (ComputingResource resource : pes) { … … 735 751 } 736 752 737 public boolean allocateResources(Executable exec, Map<ResourceUnitName, ResourceUnit> choosenResources, boolean exclusive){738 boolean allocationStatus = getAllocationManager().allocateResources(choosenResources, exclusive);739 if(allocationStatus){740 ResourceHistoryItem resourceHistoryItem = new ResourceHistoryItem(choosenResources);741 exec.addAllocatedResources(resourceHistoryItem);742 return true;743 }744 return false;745 }746 753 }
Note: See TracChangeset
for help on using the changeset viewer.