Changeset 1440 for DCWoRMS/branches
- Timestamp:
- 09/18/14 17:37:54 (11 years ago)
- Location:
- DCWoRMS/branches/coolemall/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB1EnergyEstimationPlugin.java
r1415 r1440 54 54 55 55 if(powerConsumption > powerCapLevel){ 56 DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags. POWER_LIMIT_EXCEEDED, null);56 DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_POWER_LIMIT_EXCEEDED, null); 57 57 } 58 58 else if(powerConsumption < powerUpgradeLevel){ 59 DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags. POWER_LIMIT_EXCEEDED, null);59 DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_POWER_LIMIT_EXCEEDED, null); 60 60 } 61 61 return powerConsumption; -
DCWoRMS/branches/coolemall/src/example/localplugin/FCFSBF_RandomPluginWithMigration.java
r1415 r1440 58 58 } 59 59 break; 60 case POWER_LIMIT_EXCEEDED:60 case RESOURCE_POWER_LIMIT_EXCEEDED: 61 61 String src = event.getSource(); 62 62 optimizeEnergyUsage(jobRegistry, resourceManager , src); -
DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_ConsolidationHighPerf_PowerCapping_SP.java
r1396 r1440 84 84 } 85 85 break; 86 case POWER_LIMIT_EXCEEDED:86 case RESOURCE_POWER_LIMIT_EXCEEDED: 87 87 powerCap(resManager); 88 88 break; -
DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_ConsolidationLowPower_PowerCapping_SP.java
r1396 r1440 84 84 } 85 85 break; 86 case POWER_LIMIT_EXCEEDED:86 case RESOURCE_POWER_LIMIT_EXCEEDED: 87 87 powerCap(resManager); 88 88 break; -
DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_Random_PowerCapping_SP.java
r1415 r1440 88 88 } 89 89 break; 90 case POWER_LIMIT_EXCEEDED:90 case RESOURCE_POWER_LIMIT_EXCEEDED: 91 91 powerCap(resManager); 92 92 break; -
DCWoRMS/branches/coolemall/src/gridsim/dcworms/DCWormsTags.java
r1415 r1440 36 36 public static final int RESOURCE_STATE_CHANGED = DCWORMSBASE + 7; 37 37 38 public static final int POWER_LIMIT_EXCEEDED = DCWORMSBASE + 8;38 public static final int RESOURCE_POWER_STATE_CHANGED = DCWORMSBASE + 8; 39 39 40 public static final int TASK_PAUSE= DCWORMSBASE + 9;40 public static final int RESOURCE_POWER_LIMIT_EXCEEDED = DCWORMSBASE + 9; 41 41 42 public static final int TASK_ RESUME = DCWORMSBASE + 10;42 public static final int TASK_PAUSE = DCWORMSBASE + 10; 43 43 44 public static final int TASK_MIGRATE = DCWORMSBASE + 11; 44 public static final int TASK_RESUME = DCWORMSBASE + 11; 45 46 public static final int TASK_MIGRATE = DCWORMSBASE + 12; 45 47 46 public static final int TASK_MOVE = DCWORMSBASE + 1 2;48 public static final int TASK_MOVE = DCWORMSBASE + 13; 47 49 48 50 public static final int CREATED = 0; -
DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/SchedulingEventType.java
r1415 r1440 32 32 33 33 RESOURCE_STATE_CHANGED, 34 RESOURCE_POWER_STATE_CHANGED, 34 35 35 POWER_LIMIT_EXCEEDED;36 RESOURCE_POWER_LIMIT_EXCEEDED; 36 37 37 38 -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/ComputingResource.java
r1432 r1440 268 268 } 269 269 } 270 271 270 } 272 271 … … 290 289 break; 291 290 } 291 case POWER_STATE_CHANGED: { 292 scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.RESOURCE_POWER_STATE_CHANGED, src); 293 break; 294 } 292 295 } 293 296 -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/ComputingResourcePowerInterface.java
r1423 r1440 15 15 import schedframe.resources.computing.profiles.energy.power.PowerUsage; 16 16 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 17 import schedframe.resources.computing.profiles.energy.power.Transition; 18 import simulator.DataCenterWorkloadSimulator; 17 19 18 20 public class ComputingResourcePowerInterface implements PowerInterface{ … … 28 30 } 29 31 30 public boolean setPowerState(PowerStateName state) {31 if(!supportPowerState( state))32 public boolean setPowerState(PowerStateName newState) { 33 if(!supportPowerState(newState)) 32 34 return false; 33 35 34 if(state != currentPowerState){ 35 currentPowerState = state; 36 if(newState != currentPowerState){ 36 37 37 for(ComputingResource child:resource.getChildren()){ 38 if(child.getPowerInterface().supportPowerState(state)){ 39 child.getPowerInterface().setPowerState(state); 38 Transition t = getTransition(currentPowerState, newState); 39 if(t == null){ 40 currentPowerState = newState; 41 } else{ 42 if(t.getTime() <= 0 ){ 43 currentPowerState = newState; 44 } else { 45 currentPowerState = t.getName(); 46 DataCenterWorkloadSimulator.getEventManager().sendToResource(resource.getFullName(), t.getTime(), new ResourceEvent(ResourceEventType.UPDATE_POWER_STATE, newState, resource.getFullName())); 40 47 } 41 48 } 42 49 43 if(state == StandardPowerStateName.OFF){ 50 for(ComputingResource child:resource.getChildren()){ 51 if(child.getPowerInterface() != null){ 52 child.getPowerInterface().setPowerState(currentPowerState); 53 } 54 } 55 56 if(currentPowerState == StandardPowerStateName.OFF || currentPowerState == StandardPowerStateName.POWEROFF || currentPowerState == StandardPowerStateName.BOOT){ 44 57 resource.setStatus(ResourceStatus.UNAVAILABLE); 45 58 } 46 else if( state == StandardPowerStateName.ON){59 else if(currentPowerState == StandardPowerStateName.ON){ 47 60 resource.setStatus(ResourceStatus.FREE); 48 61 } … … 74 87 } 75 88 return false; 76 77 89 } 78 90 … … 114 126 } 115 127 128 protected Transition getTransition(PowerStateName from, PowerStateName to){ 129 List<PowerState> availablePowerStates = getSupportedPowerStates(); 130 Transition transition = null; 131 for(PowerState ps : availablePowerStates){ 132 if(ps.getName().getLabel().equals(from.getLabel())){ 133 List<Transition> transitions = ps.getTransitions(); 134 for(Transition t: transitions){ 135 if(t.getTo().getLabel().equals(to.getLabel())){ 136 transition = t; 137 break; 138 } 139 } 140 } 141 } 142 return transition; 143 } 116 144 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/NodePowerInterface.java
r1431 r1440 2 2 3 3 4 import java.util.List;5 6 7 import schedframe.resources.ResourceStatus;8 4 import schedframe.resources.computing.ComputingResource; 9 import schedframe.resources.computing.Node;10 import schedframe.resources.computing.profiles.energy.ResourceEvent;11 import schedframe.resources.computing.profiles.energy.ResourceEventType;12 5 import schedframe.resources.computing.profiles.energy.power.PowerProfile; 13 import schedframe.resources.computing.profiles.energy.power.PowerState;14 import schedframe.resources.computing.profiles.energy.power.PowerStateName;15 6 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 16 import schedframe.resources.computing.profiles.energy.power.Transition;17 import simulator.DataCenterWorkloadSimulator;18 7 19 8 public class NodePowerInterface extends ComputingResourcePowerInterface{ … … 24 13 } 25 14 26 public boolean setPowerState(PowerStateName state){27 if(!supportPowerState(state))28 return false;29 if(state != currentPowerState){30 currentPowerState = state;31 32 Node node = (Node) resource;33 for(ComputingResource child: node.getProcessors()){34 if(child.getPowerInterface() != null){35 child.getPowerInterface().setPowerState(state);36 }37 }38 39 if(state == StandardPowerStateName.OFF || state == StandardPowerStateName.POWEROFF || state == StandardPowerStateName.BOOT){40 node.setStatus(ResourceStatus.UNAVAILABLE);41 }42 else if(state == StandardPowerStateName.ON ){43 node.setStatus(ResourceStatus.FREE);44 }45 46 node.handleEvent(new ResourceEvent(ResourceEventType.POWER_STATE_CHANGED, node.getFullName()));47 48 //node.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, computingNode.getName()));49 //ResourceController.traceResource(new DateTime().getMillis(), resource.getFullName(), "POWER_STATE_CHANGED", state.getName());50 }51 return true;52 }53 54 15 public void turnOn(){ 55 /*double timePenalty = getTransitionTime(currentPowerState, StandardPowerStateName.ON);56 setPowerState(StandardPowerStateName.BOOT);57 DataCenterWorkloadSimulator.getEventManager().sendToResource(resource.getFullName(), timePenalty, new ResourceEvent(ResourceEventType.UPDATE_POWER_STATE, StandardPowerStateName.ON, resource.getFullName()));58 */59 16 setPowerState(StandardPowerStateName.ON); 60 17 } 61 18 62 19 public void turnOff(){ 63 /*double timePenalty = getTransitionTime(currentPowerState, StandardPowerStateName.OFF);64 setPowerState(StandardPowerStateName.POWEROFF);65 DataCenterWorkloadSimulator.getEventManager().sendToResource(resource.getFullName(), timePenalty, new ResourceEvent(ResourceEventType.UPDATE_POWER_STATE, StandardPowerStateName.OFF, resource.getFullName()));*/66 20 setPowerState(StandardPowerStateName.OFF); 67 21 } 68 22 69 private double getTransitionTime(PowerStateName from, PowerStateName to){70 List<PowerState> availablePowerStates = getSupportedPowerStates();71 double time = 0;72 for(PowerState ps : availablePowerStates){73 if(ps.getName().getLabel().equals(from.getLabel())){74 List<Transition> transitions = ps.getTransitions();75 for(Transition t: transitions){76 if(t.getTo().getLabel().equals(to)){77 time = t.getTime();78 }79 }80 }81 }82 return time;83 }84 85 86 23 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/AbstractManagementSystem.java
r1396 r1440 124 124 } 125 125 126 public boolean pluginSupportsEvent(int eventType){127 return true;128 }129 130 126 public TaskQueueList getQueues(){ 131 127 return queues; -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/global/GlobalManagementSystem.java
r1415 r1440 60 60 61 61 case DCWormsTags.TIMER: 62 if (pluginSupportsEvent(DCWormsTags.TIMER)) { 63 TimerEvent event = new TimerEvent(); 64 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 65 queues, jobRegistry, getResourceManager(), moduleList); 66 executeSchedulingPlan(decision); 67 } 62 TimerEvent event = new TimerEvent(); 63 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 64 queues, jobRegistry, getResourceManager(), moduleList); 65 executeSchedulingPlan(decision); 66 68 67 sendTimerEvent(); 69 68 break; … … 72 71 73 72 public void notifySubmittedWorkloadUnit(WorkloadUnit wu) { 74 if (!pluginSupportsEvent(GridSimTags.GRIDLET_SUBMIT)) {75 log.error("Plugin " + schedulingPlugin.getClass()76 + " does not provide support for TASK_ARRIVED event.\n"77 + "Check plugin configuration or use default one.");78 return;79 }80 73 registerWorkloadUnit(wu); 81 82 74 } 83 75 -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java
r1430 r1440 95 95 96 96 int tag = ev.get_tag(); 97 SchedulingEvent event; 98 SchedulingPlanInterface<?> decision; 97 99 switch (tag) { 98 99 100 case DCWormsTags.TIMER: 100 if (pluginSupportsEvent(tag)) { 101 SchedulingEventevent = new SchedulingEvent(SchedulingEventType.TIMER);102 SchedulingPlanInterface<?>decision = schedulingPlugin.schedule(event,103 104 105 } 101 102 event = new SchedulingEvent(SchedulingEventType.TIMER); 103 decision = schedulingPlugin.schedule(event, 104 queues, jobRegistry, getResourceManager(), moduleList); 105 executeSchedulingPlan(decision); 106 106 107 sendTimerEvent(); 107 108 break; … … 111 112 try { 112 113 execTask.setStatus(DCWormsTags.READY); 113 if (pluginSupportsEvent(tag)) { 114 SchedulingEventevent = new StartTaskExecutionEvent(execTask.getJobId(), execTask.getId());115 SchedulingPlanInterface<?>decision = schedulingPlugin.schedule(event,116 117 118 } 114 115 event = new StartTaskExecutionEvent(execTask.getJobId(), execTask.getId()); 116 decision = schedulingPlugin.schedule(event, 117 queues, jobRegistry, getResourceManager(), moduleList); 118 executeSchedulingPlan(decision); 119 119 120 } catch (Exception e) { 120 121 e.printStackTrace(); … … 128 129 finalizeExecutable(execTask); 129 130 sendFinishedWorkloadUnit(execTask); 130 if (pluginSupportsEvent(tag)) { 131 SchedulingEvent event = new TaskFinishedEvent(execTask.getJobId(), execTask.getId()); 132 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 133 queues, jobRegistry, getResourceManager(), moduleList); 134 executeSchedulingPlan(decision); 135 } 131 event = new TaskFinishedEvent(execTask.getJobId(), execTask.getId()); 132 decision = schedulingPlugin.schedule(event, 133 queues, jobRegistry, getResourceManager(), moduleList); 134 executeSchedulingPlan(decision); 136 135 } 137 136 … … 155 154 case DCWormsTags.TASK_REQUESTED_TIME_EXPIRED: 156 155 execTask = (Executable) ev.get_data(); 157 if (pluginSupportsEvent(tag)) { 158 SchedulingEvent event = new TaskRequestedTimeExpiredEvent(execTask.getJobId(), execTask.getId()); 159 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 160 queues, jobRegistry, getResourceManager(), moduleList); 161 executeSchedulingPlan(decision); 162 } 156 event = new TaskRequestedTimeExpiredEvent(execTask.getJobId(), execTask.getId()); 157 decision = schedulingPlugin.schedule(event, 158 queues, jobRegistry, getResourceManager(), moduleList); 159 executeSchedulingPlan(decision); 163 160 break; 164 161 … … 167 164 execTask = jobRegistry.getTask(ids[0], ids[1]); 168 165 pauseTask(execTask); 169 if (pluginSupportsEvent(tag)) { 170 SchedulingEvent event = new TaskPausedEvent(ids[0], ids[1]); 171 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 172 queues, jobRegistry, getResourceManager(), moduleList); 173 executeSchedulingPlan(decision); 174 } 175 } 176 break; 166 167 event = new TaskPausedEvent(ids[0], ids[1]); 168 decision = schedulingPlugin.schedule(event, 169 queues, jobRegistry, getResourceManager(), moduleList); 170 executeSchedulingPlan(decision); 171 } 172 break; 177 173 178 174 case DCWormsTags.TASK_RESUME:{ … … 180 176 execTask = jobRegistry.getTask(ids[0], ids[1]); 181 177 resumeTask(execTask, execTask.getAllocatedResources().getLast().getResourceUnits(), true); 182 if (pluginSupportsEvent(tag)) { 183 SchedulingEvent event = new TaskResumedEvent(ids[0], ids[1]); 184 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 185 queues, jobRegistry, getResourceManager(), moduleList); 186 executeSchedulingPlan(decision); 187 } 188 } 189 break; 178 event = new TaskResumedEvent(ids[0], ids[1]); 179 decision = schedulingPlugin.schedule(event, 180 queues, jobRegistry, getResourceManager(), moduleList); 181 executeSchedulingPlan(decision); 182 } 183 break; 190 184 191 185 case DCWormsTags.TASK_MIGRATE:{ … … 195 189 (String)data[1]), execTask, execTask.getAllocatedResources().getLast().getResourceUnits(), (Map<ResourceUnitName, ResourceUnit>)data[2]); 196 190 scheduler.sendInternal(migrationTime, DCWormsTags.TASK_MOVE, data); 197 }198 break;191 } 192 break; 199 193 200 194 case DCWormsTags.TASK_MOVE:{ … … 202 196 execTask = jobRegistry.getTask((String)data[0], (String)data[1]); 203 197 moveTask(execTask, (Map<ResourceUnitName, ResourceUnit>)data[2]); 204 if (pluginSupportsEvent(tag)) { 205 SchedulingEvent event = new StartTaskExecutionEvent((String)data[0], (String)data[1]); 206 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 207 queues, jobRegistry, getResourceManager(), moduleList); 208 executeSchedulingPlan(decision); 209 } 210 } 211 break; 212 198 199 event = new StartTaskExecutionEvent((String)data[0], (String)data[1]); 200 decision = schedulingPlugin.schedule(event, 201 queues, jobRegistry, getResourceManager(), moduleList); 202 executeSchedulingPlan(decision); 203 } 204 break; 205 206 case DCWormsTags.RESOURCE_POWER_STATE_CHANGED: 207 event = new SchedulingEvent(SchedulingEventType.RESOURCE_POWER_STATE_CHANGED); 208 decision = schedulingPlugin.schedule(event, 209 queues, jobRegistry, getResourceManager(), moduleList); 210 executeSchedulingPlan(decision); 211 break; 212 213 case DCWormsTags.RESOURCE_POWER_LIMIT_EXCEEDED: 214 event = new SchedulingEvent(SchedulingEventType.RESOURCE_POWER_LIMIT_EXCEEDED); 215 String source; 216 try{ 217 source = ev.get_data().toString(); 218 } catch(Exception e){ 219 source = null; 220 } 221 event.setSource(source); 222 decision = schedulingPlugin.schedule(event, 223 queues, jobRegistry, getResourceManager(), moduleList); 224 executeSchedulingPlan(decision); 225 break; 213 226 case DCWormsTags.TASK_EXECUTION_CHANGED: 214 227 execTask = (ExecTask) ev.get_data(); 215 228 updateTaskExecutionPhase(execTask); 216 229 break; 217 218 230 case DCWormsTags.UPDATE_PROCESSING: 219 231 updateProcessingTimes(); 220 232 break; 221 233 222 case DCWormsTags.POWER_LIMIT_EXCEEDED:223 if (pluginSupportsEvent(tag)) {224 SchedulingEvent event = new SchedulingEvent(SchedulingEventType.POWER_LIMIT_EXCEEDED);225 String source;226 try{227 source = ev.get_data().toString();228 } catch(Exception e){229 source = null;230 }231 event.setSource(source);232 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event,233 queues, jobRegistry, getResourceManager(), moduleList);234 executeSchedulingPlan(decision);235 }236 break;237 234 default: 238 239 235 break; 240 236 } … … 301 297 302 298 public void notifyReturnedWorkloadUnit(WorkloadUnit wu) { 303 if (pluginSupportsEvent(DCWormsTags.TASK_EXECUTION_FINISHED)) { 304 305 306 307 308 } 309 310 311 299 300 SchedulingEvent event = new SchedulingEvent(SchedulingEventType.TASK_FINISHED); 301 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 302 queues, jobRegistry, getResourceManager(), moduleList); 303 executeSchedulingPlan(decision); 304 305 //if(scheduler.getParent() != null){ 306 sendFinishedWorkloadUnit(wu); 307 //} 312 308 } 313 309
Note: See TracChangeset
for help on using the changeset viewer.