Changeset 490
- Timestamp:
- 10/09/12 13:58:06 (13 years ago)
- Location:
- DCWoRMS/trunk/src
- Files:
-
- 6 added
- 1 deleted
- 30 edited
- 6 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/src/dcworms/schedframe/scheduling/ExecTask.java
r481 r490 1 package gssim.schedframe.scheduling;1 package dcworms.schedframe.scheduling; 2 2 3 3 import java.util.List; … … 11 11 public Object getExpectedSpecificResource(ResourceParameterName resourceName); 12 12 13 public void visitResource(String resName);13 public void trackResource(String resName); 14 14 public List<String> getVisitedResources(); 15 15 } -
DCWoRMS/trunk/src/dcworms/schedframe/scheduling/Executable.java
r481 r490 1 package gssim.schedframe.scheduling;1 package dcworms.schedframe.scheduling; 2 2 3 3 … … 15 15 import org.joda.time.ReadableDuration; 16 16 17 17 18 import schedframe.resources.computing.ComputingResource; 18 19 import schedframe.resources.units.ProcessingElements; 19 20 import schedframe.resources.units.StandardResourceUnitName; 20 21 import schedframe.scheduling.ResourceHistoryItem; 21 import schedframe.scheduling.UsedResource List;22 import schedframe.scheduling.UsedResourcesList; 22 23 import schedframe.scheduling.WorkloadUnitHandler; 23 24 import schedframe.scheduling.manager.tasks.JobRegistryImpl; … … 47 48 //TO DO remove and benefit from visitedResources 48 49 protected String schedName; 49 protected UsedResource List<ResourceHistoryItem>usedResources;50 protected UsedResourcesList usedResources; 50 51 //TO DO consider removing 51 52 protected List<String> visitedResources; … … 61 62 this.status = DCWormsTags.CREATED; 62 63 63 this.usedResources = new UsedResource List<ResourceHistoryItem>();64 this.usedResources = new UsedResourcesList(); 64 65 this.visitedResources = new ArrayList<String>(); 65 66 init(); … … 71 72 this.processesSetId = procesesSet.getId(); 72 73 73 this.usedResources = new UsedResource List<ResourceHistoryItem>();74 this.usedResources = new UsedResourcesList(); 74 75 this.visitedResources = new ArrayList<String>(); 75 76 init(); … … 77 78 78 79 protected void init() { 79 double currentTime = 80 double currentTime = DateTimeUtilsExt.getDateTimeAt(arrivalTime).getMillis() / 1000; 80 81 this.submissionTime = currentTime; 81 82 this.totalCompletionTime = 0.0; … … 157 158 } 158 159 159 if (newStatus < DCWormsTags.CREATED || newStatus > DCWormsTags.FAILED_RESOURCE_UNAVAILABLE) 160 { 161 throw new Exception("Gridlet.setGridletStatus() : Error - " + 162 "Invalid integer range for Gridlet status."); 160 if (newStatus < DCWormsTags.CREATED || newStatus > DCWormsTags.FAILED_RESOURCE_UNAVAILABLE) { 161 throw new Exception("Executable.setStatuts() : Error - " + 162 "Invalid integer range for Execiutable status."); 163 163 } 164 164 … … 175 175 } 176 176 177 if (prevStatus == DCWormsTags.INEXEC) 178 { 179 177 if (prevStatus == DCWormsTags.INEXEC) { 180 178 if (status == DCWormsTags.CANCELED || status == DCWormsTags.PAUSED || 181 status == DCWormsTags.SUCCESS) 182 { 179 status == DCWormsTags.SUCCESS) { 183 180 totalCompletionTime += (currentTime - execStartTime); 184 181 } 185 182 } 186 183 187 if (prevStatus == DCWormsTags.RESUMED && status == DCWormsTags.SUCCESS) 188 { 184 if (prevStatus == DCWormsTags.RESUMED && status == DCWormsTags.SUCCESS) { 189 185 totalCompletionTime += (currentTime - execStartTime); 190 186 } 191 187 192 188 if (status == DCWormsTags.INEXEC || 193 (prevStatus == DCWormsTags.PAUSED && status == DCWormsTags.RESUMED) ) 194 { 189 (prevStatus == DCWormsTags.PAUSED && status == DCWormsTags.RESUMED) ) { 195 190 execStartTime = currentTime; 191 196 192 ProcessingElements pes = (ProcessingElements) getUsedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE); 197 193 for (ComputingResource resource : pes) { 198 194 199 visitResource(resource.getName()); 195 trackResource(resource.getName()); 196 200 197 ComputingResource parent = resource.getParent(); 201 202 198 List<String> visitedResource = getVisitedResources(); 203 while (parent != null && !ArrayUtils.contains(visitedResource.toArray(new String[visitedResource.size()]), parent.getName())) { 204 visitResource(parent.getName()); 199 String [] visitedResourcesArray = visitedResource.toArray(new String[visitedResource.size()]); 200 while (parent != null && !ArrayUtils.contains(visitedResourcesArray, parent.getName())) { 201 trackResource(parent.getName()); 205 202 parent = parent.getParent(); 206 203 } … … 254 251 } 255 252 256 public UsedResource List<ResourceHistoryItem>getUsedResources(){253 public UsedResourcesList getUsedResources(){ 257 254 return this.usedResources; 258 255 } … … 284 281 } 285 282 286 public void visitResource(String resName){283 public void trackResource(String resName){ 287 284 visitedResources.add(resName); 288 285 } … … 346 343 return execStartTime - submissionTime; 347 344 } 348 349 345 350 346 public void finalizeExecutable(){ 351 347 try { 348 setStatus(DCWormsTags.SUCCESS); 349 } catch (Exception e) { 350 // TODO Auto-generated catch block 351 e.printStackTrace(); 352 } 352 353 } 353 354 -
DCWoRMS/trunk/src/dcworms/schedframe/scheduling/plugin/local/DCWormsTimeOperations.java
r481 r490 1 package gssim.schedframe.scheduling.plugin.local;1 package dcworms.schedframe.scheduling.plugin.local; 2 2 3 3 import org.joda.time.DateTime; -
DCWoRMS/trunk/src/dcworms/schedframe/scheduling/queues/AbstractStatsSupportingQueue.java
r477 r490 1 package gssim.schedframe.scheduling.queues;1 package dcworms.schedframe.scheduling.queues; 2 2 3 3 import java.util.ArrayList; -
DCWoRMS/trunk/src/dcworms/schedframe/scheduling/utils/JobDescription.java
r477 r490 1 package gssim.schedframe.scheduling.utils;1 package dcworms.schedframe.scheduling.utils; 2 2 3 3 import java.io.StringReader; -
DCWoRMS/trunk/src/dcworms/schedframe/scheduling/utils/TaskDescription.java
r477 r490 1 package gssim.schedframe.scheduling.utils;1 package dcworms.schedframe.scheduling.utils; 2 2 3 3 import java.io.StringReader; -
DCWoRMS/trunk/src/example/globalplugin/BaseGlobalPlugin.java
r481 r490 4 4 import schedframe.PluginConfiguration; 5 5 import schedframe.events.scheduling.SchedulingEventType; 6 import schedframe.scheduling.TaskList Impl;6 import schedframe.scheduling.TaskList; 7 7 import schedframe.scheduling.manager.resources.ResourceManager; 8 8 import schedframe.scheduling.plugin.SchedulingPluginConfiguration; … … 22 22 } 23 23 24 public int placeTasksInQueues(TaskList ImplnewTasks, TaskQueueList queues, ResourceManager resourceManager,24 public int placeTasksInQueues(TaskList newTasks, TaskQueueList queues, ResourceManager resourceManager, 25 25 ModuleList moduleList) { 26 26 -
DCWoRMS/trunk/src/example/localplugin/BaseLocalSchedulingPlugin.java
r481 r490 10 10 import schedframe.resources.units.ResourceUnit; 11 11 import schedframe.resources.units.ResourceUnitName; 12 import schedframe.scheduling.TaskList Impl;12 import schedframe.scheduling.TaskList; 13 13 import schedframe.scheduling.manager.resources.ResourceManager; 14 14 import schedframe.scheduling.manager.tasks.JobRegistryImpl; … … 45 45 } 46 46 47 public int placeTasksInQueues(TaskList ImplnewTasks,47 public int placeTasksInQueues(TaskList newTasks, 48 48 TaskQueueList queues, 49 49 ResourceManager resourceManager, ModuleList moduleList) { -
DCWoRMS/trunk/src/example/localplugin/FCFSCPUFreqScalingClusterLocalPlugin.java
r481 r490 2 2 3 3 import gridsim.gssim.DCWormsTags; 4 import gssim.schedframe.scheduling.Executable;5 4 6 5 import java.util.ArrayList; … … 19 18 import schedframe.resources.units.ResourceUnitName; 20 19 import schedframe.resources.units.StandardResourceUnitName; 21 import schedframe.scheduling.ResourceHistoryItem; 22 import schedframe.scheduling.UsedResourceList; 20 import schedframe.scheduling.UsedResourcesList; 23 21 import schedframe.scheduling.manager.resources.ClusterResourceManager; 24 22 import schedframe.scheduling.manager.resources.ResourceManager; … … 31 29 import schedframe.scheduling.tasks.TaskInterface; 32 30 import schedframe.scheduling.tasks.WorkloadUnit; 31 import dcworms.schedframe.scheduling.Executable; 33 32 34 33 public class FCFSCPUFreqScalingClusterLocalPlugin extends BaseLocalSchedulingPlugin { … … 77 76 TaskFinishedEvent finEvent = (TaskFinishedEvent) event; 78 77 Executable exec = (Executable) jobRegistry.getExecutable(finEvent.getJobId(), finEvent.getTaskId()); 79 UsedResource List<ResourceHistoryItem>usedResourcesList = exec.getUsedResources();78 UsedResourcesList usedResourcesList = exec.getUsedResources(); 80 79 ProcessingElements pes = (ProcessingElements)usedResourcesList.getLast().getResourceUnits().get(StandardResourceUnitName.PE); 81 80 List<Processor> processors = new ArrayList<Processor>(); -
DCWoRMS/trunk/src/example/timeestimation/DefaultTimeEstimationPlugin.java
r477 r490 1 1 package example.timeestimation; 2 2 3 import gssim.schedframe.scheduling.ExecTask;4 3 5 4 import java.util.Map; 5 6 import dcworms.schedframe.scheduling.ExecTask; 6 7 7 8 import schedframe.events.scheduling.SchedulingEvent; -
DCWoRMS/trunk/src/gridsim/gssim/filter/ExecTaskFilter.java
r481 r490 1 1 package gridsim.gssim.filter; 2 2 3 import dcworms.schedframe.scheduling.Executable; 3 4 import eduni.simjava.Sim_event; 4 5 import gridsim.filter.FilterResult; 5 import gssim.schedframe.scheduling.Executable;6 6 7 7 /** … … 11 11 public class ExecTaskFilter extends FilterResult { 12 12 13 public ExecTaskFilter(int gridletID, int tag) {14 super( gridletID, tag);13 public ExecTaskFilter(int taskId, int tag) { 14 super(taskId, tag); 15 15 } 16 16 -
DCWoRMS/trunk/src/schedframe/ExecutablesList.java
r481 r490 1 1 package schedframe; 2 2 3 import gssim.schedframe.scheduling.ExecTask;4 import gssim.schedframe.scheduling.Executable;5 3 6 4 import java.util.ArrayList; … … 11 9 import java.util.ListIterator; 12 10 11 import dcworms.schedframe.scheduling.ExecTask; 12 import dcworms.schedframe.scheduling.Executable; 13 13 14 public class ExecutablesList implements List<ExecTask> { 14 15 15 16 private List<ExecTask> executables; 17 16 18 public ExecutablesList (){ 17 19 executables = Collections.synchronizedList(new ArrayList<ExecTask>()); 18 20 } 19 20 21 21 22 public List<Executable> getJobExecutables(String jobId){ -
DCWoRMS/trunk/src/schedframe/ResourceController.java
r477 r490 19 19 protected static List<ComputingResource> computingResources; 20 20 protected Deque<Initializable> toInit; 21 protected Set<String> compResLayers; 21 22 22 23 public ResourceController(Scheduler logicalStructure, List<ComputingResource> compResources){ … … 144 145 } 145 146 147 public Set<String> getComputingResourceLayers() { 148 return compResLayers; 149 } 150 151 public void setCompResLayers(Set<String> compResLayers) { 152 this.compResLayers = compResLayers; 153 } 154 155 146 156 } -
DCWoRMS/trunk/src/schedframe/scheduling/UsedResourcesList.java
r477 r490 3 3 import java.util.LinkedList; 4 4 5 public class UsedResource List<E> extends LinkedList<E>{5 public class UsedResourcesList extends LinkedList<ResourceHistoryItem>{ 6 6 7 7 /** -
DCWoRMS/trunk/src/schedframe/scheduling/WorkloadUnitHandler.java
r481 r490 1 1 package schedframe.scheduling; 2 2 3 import schedframe.scheduling.tasks.Job; 3 import dcworms.schedframe.scheduling.ExecTask; 4 import schedframe.scheduling.tasks.JobInterface; 5 import schedframe.scheduling.tasks.TaskInterface; 4 6 5 import schedframe.scheduling.tasks.TaskInterface; 6 import gssim.schedframe.scheduling.ExecTask; 7 8 public interface WorkloadUnitHandler{ 7 public interface WorkloadUnitHandler{ 9 8 10 public void handleJob(Job job);9 public void handleJob(JobInterface<?> job); 11 10 12 11 public void handleTask(TaskInterface<?> task); -
DCWoRMS/trunk/src/schedframe/scheduling/manager/resources/LocalResourceManager.java
r477 r490 13 13 import java.util.Properties; 14 14 import java.util.Set; 15 import java.util.Stack;16 15 17 16 import schedframe.exceptions.ResourceException; … … 175 174 return resourceUnit; 176 175 } 177 /*public List<AbstractResourceUnit> getAvailableResourceUnits(String resourceName) throws Exception {178 ComputingResource resource = getResourceByName(resourceName);179 List<AbstractResourceUnit> resourceUnits = new ArrayList<AbstractResourceUnit>();180 while(resource != null){181 for(List<AbstractResourceUnit> resUnits: resource.getResourceCharacteristic().getResourceUnits().values())182 resUnits.addAll(resourceUnits);183 resource = resource.getParent();184 }185 186 return resourceUnits;187 }*/188 176 189 177 public List<? extends ComputingResource> filterResources(Properties properties) { … … 242 230 computingResources = (List<ComputingResource>) getResourcesOfType(StandardResourceType.Core); 243 231 } catch (ResourceException e) { 244 throw new RuntimeException(" GSSIMinternal error");232 throw new RuntimeException("DCWorms internal error"); 245 233 } 246 234 PEUnit peUnit = new ProcessingElements(computingResources); … … 253 241 computingResources = (List<ComputingResource>) getResourcesOfType(StandardResourceType.Processor); 254 242 } catch (ResourceException e) { 255 throw new RuntimeException(" GSSIMinternal error");243 throw new RuntimeException("DCWorms internal error"); 256 244 } 257 245 PEUnit peUnit = new ProcessingElements(computingResources); … … 318 306 return false; 319 307 } 320 /*ResourceUnit peUnit = resources.get(StandardResourceUnitName.PE);321 322 if (peUnit != null) {323 if (peUnit instanceof ProcessingElements) {324 ProcessingElements choosenProcessors = (ProcessingElements) peUnit;325 326 for (int i = 0; i < choosenProcessors.size(); i++) {327 choosenProcessors.get(i).setStatus(ResourceStatus.BUSY);328 }329 }330 }*/331 332 /*Memory m = (Memory) resources.get(StandardResourceUnitName.MEMORY);333 if (m != null) {334 m.getProvisioner().setState(ResourceUnitState.BUSY);335 }*/336 308 337 309 for(ResourceUnitName resUnitName: resources.keySet()){ … … 345 317 public void freeResources(Map<ResourceUnitName, ResourceUnit> resources) { 346 318 347 /*ResourceUnit peUnit = resources.get(StandardResourceUnitName.PE);348 349 if (peUnit instanceof ProcessingElements) {350 ProcessingElements processingElements = (ProcessingElements) peUnit;351 352 for (int i = 0; i < processingElements.size(); i++) {353 processingElements.get(i).setStatus(ResourceStatus.FREE);354 }355 }*/356 357 /*Memory m = (Memory) resources.get(StandardResourceUnitName.MEMORY);358 if (m != null) {359 m.getProvisioner().setState(ResourceUnitState.FREE);360 }*/361 362 319 for(ResourceUnitName resUnitName: resources.keySet()){ 363 320 ResourceUnit resUnit = resources.get(resUnitName); … … 366 323 } 367 324 368 369 325 } -
DCWoRMS/trunk/src/schedframe/scheduling/manager/tasks/JobRegistry.java
r481 r490 1 1 package schedframe.scheduling.manager.tasks; 2 2 3 import gssim.schedframe.scheduling.ExecTask;4 3 5 4 import java.util.List; 5 6 import dcworms.schedframe.scheduling.ExecTask; 6 7 7 8 import schedframe.ExecutablesList; -
DCWoRMS/trunk/src/schedframe/scheduling/manager/tasks/JobRegistryImpl.java
r481 r490 2 2 3 3 import gridsim.gssim.DCWormsTags; 4 import gssim.schedframe.scheduling.ExecTask;5 4 6 5 import java.util.ArrayList; … … 12 11 import org.qcg.broker.schemas.resreqs.ParentType; 13 12 import org.qcg.broker.schemas.resreqs.types.TaskStatesName; 13 14 import dcworms.schedframe.scheduling.ExecTask; 14 15 15 16 import qcg.shared.constants.BrokerConstants; … … 82 83 synchronized (executables) { 83 84 for (ExecTask task : executables) { 84 if (task.getJobId().compareTo(jobId) == 0 && task.getId().compareTo(taskId) ==0) {85 if (task.getJobId().compareTo(jobId) == 0 && task.getId().compareTo(taskId) == 0) { 85 86 return task; 86 87 } -
DCWoRMS/trunk/src/schedframe/scheduling/plugin/SchedulingPlugin.java
r481 r490 3 3 import schedframe.Plugin; 4 4 import schedframe.events.scheduling.SchedulingEvent; 5 import schedframe.scheduling.TaskList; 5 6 import schedframe.scheduling.TaskListImpl; 6 7 import schedframe.scheduling.manager.resources.ResourceManager; … … 12 13 public interface SchedulingPlugin extends Plugin{ 13 14 14 public int placeTasksInQueues(TaskList ImplnewTasks,15 public int placeTasksInQueues(TaskList newTasks, 15 16 TaskQueueList queues, 16 17 ResourceManager resourceManager, ModuleList modules); -
DCWoRMS/trunk/src/schedframe/scheduling/plugin/estimation/ExecutionTimeEstimationPlugin.java
r477 r490 1 1 package schedframe.scheduling.plugin.estimation; 2 2 3 import gssim.schedframe.scheduling.ExecTask;4 3 5 4 import java.util.Map; 5 6 import dcworms.schedframe.scheduling.ExecTask; 6 7 7 8 import schedframe.Plugin; -
DCWoRMS/trunk/src/schedframe/scheduling/policy/AbstractManagementSystem.java
r481 r490 7 7 import org.apache.commons.logging.LogFactory; 8 8 import org.joda.time.DateTimeUtilsExt; 9 10 import dcworms.schedframe.scheduling.ExecTask; 11 import dcworms.schedframe.scheduling.Executable; 12 import dcworms.schedframe.scheduling.queues.AbstractStatsSupportingQueue; 9 13 10 14 import schedframe.PluginConfiguration; … … 34 38 import gridsim.IO_data; 35 39 import gridsim.gssim.DCWormsTags; 36 import gssim.schedframe.scheduling.ExecTask;37 import gssim.schedframe.scheduling.Executable;38 import gssim.schedframe.scheduling.queues.AbstractStatsSupportingQueue;39 40 40 41 public abstract class AbstractManagementSystem { … … 144 145 return; 145 146 } 146 //Executable exec = (Executable) wu;147 147 removeFromQueue(task); 148 148 scheduler.send(providerName, GridSimTags.SCHEDULE_NOW, GridSimTags.GRIDLET_SUBMIT, task); … … 199 199 } 200 200 201 protected boolean removeFromQueue( WorkloadUnit wu) {201 protected boolean removeFromQueue(TaskInterface<?> task) { 202 202 for(TaskQueue queue : queues){ 203 if(queue.contains( wu)){204 queue.remove( wu);203 if(queue.contains(task)){ 204 queue.remove(task); 205 205 return true; 206 206 } -
DCWoRMS/trunk/src/schedframe/scheduling/policy/global/GlobalManagementSystem.java
r481 r490 11 11 import org.qcg.broker.schemas.schedulingplan.types.AllocationStatus; 12 12 13 import dcworms.schedframe.scheduling.ExecTask; 14 import dcworms.schedframe.scheduling.Executable; 15 13 16 import qcg.shared.constants.BrokerConstants; 14 import schedframe.events.scheduling.SchedulingEvent;15 17 import schedframe.events.scheduling.TaskArrivedEvent; 16 18 import schedframe.events.scheduling.TimerEvent; 19 import schedframe.scheduling.TaskListImpl; 17 20 import schedframe.scheduling.WorkloadUnitHandler; 18 import schedframe.scheduling.TaskListImpl;19 21 import schedframe.scheduling.plan.AllocationInterface; 20 22 import schedframe.scheduling.plan.ScheduledTaskInterface; … … 35 37 import gridsim.IO_data; 36 38 import gridsim.gssim.DCWormsTags; 37 import gssim.schedframe.scheduling.ExecTask;38 import gssim.schedframe.scheduling.Executable;39 39 40 40 public class GlobalManagementSystem extends AbstractManagementSystem { … … 80 80 81 81 registerWorkloadUnit(wu); 82 /*Job job = (Job) wu;83 jobRegistry.addJob(job);84 85 if (log.isInfoEnabled())86 log.info("Received job " + job.getId() + " at " + new DateTime(DateTimeUtilsExt.currentTimeMillis()));87 88 List<JobInterface<?>> jobsList = new ArrayList<JobInterface<?>>();89 jobsList.add(job);90 WorkloadUnitList readyWorkloadUnits = new WorkloadUnitList();91 readyWorkloadUnits.addAll(jobRegistry.getReadyTasks(jobsList));92 schedulingPlugin.placeJobsInQueues(readyWorkloadUnits, queues, getResourceManager(), moduleList);93 94 schedule(new TaskArrivedEvent());*/95 82 96 83 } … … 104 91 105 92 106 protected void schedule AvaialbleTasks(Jobjob){93 protected void schedule(JobInterface<?> job){ 107 94 List<JobInterface<?>> jobsList = new ArrayList<JobInterface<?>>(); 108 95 jobsList.add(job); … … 111 98 112 99 schedulingPlugin.placeTasksInQueues(readyTasks, queues, getResourceManager(), moduleList); 113 schedule(new TaskArrivedEvent());114 }115 116 protected void schedule(SchedulingEvent schedulingEvent) {117 118 100 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule( 119 schedulingEvent, queues, getJobRegistry(), getResourceManager(), moduleList);101 new TaskArrivedEvent(), queues, getJobRegistry(), getResourceManager(), moduleList); 120 102 if (decision != null) 121 103 executeSchedulingPlan(decision); 122 104 } 123 105 124 106 public void notifyReturnedWorkloadUnit(WorkloadUnit wu) { 125 107 Executable exec = (Executable) wu; … … 133 115 try { 134 116 Job job = jobRegistry.getJob(exec.getJobId()); 135 /*Task task = job.getTask(exec.getTaskId());117 Task task = job.getTask(exec.getTaskId()); 136 118 if(exec.getProcessesId() == null){ 137 119 try { 138 120 task.setStatus(exec.getStatus()); 139 121 } catch (Exception e) { 140 // TODO Auto-generated catch block 141 e.printStackTrace(); 122 142 123 } 143 124 } else { … … 150 131 } 151 132 } 152 } */133 } 153 134 154 135 if(job.isFinished()){ … … 156 137 } 157 138 else { 158 scheduleAvaialbleTasks(job); 159 /*List<JobInterface<?>> jobs = new ArrayList<JobInterface<?>>(); 160 jobs.add(jobRegistry.getJobInfo(job.getId())); 161 WorkloadUnitList readyWorkloadUnits = new WorkloadUnitList(); 162 readyWorkloadUnits.addAll(jobRegistry.getReadyTasks(jobs)); 163 schedulingPlugin.placeJobsInQueues(readyWorkloadUnits, queues, 164 getResourceManager(), moduleList); 165 schedule(new TaskArrivedEvent());*/ 139 schedule(job); 166 140 } 167 141 … … 269 243 IO_data data = new IO_data(task, 0, resID); 270 244 scheduler.send(scheduler.getOutputPort(), GridSimTags.SCHEDULE_NOW, GridSimTags.GRIDLET_SUBMIT, data); 271 272 //scheduler.send(providerName, GridSimTags.SCHEDULE_NOW, GridSimTags.GRIDLET_SUBMIT, job);245 //scheduler.send(providerName, GridSimTags.SCHEDULE_NOW, GridSimTags.GRIDLET_SUBMIT, job); 246 273 247 if(log.isDebugEnabled()) 274 248 log.debug("Submitted job " + task.getId() + " to " + providerName); … … 278 252 class GlobalWorkloadUnitHandler implements WorkloadUnitHandler{ 279 253 280 public void handleJob(Job job){ 281 254 public void handleJob(JobInterface<?> job){ 282 255 if (log.isInfoEnabled()) 283 256 log.info("Received job " + job.getId() + " at " + new DateTime(DateTimeUtilsExt.currentTimeMillis())); 284 257 285 258 jobRegistry.addJob(job); 286 schedule AvaialbleTasks(job);259 schedule(job); 287 260 } 288 261 … … 294 267 throw new RuntimeException("Not implemented since it isn't expected that tasks are send directly to the global scheduler."); 295 268 } 296 297 269 } 298 270 -
DCWoRMS/trunk/src/schedframe/scheduling/policy/local/LocalManagementSystem.java
r481 r490 1 1 package schedframe.scheduling.policy.local; 2 2 3 import dcworms.schedframe.scheduling.ExecTask; 4 import dcworms.schedframe.scheduling.Executable; 3 5 import eduni.simjava.Sim_event; 4 6 import eduni.simjava.Sim_system; … … 7 9 import gridsim.gssim.DCWormsTags; 8 10 import gridsim.gssim.filter.ExecTaskFilter; 9 import gssim.schedframe.scheduling.ExecTask;10 import gssim.schedframe.scheduling.Executable;11 11 12 12 import java.util.ArrayList; … … 41 41 import schedframe.scheduling.ResourceHistoryItem; 42 42 import schedframe.scheduling.Scheduler; 43 import schedframe.scheduling.TaskList; 43 44 import schedframe.scheduling.TaskListImpl; 44 import schedframe.scheduling.UsedResource List;45 import schedframe.scheduling.UsedResourcesList; 45 46 import schedframe.scheduling.WorkloadUnitHandler; 46 47 import schedframe.scheduling.manager.resources.LocalResourceManager; … … 78 79 79 80 super(providerId, entityName, execTimeEstimationPlugin, queues); 80 81 //schedulingPlugin = (LocalSchedulingPlugin) InstanceFactory.createInstance(schedulingPluginClassName, LocalSchedulingPlugin.class);82 81 83 82 if (schedPlugin == null) { … … 85 84 } 86 85 this.schedulingPlugin = schedPlugin; 87 accTotalLoad = new Accumulator();88 moduleList = new ModuleListImpl(1);89 86 this.moduleList = new ModuleListImpl(1); 87 88 this.accTotalLoad = new Accumulator(); 90 89 } 91 90 92 91 public void init(Scheduler sched, ManagedResources managedResources) { 93 92 super.init(sched, managedResources); 94 //scheduler = sched;95 //resourceManager = ResourceManagerFactory.createResourceManager(scheduler);96 93 double load = 0; 97 94 accTotalLoad.add(load); … … 115 112 } 116 113 sendTimerEvent(); 117 118 114 break; 119 115 120 116 case DCWormsTags.TASK_READY_FOR_EXECUTION: 121 117 122 ExecTask data= (ExecTask) ev.get_data();123 try { 124 data.setStatus(DCWormsTags.READY);118 ExecTask execTask = (ExecTask) ev.get_data(); 119 try { 120 execTask.setStatus(DCWormsTags.READY); 125 121 if (pluginSupportsEvent(tag)) { 126 SchedulingEvent event = new StartTaskExecutionEvent( data.getJobId(), data.getId());122 SchedulingEvent event = new StartTaskExecutionEvent(execTask.getJobId(), execTask.getId()); 127 123 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 128 124 queues, getJobRegistry(), getResourceManager(), moduleList); … … 136 132 case DCWormsTags.TASK_EXECUTION_FINISHED: 137 133 obj = ev.get_data(); 138 ExecTask exec = (ExecTask) obj; 139 if (exec.getStatus() == DCWormsTags.INEXEC) { 140 finalizeExecutable(exec); 141 142 sendFinishedWorkloadUnit(exec); 143 //task.setGridletStatus(Gridlet.SUCCESS); 144 //task.finalizeGridlet(); 145 log.debug(exec.getJobId() + "_" + exec.getId() + " finished execution on " + new DateTime()); 134 execTask = (ExecTask) obj; 135 if (execTask.getStatus() == DCWormsTags.INEXEC) { 136 137 finalizeExecutable(execTask); 138 sendFinishedWorkloadUnit(execTask); 139 log.debug(execTask.getJobId() + "_" + execTask.getId() + " finished execution on " + new DateTime()); 146 140 log.info(DCWormsConstants.USAGE_MEASURE_NAME + ": " + calculateTotalLoad(jobRegistry.getRunningTasks().size())); 147 /*UsedResourceList<ResourceHistoryItem> lastUsedList = task.getUsedResources(); 148 Map<ResourceUnitName, AbstractResourceUnit> lastUsed = lastUsedList.getLast() 149 .getResourceUnits(); 150 getAllocationManager().freeResources(lastUsed); 151 ProcessingElements pes = (ProcessingElements) lastUsed.get(StandardResourceUnitName.PROCESSINGELEMENTS); 152 for (ComputingResource resource : pes) { 153 resource.handleEvent(new EnergyEvent(EnergyEventType.TASK_FINISHED, task)); 141 if (pluginSupportsEvent(tag)) { 142 SchedulingEvent event = new TaskFinishedEvent(execTask.getJobId(), execTask.getId()); 143 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 144 queues, getJobRegistry(), getResourceManager(), moduleList); 145 executeSchedulingPlan(decision); 154 146 } 155 SubTaskFilter filter = new SubTaskFilter(task.getGridletID(), GssimTags.TASK_REQUESTED_TIME_EXPIRED); 156 scheduler.sim_cancel(filter, null); 157 super.sendFinishJob((Executable) task.getGridlet());*/ 158 } 147 } 148 149 Job job = jobRegistry.getJob(execTask.getJobId()); 150 if(!job.isFinished()){ 151 getWorkloadUnitHandler().handleJob(job); 152 } 153 break; 154 155 case DCWormsTags.TASK_REQUESTED_TIME_EXPIRED: 156 obj = ev.get_data(); 157 execTask = (Executable) obj; 159 158 if (pluginSupportsEvent(tag)) { 160 SchedulingEvent event = new Task FinishedEvent(exec.getJobId(), exec.getId());159 SchedulingEvent event = new TaskRequestedTimeExpiredEvent(execTask.getJobId(), execTask.getId()); 161 160 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 162 161 queues, getJobRegistry(), getResourceManager(), moduleList); 163 162 executeSchedulingPlan(decision); 164 163 } 165 Job job = jobRegistry.getJob(exec.getJobId());166 if(!job.isFinished()){167 getWorkloadUnitHandler().handleJob(job);168 }169 170 164 break; 171 case DCWormsTags.TASK_REQUESTED_TIME_EXPIRED: 172 obj = ev.get_data(); 173 exec = (Executable) obj; 174 if (pluginSupportsEvent(tag)) { 175 SchedulingEvent event = new TaskRequestedTimeExpiredEvent(exec.getJobId(), exec.getId()); 176 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 177 queues, getJobRegistry(), getResourceManager(), moduleList); 178 executeSchedulingPlan(decision); 179 } 180 181 break; 165 182 166 case DCWormsTags.UPDATE: 183 167 updateProcessingTimes(ev); … … 185 169 } 186 170 } 187 188 171 189 172 public void notifyReturnedWorkloadUnit(WorkloadUnit wu) { … … 223 206 } else { 224 207 ExecTask exec = (ExecTask) task; 225 executeTask(exec, chooseResourcesForExecution(allocation.getProviderName(), (ExecTask)task));208 executeTask(exec, chooseResourcesForExecution(allocation.getProviderName(), exec)); 226 209 } 227 210 } … … 237 220 return; 238 221 removeFromQueue(task); 239 //double completionPercentage = (submittedTask.getLength() - submittedTask.getRemainingGridletLength())/submittedTask.getLength(); 222 240 223 SchedulingEvent event = new SchedulingEvent(SchedulingEventType.START_TASK_EXECUTION); 241 224 int time = Double.valueOf( … … 251 234 ResourceHistoryItem resHistItem = new ResourceHistoryItem(choosenResources, currentTime); 252 235 exec.addUsedResources(resHistItem); 253 254 scheduler.sendInternal(time, DCWormsTags.TASK_EXECUTION_FINISHED, 255 exec); 236 try { 237 exec.setStatus(DCWormsTags.INEXEC); 238 } catch (Exception e) { 239 // TODO Auto-generated catch block 240 e.printStackTrace(); 241 } 242 scheduler.sendInternal(time, DCWormsTags.TASK_EXECUTION_FINISHED, exec); 256 243 257 244 try { … … 262 249 scheduler.sendInternal(t, DCWormsTags.TASK_REQUESTED_TIME_EXPIRED, exec); 263 250 } 264 265 try { 266 exec.setStatus(DCWormsTags.INEXEC); 267 } catch (Exception e1) { 268 // TODO Auto-generated catch block 269 e1.printStackTrace(); 270 } 251 271 252 log.info(DCWormsConstants.USAGE_MEASURE_NAME + ": " + calculateTotalLoad(jobRegistry.getRunningTasks().size())); 272 253 273 254 PEUnit peUnit = (PEUnit)choosenResources.get(StandardResourceUnitName.PE); 274 if(peUnit instanceof ProcessingElements){ 255 256 notifyComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec); 257 258 /*if(peUnit instanceof ProcessingElements){ 275 259 ProcessingElements pes = (ProcessingElements) peUnit; 276 260 for (ComputingResource resource : pes) { 277 resource.handleEvent(new EnergyEvent(EnergyEventType.TASK_ FINISHED, exec));261 resource.handleEvent(new EnergyEvent(EnergyEventType.TASK_STARTED, exec)); 278 262 } 279 263 } else { … … 282 266 resource = ResourceController.getComputingResourceByName(peUnit.getResourceId()); 283 267 } catch (ResourceException e) { 284 285 } 286 resource.handleEvent(new EnergyEvent(EnergyEventType.TASK_FINISHED, exec)); 287 } 288 /*ProcessingElements pes = (ProcessingElements) choosenResources.get(StandardResourceUnitName.PE); 289 for (ComputingResource resource : pes) { 290 resource.handleEvent(new EnergyEvent(EnergyEventType.TASK_STARTED, submittedTask)); 291 }*/ 268 return; 269 } 270 resource.handleEvent(new EnergyEvent(EnergyEventType.TASK_STARTED, exec)); 271 } 272 */ 292 273 293 274 /*for(ExecTaskInterface etask : jobRegistry.getRunningTasks()){ … … 301 282 302 283 Executable exec = (Executable)execTask; 303 try {304 exec.setStatus(DCWormsTags.SUCCESS);305 } catch (Exception e1) {306 // TODO Auto-generated catch block307 e1.printStackTrace();308 }309 284 exec.finalizeExecutable(); 310 UsedResourceList<ResourceHistoryItem> lastUsedList = exec.getUsedResources(); 311 Map<ResourceUnitName, ResourceUnit> lastUsed = lastUsedList.getLast() 312 .getResourceUnits(); 313 getAllocationManager().freeResources(lastUsed); 314 315 PEUnit peUnit = (PEUnit)lastUsed.get(StandardResourceUnitName.PE); 316 if(peUnit instanceof ProcessingElements){ 317 ProcessingElements pes = (ProcessingElements) peUnit; 318 for (ComputingResource resource : pes) { 319 resource.handleEvent(new EnergyEvent(EnergyEventType.TASK_FINISHED, exec)); 320 } 321 } else { 322 ComputingResource resource = null; 323 try { 324 resource = ResourceController.getComputingResourceByName(peUnit.getResourceId()); 325 } catch (ResourceException e) { 326 327 } 328 resource.handleEvent(new EnergyEvent(EnergyEventType.TASK_FINISHED, exec)); 329 } 330 /*ProcessingElements pes = (ProcessingElements) lastUsed.get(StandardResourceUnitName.PE); 331 for (ComputingResource resource : pes) { 332 resource.handleEvent(new EnergyEvent(EnergyEventType.TASK_FINISHED, subTask)); 333 }*/ 285 334 286 ExecTaskFilter filter = new ExecTaskFilter(exec.getUniqueId(), DCWormsTags.TASK_REQUESTED_TIME_EXPIRED); 335 287 scheduler.sim_cancel(filter, null); 336 288 337 289 Task task; 338 290 Job job = jobRegistry.getJob(exec.getJobId()); 339 340 Task task = null;341 291 try { 342 292 task = job.getTask(exec.getTaskId()); 343 293 } catch (NoSuchFieldException e) { 344 e.printStackTrace();294 return; 345 295 } 346 296 if(exec.getProcessesId() == null){ … … 360 310 } 361 311 } 312 313 UsedResourcesList lastUsedList = exec.getUsedResources(); 314 Map<ResourceUnitName, ResourceUnit> lastUsed = lastUsedList.getLast() 315 .getResourceUnits(); 316 getAllocationManager().freeResources(lastUsed); 317 318 PEUnit peUnit = (PEUnit)lastUsed.get(StandardResourceUnitName.PE); 319 notifyComputingResources(peUnit, EnergyEventType.TASK_FINISHED, exec); 320 /*if(peUnit instanceof ProcessingElements){ 321 ProcessingElements pes = (ProcessingElements) peUnit; 322 for (ComputingResource resource : pes) { 323 resource.handleEvent(new EnergyEvent(EnergyEventType.TASK_FINISHED, exec)); 324 } 325 } else { 326 ComputingResource resource = null; 327 try { 328 resource = ResourceController.getComputingResourceByName(peUnit.getResourceId()); 329 } catch (ResourceException e) { 330 return; 331 } 332 resource.handleEvent(new EnergyEvent(EnergyEventType.TASK_FINISHED, exec)); 333 }*/ 334 362 335 //sendFinishedWorkloadUnit(executable); 363 336 } … … 374 347 ExecTask task = iter.next(); 375 348 Executable exec = (Executable)task; 376 UsedResource List<ResourceHistoryItem>usedResourcesList = exec.getUsedResources();377 ResourceUnit unit =usedResourcesList.getLast().getResourceUnits()349 UsedResourcesList usedResourcesList = exec.getUsedResources(); 350 PEUnit peUnit = (PEUnit)usedResourcesList.getLast().getResourceUnits() 378 351 .get(StandardResourceUnitName.PE); 379 352 380 double load = getMIShare(timeSpan, (PEUnit) unit);353 double load = getMIShare(timeSpan, peUnit); 381 354 exec.setCompletionPercentage(100 * timeSpan/exec.getEstimatedDuration()); 382 355 addTotalLoad(load); 383 356 } 384 357 } 385 358 private void notifyComputingResources(PEUnit peUnit, EnergyEventType eventType, Object obj){ 359 360 if(peUnit instanceof ProcessingElements){ 361 ProcessingElements pes = (ProcessingElements) peUnit; 362 for (ComputingResource resource : pes) { 363 resource.handleEvent(new EnergyEvent(eventType, obj)); 364 } 365 } else { 366 ComputingResource resource = null; 367 try { 368 resource = ResourceController.getComputingResourceByName(peUnit.getResourceId()); 369 } catch (ResourceException e) { 370 return; 371 } 372 resource.handleEvent(new EnergyEvent(eventType, obj)); 373 } 374 } 375 386 376 private double getMIShare(double timeSpan, PEUnit pes) { 387 377 double localLoad; … … 402 392 protected void updateProcessingTimes(Sim_event ev) { 403 393 updateProcessingProgress(); 404 for (ExecTask task : jobRegistry.getRunningTasks()) {405 Executable exec = (Executable) task;394 for (ExecTask execTask : jobRegistry.getRunningTasks()) { 395 Executable exec = (Executable)execTask; 406 396 List<String> visitedResource = exec.getVisitedResources(); 407 397 String originResource = ev.get_data().toString(); … … 411 401 412 402 Map<ResourceUnitName, ResourceUnit> choosenResources = exec.getUsedResources().getLast().getResourceUnits(); 413 //double completionPercentage = (task.getLength() - subTask.getRemainingGridletLength())/task.getLength();414 403 double time = execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent(SchedulingEventType.RESOURCE_STATE_CHANGED), 415 task, choosenResources, exec.getCompletionPercentage()); 416 417 /*if(!subTask.getVisitedResources().contains(ev.get_data().toString())) { 418 continue; 419 }*/ 404 execTask, choosenResources, exec.getCompletionPercentage()); 405 420 406 //check if the new estimated end time is equal to the previous one; if yes the continue without update 421 407 if( DoubleMath.subtract((exec.getExecStartTime() + exec.getEstimatedDuration()), (new DateTime().getMillis()/1000 + time)) == 0.0){ … … 424 410 ExecTaskFilter filter = new ExecTaskFilter(exec.getUniqueId(), DCWormsTags.TASK_EXECUTION_FINISHED); 425 411 scheduler.sim_cancel(filter, null); 426 scheduler.sendInternal(time, DCWormsTags.TASK_EXECUTION_FINISHED, task); 427 412 scheduler.sendInternal(time, DCWormsTags.TASK_EXECUTION_FINISHED, execTask); 428 413 } 429 414 } … … 443 428 numberOfPE = numberOfPE + resUnit.getAmount(); 444 429 } 445 //numberOfPE = getResourceManager().getPE().size();446 430 } catch (Exception e) { 447 431 numberOfPE = 1; … … 464 448 ExecTask task) { 465 449 450 Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>(); 466 451 ResourceManager resourceManager = this.resourceManager; 467 452 if(resourceName != null){ … … 472 457 return null; 473 458 } 474 475 459 resourceManager = new LocalResourceManager(resource); 476 460 } 477 Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>();478 479 461 480 462 int cpuRequest; … … 485 467 } 486 468 487 //PEUnit processingUnits = null;488 469 if (cpuRequest != 0) { 489 470 … … 494 475 return null; 495 476 } 477 496 478 List<ResourceUnit> choosenPEUnits = new ArrayList<ResourceUnit>(); 497 498 479 for (int i = 0; i < availableUnits.size() && cpuRequest > 0; i++) { 499 480 PEUnit peUnit = (PEUnit) availableUnits .get(i); … … 508 489 return null; 509 490 } 510 511 491 map.put(StandardResourceUnitName.PE, choosenPEUnits.get(0)); 512 492 } … … 529 509 class LocalWorkloadUnitHandler implements WorkloadUnitHandler{ 530 510 531 public void handleJob(Job job){511 public void handleJob(JobInterface<?> job){ 532 512 533 513 if (log.isInfoEnabled()) … … 536 516 List<JobInterface<?>> jobsList = new ArrayList<JobInterface<?>>(); 537 517 jobsList.add(job); 538 TaskListImpl readyTasks = new TaskListImpl();518 TaskListImpl availableTasks = new TaskListImpl(); 539 519 for(Task task: jobRegistry.getAvailableTasks(jobsList)){ 540 520 task.setStatus((int)BrokerConstants.TASK_STATUS_QUEUED); 541 readyTasks.add(task);542 } 543 544 for( WorkloadUnit e:readyTasks){545 registerWorkloadUnit( e);546 } 547 } 548 549 public void handleTask(TaskInterface<?> t i){550 Task task = (Task)t i;521 availableTasks.add(task); 522 } 523 524 for(TaskInterface<?> task: availableTasks){ 525 registerWorkloadUnit(task); 526 } 527 } 528 529 public void handleTask(TaskInterface<?> t){ 530 Task task = (Task)t; 551 531 List<AbstractProcesses> processes = task.getProcesses(); 552 532 … … 564 544 565 545 public void handleExecutable(ExecTask task){ 546 566 547 Executable exec = (Executable) task; 567 568 // int cost = 569 // this.resourceManager.getResourceCharacteristic().getResUnits() != 570 // null ? 571 // this.resourceManager.getResourceCharacteristic().getResUnits().get(ResourceParameterName.COST).getAmount() 572 // : 1; 573 574 exec.visitResource(scheduler.get_name()); 548 jobRegistry.addExecTask(exec); 549 550 exec.trackResource(scheduler.get_name()); 575 551 Scheduler parentScheduler = scheduler.getParent(); 576 while (parentScheduler != null && !exec.getVisitedResources().contains(parentScheduler.get_name())) { 577 exec.visitResource(parentScheduler.get_name()); 552 List<String> visitedResource = exec.getVisitedResources(); 553 String [] visitedResourcesArray = visitedResource.toArray(new String[visitedResource.size()]); 554 while (parentScheduler != null && !ArrayUtils.contains(visitedResourcesArray, parentScheduler.get_name())) { 555 exec.trackResource(parentScheduler.get_name()); 578 556 parentScheduler = parentScheduler.getParent(); 579 557 } 580 581 558 exec.setSchedulerName(scheduler.get_id()); 582 jobRegistry.addExecTask(exec);583 TaskList ImplnewTasks = new TaskListImpl();559 560 TaskList newTasks = new TaskListImpl(); 584 561 newTasks.add(exec); 585 562 -
DCWoRMS/trunk/src/schedframe/scheduling/queue/TaskQueue.java
r481 r490 2 2 3 3 import gridsim.gssim.DCWormsTags; 4 import gssim.schedframe.scheduling.queues.AbstractStatsSupportingQueue;5 4 6 5 import org.joda.time.DateTime; 6 7 import dcworms.schedframe.scheduling.queues.AbstractStatsSupportingQueue; 7 8 8 9 import schedframe.scheduling.tasks.TaskInterface; -
DCWoRMS/trunk/src/schedframe/scheduling/tasks/Job.java
r481 r490 203 203 204 204 List<Task> readyTasks = new ArrayList<Task>(); 205 206 205 int size = tasks.size(); 206 207 207 for(int i = 0; i < size; i++){ 208 208 int parCnt; … … 215 215 } catch(Exception e){ 216 216 parCnt = 0; 217 //e.printStackTrace(); 218 } 219 if(parCnt == 0) 220 { 217 } 218 if(parCnt == 0) { 221 219 readyTasks.add(task); 222 220 } 223 else 224 { 221 else { 225 222 for(int j = 0; j < parCnt; j++){ 226 223 ParentType par = task.getDescription().getWorkflow().getParent(j); -
DCWoRMS/trunk/src/schedframe/scheduling/tasks/Task.java
r481 r490 78 78 this.brokerSubmitTime = null; 79 79 this.duration = null; 80 // this.gridletID_ = (getJobId() + "_" + getId()).hashCode();81 80 prepareTopology(); 82 81 } … … 89 88 this.brokerSubmitTime = null; 90 89 this.duration = null; 91 // this.gridletID_ = (getJobId() + getId()).hashCode();92 90 prepareTopology(); 93 91 } -
DCWoRMS/trunk/src/simulator/ConfigurationOptions.java
r477 r490 8 8 import java.util.PropertyResourceBundle; 9 9 import java.util.ResourceBundle; 10 import java.util.logging.FileHandler;11 10 12 11 /** … … 53 52 public static final String READ_SCENARIO_INPUT_FOLDER = READ_SCENARIO_MODIFIER 54 53 + ".inputfolder"; 55 public static final String READ_SCENARIO_INPUT_TAR = READ_SCENARIO_MODIFIER+ ".tar";56 54 57 55 /** The name of the workload file */ … … 59 57 + ".workloadfilename"; 60 58 61 /** Shall a detailed history be printed */62 public static final String PRINT_HISTORY_MODIFIER = "printhistory";63 64 59 /** The default name of a workload file */ 65 60 public static final String DEFAULT_WORKLOAD_FILE_NAME = "workload.swf"; 66 61 67 62 public static final String CREATE_XML_SUPPLEMENT_FILES = "createXMLSupplement"; 68 69 public static final String PROVIDER_LIST_FILE = "in/provider.list"; 70 71 /** Network topology file path */ 72 public static final String NETWORK_TOPOLOGY_FILE_MODIFIER = "networktopologyfilename"; 63 73 64 74 65 public static final String CREATEDIAGRAMS = "creatediagrams"; … … 79 70 public static final String CREATEDIAGRAMS_TASKS = CREATEDIAGRAMS + ".tasks"; 80 71 public static final String CREATEDIAGRAMS_TASKSWAITINGTIME = CREATEDIAGRAMS + ".taskswaitingtime"; 81 public static final String CREATEDIAGRAMS_RESERVATIONS = CREATEDIAGRAMS + ".reservations";82 72 83 73 public static final String CREATESTATISTICS = "createstatistics"; 84 74 public static final String ACCUMULATED_RESOURCES_STATISTICS = CREATESTATISTICS + ".accumulatedresources"; 85 75 public static final String EXTENDED_TASKS_STATISTICS = CREATESTATISTICS + ".extendedtasks"; 86 public static final String GRIDLET_HISTORY_STATISTICS = CREATESTATISTICS + ".gridlethistory";87 76 public static final String JOBS_STATISTICS = CREATESTATISTICS + ".jobs"; 88 77 public static final String SIMULATION_STATISTICS = CREATESTATISTICS + ".simulation"; … … 111 100 /* =============================================================================================== */ 112 101 113 public String providerListFile = null;114 102 115 103 … … 152 140 public String inputWorkloadFileName = DEFAULT_WORKLOAD_FILE_NAME; 153 141 154 /**155 * a txt file name with topology description156 */157 public String networkTopologyFileName = null;158 142 159 143 /** … … 171 155 public boolean overwriteFiles = false; 172 156 173 /**174 * true if the history files are to be generated (makes the simulation175 * slower)176 */177 public boolean printHistory = false;178 157 179 158 /** … … 183 162 184 163 public boolean creatediagrams_processors = true; 185 public boolean creatediagrams_reservations = true;186 164 public boolean creatediagrams_resources = true; 187 165 public boolean creatediagrams_energyusage = true; 188 166 public boolean creatediagrams_tasks = true; 189 167 public boolean creatediagrams_taskswaitingtime = true; 190 public double 168 public double creatediagrams_resources_scale = 1; 191 169 192 170 public boolean createaccumulatedresourcesstatistics = true; 193 171 public boolean createextendedtasksstatistics = true; 194 public boolean creategridlethistorystatistics = true;195 172 public boolean createjobsstatistics = true; 196 173 public boolean createsimulationstatistics = true; 197 174 public boolean formatstatisticsoutput = false; 198 175 199 public static final String ENV_DESC_MODIFIER = "envdesc"; 200 public String envDescFileName = null; 176 public String[] resForEnergyChart; 177 public String[] resForUtilizationChart; 178 201 179 /** 202 180 * An empty constructor. … … 231 209 232 210 co.resdescFileName = bundle.getString(RESOURCE_DESC_MODIFIER); 233 234 try { 235 co.envDescFileName = bundle.getString(ENV_DESC_MODIFIER); 236 } catch(MissingResourceException e){ 237 co.envDescFileName = null; 238 } 211 239 212 240 213 try { … … 264 237 } 265 238 266 267 try {268 co.networkTopologyFileName = bundle269 .getString(NETWORK_TOPOLOGY_FILE_MODIFIER);270 } catch(MissingResourceException e){271 co.networkTopologyFileName = null;272 }273 274 239 if (co.createScenario == false) { 275 240 // read scenario … … 279 244 } catch (MissingResourceException e) { 280 245 co.inputFolder = null; 281 }282 283 try {284 co.inputTar = getSeparatorTerminatedPath(bundle285 .getString(READ_SCENARIO_INPUT_TAR));286 } catch (MissingResourceException e) {287 co.inputTar = null;288 246 } 289 247 … … 307 265 co.createXMLSupplement = false; 308 266 } 309 310 try { 311 co.printHistory = Boolean.valueOf( 312 bundle.getString(PRINT_HISTORY_MODIFIER)).booleanValue(); 313 } catch(MissingResourceException e){ 314 co.printHistory = false; 315 } 316 267 317 268 // create diagrams 318 269 … … 330 281 co.creatediagrams_processors = createDiagrams; 331 282 } 332 try { 333 co.creatediagrams_reservations = Boolean.valueOf( 334 bundle.getString(CREATEDIAGRAMS_RESERVATIONS)).booleanValue() && createDiagrams; 335 } catch(MissingResourceException e){ 336 co.creatediagrams_reservations = createDiagrams; 337 } 338 try { 339 co.creatediagrams_resources = Boolean.valueOf( 340 bundle.getString(CREATEDIAGRAMS_UTILIZATION)).booleanValue() && createDiagrams; 283 284 try { 285 co.resForUtilizationChart = bundle.getString(CREATEDIAGRAMS_UTILIZATION).split(";"); 286 if(co.resForUtilizationChart.length > 0){ 287 co.creatediagrams_resources = true && createDiagrams; 288 } 341 289 } catch(MissingResourceException e){ 342 290 co.creatediagrams_resources = createDiagrams; … … 349 297 } 350 298 try { 351 co.creatediagrams_energyusage = Boolean.valueOf( 352 bundle.getString(CREATEDIAGRAMS_ENERGYUSAGE)).booleanValue() && createDiagrams; 299 co.resForEnergyChart = bundle.getString(CREATEDIAGRAMS_ENERGYUSAGE).split(";"); 300 if(co.resForEnergyChart.length > 0){ 301 co.creatediagrams_energyusage = true && createDiagrams; 302 } 353 303 } catch(MissingResourceException e){ 354 304 co.creatediagrams_energyusage = createDiagrams; … … 367 317 } 368 318 369 370 319 try { 371 320 co.statsOutputSubfolderNameCreate = bundle.getString(STATS_OUTPUT_SUBFOLDER_NAME); … … 388 337 co.createextendedtasksstatistics = true; 389 338 } 390 try { 391 co.creategridlethistorystatistics = Boolean.valueOf( 392 bundle.getString(GRIDLET_HISTORY_STATISTICS)).booleanValue(); 393 } catch(MissingResourceException e){ 394 co.creategridlethistorystatistics = true; 395 } 339 396 340 try { 397 341 co.createjobsstatistics = Boolean.valueOf( … … 419 363 } 420 364 return co; 421 }422 423 /**424 * Creates a new configuration object in the CREATE_SCENARIO mode.425 *426 * @param gridSchedulingPluginName427 * @param forecastFinishTimePluginName428 * @param localAllocPolicyPluginName429 * @param resdescFileName430 * @param taskParamFileName431 * @param outputFolder432 * @param outputWorkloadFileName433 * @param overwriteFiles434 * @param printHistory435 */436 public ConfigurationOptions(String gridSchedulingPluginName,437 String exectimeestimationplugin,438 String localAllocPolicyPluginName, String resdescFileName,439 String taskParamFileName, String outputFolder,440 String outputWorkloadFileName, boolean overwriteFiles,441 boolean printHistory) {442 super();443 this.resdescFileName = resdescFileName;444 this.workloadDescFileName = taskParamFileName;445 this.outputFolder = getSeparatorTerminatedPath(outputFolder);446 this.outputWorkloadFileName = outputWorkloadFileName;447 this.overwriteFiles = overwriteFiles;448 this.printHistory = printHistory;449 450 // the create mode451 this.createScenario = true;452 }453 454 /**455 * Creates a new configuration object in the READ_SCENARIO mode.456 *457 * @param gridSchedulingPluginName458 * @param forecastFinishTimePluginName459 * @param localAllocPolicyPluginName460 * @param resdescFileName461 * @param inputFolder462 * @param inputWorkloadFileName463 * @param overwriteFiles464 * @param printHistory465 */466 public ConfigurationOptions(String gridSchedulingPluginName,467 String exectimeestimationplugin,468 String localAllocPolicyPluginName, String resdescFileName,469 String inputFolder, String inputWorkloadFileName,470 boolean overwriteFiles, boolean printHistory) {471 super();472 this.resdescFileName = resdescFileName;473 this.inputFolder = getSeparatorTerminatedPath(inputFolder);474 this.inputWorkloadFileName = inputWorkloadFileName;475 this.overwriteFiles = overwriteFiles;476 this.printHistory = printHistory;477 //FileHandler.loadDataset(new File("iris.data"), 4, ",");478 // the read mode479 this.createScenario = false;480 365 } 481 366 -
DCWoRMS/trunk/src/simulator/DCWormsUsers.java
r481 r490 1 1 package simulator; 2 2 3 import dcworms.schedframe.scheduling.utils.JobDescription; 4 import dcworms.schedframe.scheduling.utils.TaskDescription; 3 5 import eduni.simjava.Sim_event; 4 6 import eduni.simjava.Sim_system; 5 7 import gridsim.GridSim; 6 8 import gridsim.GridSimTags; 7 import gridsim.Gridlet;8 9 import gridsim.IO_data; 9 10 import gridsim.gssim.DCWormsTags; 10 11 import gridsim.net.InfoPacket; 11 import gssim.schedframe.scheduling.utils.JobDescription;12 import gssim.schedframe.scheduling.utils.TaskDescription;13 12 14 13 import java.util.ArrayList; -
DCWoRMS/trunk/src/simulator/GenericUser.java
r477 r490 2 2 3 3 4 import gssim.schedframe.scheduling.utils.JobDescription;5 import gssim.schedframe.scheduling.utils.TaskDescription;6 4 7 5 import java.util.List; 6 7 import dcworms.schedframe.scheduling.utils.JobDescription; 8 import dcworms.schedframe.scheduling.utils.TaskDescription; 8 9 9 10 import schedframe.scheduling.tasks.Job; -
DCWoRMS/trunk/src/simulator/reader/ResourceReader.java
r477 r490 11 11 import java.util.Deque; 12 12 import java.util.HashMap; 13 import java.util.LinkedHashSet; 13 14 import java.util.LinkedList; 14 15 import java.util.List; 15 16 import java.util.Map; 17 import java.util.Set; 16 18 17 19 import org.exolab.castor.types.AnyNode; … … 54 56 private String globalSchedulingPluginName; 55 57 58 private Set<String> compResLayers; 59 56 60 public ResourceReader(ConfigurationOptions options) throws IOException { 57 61 … … 59 63 globalSchedulingPluginName = "example.globalplugin.GridFCFSRoundRobinPlugin"; 60 64 prepareCalendar(); 65 compResLayers = new LinkedHashSet<String>(); 61 66 } 62 67 … … 97 102 ResourceController rc = new ResourceController(mainScheduler, computingResources); 98 103 rc.setInitList(toInit); 104 rc.setCompResLayers(compResLayers); 99 105 return rc; 100 106 } … … 192 198 ComputingResource parentResource = resStructure.pop(); 193 199 toInit.add(parentResource); 200 compResLayers.add(parentResource.getType().getName()); 194 201 List<AbstractResourceDescription> childrenResDesc = parentResDesc.getChildren(); 195 202 if (childrenResDesc == null){ -
DCWoRMS/trunk/src/simulator/stats/implementation/DCWormsStatistics.java
r481 r490 19 19 import java.util.TreeMap; 20 20 21 import org.apache.commons.lang.ArrayUtils; 21 22 import org.apache.commons.logging.Log; 22 23 import org.apache.commons.logging.LogFactory; … … 55 56 import schedframe.exceptions.ResourceException; 56 57 import schedframe.resources.ResourceType; 57 import schedframe.resources. StandardResourceType;58 import schedframe.resources.UserResourceType; 58 59 import schedframe.resources.computing.ComputingResource; 59 60 import schedframe.resources.computing.extensions.Extension; … … 87 88 import csiro.mit.utils.jfreechart.timetablechart.data.TimetableEventSource; 88 89 import csiro.mit.utils.jfreechart.timetablechart.renderer.TimetableRenderer; 90 import dcworms.schedframe.scheduling.ExecTask; 91 import dcworms.schedframe.scheduling.Executable; 89 92 import eduni.simjava.Sim_stat; 90 import gssim.schedframe.scheduling.ExecTask;91 import gssim.schedframe.scheduling.Executable;92 93 93 94 public class DCWormsStatistics implements SimulationStatistics { … … 149 150 protected HashMap<String, List<String>> task_processorsMap; 150 151 151 protected JobRegistry Impljr;152 protected JobRegistry jr; 152 153 153 154 … … 168 169 169 170 this.resourceController = resourceController; 170 jr = new JobRegistryImpl("COMPUTING_GRID_0#BROKER");171 jr = new JobRegistryImpl(""); 171 172 init(); 172 173 } … … 231 232 simulationStatsFile.close(); 232 233 } 233 234 } 235 236 234 } 237 235 238 236 /************* RESOURCE STATISTICS SECTION **************/ … … 241 239 242 240 //TEMPORARY CONFIGURATION SECTION 243 StandardResourceType [] resForAnalyze = {StandardResourceType.DataCenter, StandardResourceType.ComputingNode, StandardResourceType.Processor}; 244 HashMap<StandardResourceType, List<Stats>> type_stats = new HashMap<StandardResourceType, List<Stats>>(); 245 246 List<Stats> crStats = new ArrayList<Stats>(); 247 crStats.add(Stats.textLoad); 248 crStats.add(Stats.chartLoad); 249 crStats.add(Stats.textEnergy); 250 crStats.add(Stats.chartEnergy); 251 type_stats.put(StandardResourceType.DataCenter, crStats); 252 253 List<Stats> cnStats = new ArrayList<Stats>(); 254 cnStats.add(Stats.textLoad); 255 cnStats.add(Stats.chartLoad); 256 cnStats.add(Stats.textEnergy); 257 cnStats.add(Stats.chartEnergy); 258 type_stats.put(StandardResourceType.ComputingNode, cnStats); 259 260 List<Stats> cpuStats = new ArrayList<Stats>(); 261 cpuStats.add(Stats.textLoad); 262 cpuStats.add(Stats.chartLoad); 263 cpuStats.add(Stats.textEnergy); 264 //cpuStats.add(Stats.chartEnergy); 265 type_stats.put(StandardResourceType.Processor, cpuStats); 266 267 241 242 HashMap<String, List<Stats>> type_stats = new HashMap<String, List<Stats>>(); 243 244 for(String resourceName: resourceController.getComputingResourceLayers()){ 245 List<Stats> cStats = new ArrayList<Stats>(); 246 cStats.add(Stats.textLoad); 247 if(ArrayUtils.contains(configuration.resForUtilizationChart, resourceName)) 248 cStats.add(Stats.chartLoad); 249 cStats.add(Stats.textEnergy); 250 if(ArrayUtils.contains(configuration.resForEnergyChart, resourceName)) 251 cStats.add(Stats.chartEnergy); 252 type_stats.put(resourceName, cStats); 253 } 268 254 269 255 peGanttMap = new HashMap<String, TimetableEventSource>(); … … 305 291 } 306 292 307 for(St andardResourceType resType: resForAnalyze){293 for(String resourceName: resourceController.getComputingResourceLayers()){ 308 294 List<ComputingResource> resources = null; 309 295 try { 310 296 resources = new ArrayList<ComputingResource>(); 311 297 for(ComputingResource compRes: resourceController.getComputingResources() ){ 312 resources.addAll(compRes.getDescendantsByType( resType));313 } 314 /*if(resourceController.getComputingResources().get(0).getType().equals(resType))315 resources.addAll(resourceController.getComputingResources()); */298 resources.addAll(compRes.getDescendantsByType(new UserResourceType(resourceName))); 299 } 300 if(resourceController.getComputingResources().get(0).getType().getName().equals(resourceName)) 301 resources.addAll(resourceController.getComputingResources()); 316 302 } catch (Exception e) { 317 303 continue; 318 304 } 319 if(type_stats.containsKey(res Type)){305 if(type_stats.containsKey(resourceName)){ 320 306 Map<String, GSSAccumulator> energyCategoryStats = new TreeMap<String, GSSAccumulator>(); 321 307 Map<String, GSSAccumulator> loadCategoryStats = new TreeMap<String, GSSAccumulator>(); … … 323 309 ResourceUsageStats resourceUsage = null; 324 310 ResourceEnergyStats energyUsage = null; 325 if(type_stats.get(res Type).contains(Stats.textLoad)){311 if(type_stats.get(resourceName).contains(Stats.textLoad)){ 326 312 resourceUsage = gatherResourceLoadStats(resource, basicResStats); 327 313 resourceUsage.setMeanUsage(calculateResourceLoad(resource, basicResLoad)); … … 331 317 } 332 318 } 333 if(type_stats.get(res Type).contains(Stats.chartLoad)){319 if(type_stats.get(resourceName).contains(Stats.chartLoad)){ 334 320 if (configuration.creatediagrams_resources) { 335 321 createResourceLoadDiagram(resourceUsage); 336 322 } 337 323 } 338 if(type_stats.get(res Type).contains(Stats.textEnergy)){324 if(type_stats.get(resourceName).contains(Stats.textEnergy)){ 339 325 energyUsage = gatherResourceEnergyStats(resource); 340 326 energyUsage.setMeanUsage(calculateEnergyLoad(energyUsage)); … … 352 338 boolean top = true; 353 339 while(parent != null){ 354 if(een != null && een.getPowerProfile() != null) 355 { 340 if(een != null && een.getPowerProfile() != null) { 356 341 top = false; 357 342 break; … … 368 353 } 369 354 } 370 if(type_stats.get(res Type).contains(Stats.chartEnergy)){355 if(type_stats.get(resourceName).contains(Stats.chartEnergy)){ 371 356 372 357 if (configuration.creatediagrams_energyusage) { … … 760 745 private JFreeChart getResourcesEnergyDiagram(ResourceType resType, String chartName, 761 746 Title subtitle, String simulationTime) { 762 String energy = " ENERGY[W]";747 String energy = "POWER [W]"; 763 748 boolean urls = false; 764 749 boolean tooltip = true; -
DCWoRMS/trunk/src/simulator/stats/implementation/TaskStats.java
r481 r490 1 1 package simulator.stats.implementation; 2 2 3 import gssim.schedframe.scheduling.Executable;4 3 5 4 import java.util.List; 5 6 import dcworms.schedframe.scheduling.Executable; 6 7 7 8 import simulator.stats.implementation.out.StatsSerializer; -
DCWoRMS/trunk/src/simulator/utils/XsltTransformations.java
r477 r490 1 1 package simulator.utils; 2 2 3 import gssim.schedframe.scheduling.utils.JobDescription;4 import gssim.schedframe.scheduling.utils.TaskDescription;5 3 6 4 import java.io.IOException; … … 20 18 import javax.xml.transform.stream.StreamSource; 21 19 import javax.xml.xpath.XPathExpressionException; 20 21 import dcworms.schedframe.scheduling.utils.JobDescription; 22 import dcworms.schedframe.scheduling.utils.TaskDescription; 22 23 23 24 /** -
DCWoRMS/trunk/src/simulator/workload/WorkloadLoader.java
r477 r490 2 2 3 3 import org.qcg.broker.schemas.jobdesc.QcgJob; 4 import gssim.schedframe.scheduling.utils.JobDescription;5 import gssim.schedframe.scheduling.utils.TaskDescription;6 4 7 5 import java.io.IOException; … … 24 22 import org.exolab.castor.xml.MarshalException; 25 23 import org.exolab.castor.xml.ValidationException; 24 25 import dcworms.schedframe.scheduling.utils.JobDescription; 26 import dcworms.schedframe.scheduling.utils.TaskDescription; 26 27 27 28
Note: See TracChangeset
for help on using the changeset viewer.