Ignore:
Timestamp:
11/26/13 11:56:07 (11 years ago)
Author:
wojtekp
Message:
 
Location:
DCWoRMS/branches/coolemall/src/schedframe/scheduling
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceHistoryItem.java

    r477 r1207  
    88import schedframe.resources.units.ResourceUnitName; 
    99 
     10//TODO - change name 
    1011public class ResourceHistoryItem { 
    1112 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/SchedulerDescription.java

    r477 r1207  
    22 
    33import java.util.ArrayList; 
     4import java.util.Collection; 
    45import java.util.HashMap; 
    56import java.util.Iterator; 
     
    910import schedframe.resources.StandardResourceType; 
    1011import schedframe.resources.computing.description.ExecutingResourceDescription; 
     12import schedframe.resources.computing.description.ResourceDescription; 
    1113import schedframe.resources.providers.ResourceProvider; 
    12 import schedframe.resources.units.AbstractResourceUnit; 
    1314import schedframe.resources.units.ResourceUnit; 
    1415import schedframe.resources.units.ResourceUnitName; 
    1516import schedframe.scheduling.queue.QueueDescription; 
    1617 
    17 public class SchedulerDescription extends ExecutingResourceDescription{ 
     18public class SchedulerDescription extends ResourceDescription implements ExecutingResourceDescription{ 
    1819 
    1920        protected ResourceProvider provider; 
    2021        protected List<QueueDescription> accesQueues; 
     22        protected Map<ResourceUnitName, List<ResourceUnit>> resUnits; 
    2123 
    2224        public SchedulerDescription(ResourceProvider provider){ 
     
    6264                return provider; 
    6365        } 
     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        } 
    64109} 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/ClusterResourceManager.java

    r477 r1207  
    2323        public List<ComputingNode> getComputingNodes(){ 
    2424                try { 
    25                         return (List<ComputingNode>) getResourcesOfType(StandardResourceType.ComputingNode); 
     25                        return (List<ComputingNode>) getResourcesOfType(StandardResourceType.Node); 
    2626                } catch (ResourceException e) { 
    2727                        return new ArrayList<ComputingNode>(); 
     
    4040        @SuppressWarnings("unchecked") 
    4141        public List<ComputingNode> getComputingNodes(Properties properties){ 
    42                 properties.setProperty("type", StandardResourceType.ComputingNode.toString()); 
     42                properties.setProperty("type", StandardResourceType.Node.toString()); 
    4343                return (List<ComputingNode>) filterResources(properties); 
    4444 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/LocalResourceManager.java

    r1054 r1207  
    1919import schedframe.resources.StandardResourceType; 
    2020import schedframe.resources.computing.ComputingResource; 
     21import schedframe.resources.computing.ComputingResourceCharacteristics; 
    2122import schedframe.resources.computing.ResourceCharacteristics; 
    2223import schedframe.resources.computing.validator.ResourcePropertiesValidator; 
     
    138139                for (int i = 0; i < computingResources.size() && resourceWithName == null; i++) { 
    139140                        ComputingResource resource = computingResources.get(i); 
    140                         if (resource.getName().equals(resourceName)) 
     141                        if (resource.getFullName().equals(resourceName)) 
    141142                                resourceWithName = resource; 
    142143                        else 
     
    154155                        while (!toExamine.isEmpty()) { 
    155156                                ComputingResource resource = toExamine.pop(); 
    156                                 ResourceCharacteristics resourceCharacteristic = resource.getResourceCharacteristic(); 
     157                                ComputingResourceCharacteristics resourceCharacteristic = (ComputingResourceCharacteristics)resource.getResourceCharacteristic(); 
    157158                                List<ResourceUnit> units = null; 
    158159                                units = resourceCharacteristic.getResourceUnits().get(unitName); 
     
    266267                for(int i = 0 ; i < computingResources.size() && resourceWithName == null; i++){ 
    267268                        ComputingResource resource = computingResources.get(i); 
    268                         if(resource.getName().equals(resName)) 
     269                        if(resource.getFullName().equals(resName)) 
    269270                                resourceWithName = resource; 
    270271                        else 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java

    r1162 r1207  
    2424 
    2525import qcg.shared.constants.BrokerConstants; 
    26 import schedframe.ResourceController; 
     26import schedframe.SimulatedEnvironment; 
    2727import schedframe.events.scheduling.SchedulingEvent; 
    2828import schedframe.events.scheduling.SchedulingEventType; 
     
    323323                        ExecTask task = iter.next(); 
    324324                        Executable exec = (Executable)task; 
    325                         //exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * timeSpan/exec.getEstimatedDuration()); 
    326325                        exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * (timeSpan / exec.getEstimatedDuration())); 
    327326                        UsedResourcesList usedResourcesList = exec.getUsedResources(); 
     
    338337                        for (ComputingResource resource : pes) { 
    339338                                resource.handleEvent(new EnergyEvent(eventType, obj)); 
     339                                //DataCenterWorkloadSimulator.getEventManager().sendToResources(resource.getType(), 0, new EnergyEvent(eventType, obj)); 
    340340                        } 
    341341                        /*try { 
     
    350350                        ComputingResource resource = null; 
    351351                        try { 
    352                                 resource = ResourceController.getComputingResourceByName(peUnit.getResourceId()); 
     352                                resource = SimulatedEnvironment.getComputingResourceByName(peUnit.getResourceId()); 
    353353                        } catch (ResourceException e) { 
    354354                                return; 
     
    428428                        if(exec.getResourceConsumptionProfile().getCurrentResourceConsumption() == exec.getResourceConsumptionProfile().getResourceConsumptionList().getLast()){ 
    429429                                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); 
    430432                        } else { 
    431433                                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); 
    432436                        } 
    433437                } 
     
    540544                                        job.setStatus((int)BrokerConstants.JOB_STATUS_SUBMITTED); 
    541545                        } catch (Exception e) { 
    542                                 // TODO Auto-generated catch block 
    543546                                e.printStackTrace(); 
    544547                        } 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/Job.java

    r1159 r1207  
    77import org.qcg.broker.schemas.resreqs.types.TaskStatesName; 
    88 
    9 import gridsim.dcworms.DCWormsTags; 
    109 
    1110import java.io.StringWriter; 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/Task.java

    r1194 r1207  
    44import java.io.StringWriter; 
    55import java.util.ArrayList; 
    6 import java.util.LinkedList; 
    76import java.util.List; 
    87 
     
    2221import org.qcg.broker.schemas.resreqs.ProcessesResourceRequirements; 
    2322import org.qcg.broker.schemas.resreqs.Requirements; 
    24 import org.qcg.broker.schemas.resreqs.ResourceConsumptionType; 
    2523import org.qcg.broker.schemas.resreqs.TaskResourceRequirements; 
    2624import org.qcg.broker.schemas.resreqs.TimePeriod; 
     
    3129import schedframe.scheduling.WorkloadUnitHandler; 
    3230import schedframe.scheduling.manager.tasks.JobRegistryImpl; 
    33 import schedframe.scheduling.tasks.phases.ResourceConsumption; 
    34 import schedframe.scheduling.tasks.phases.ResourceConsumptionProfile; 
    3531import schedframe.scheduling.tasks.requirements.ResourceParameterName; 
    3632 
     
    7571        private long workloadLogWaitTime; 
    7672         
    77         private ResourceConsumptionProfile resourceConsumptionProfile; 
    7873 
    7974        public Task(org.qcg.broker.schemas.resreqs.Task task){ 
     
    9691        } 
    9792 
    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         
    12194         
    12295        public DateTime getExecutionStartTime() throws NoSuchFieldException { 
     
    310283        } 
    311284         
    312         protected ComputingResourceBaseTypeItem[] getComputingResourceRequirements() throws NoSuchFieldException{ 
     285        public ComputingResourceBaseTypeItem[] getComputingResourceRequirements() throws NoSuchFieldException{ 
    313286                 
    314287                Requirements req = this.task.getRequirements(); 
     
    450423        public void setLength(long length) { 
    451424                this.length = length; 
    452                 preparePhases(); 
    453425        } 
    454426 
     
    515487                wuh.handleTask(this); 
    516488        } 
    517          
    518         public ResourceConsumptionProfile getResourceConsumptionProfile(){ 
    519                 return resourceConsumptionProfile; 
    520         } 
    521          
     489 
    522490        public String getApplicationName(){ 
    523491                try{ 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/TaskInterface.java

    r1190 r1207  
    77 
    88import schedframe.DescriptionContainer; 
    9 import schedframe.scheduling.tasks.phases.ResourceConsumptionProfile; 
    109import schedframe.scheduling.tasks.requirements.ResourceParameterName; 
    1110 
     
    111110        public long getWorkloadLogWaitTime(); 
    112111         
    113         public ResourceConsumptionProfile getResourceConsumptionProfile(); 
     112        //public ResourceConsumptionProfile getResourceConsumptionProfile(); 
    114113         
    115114        public String getApplicationName(); 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumption.java

    r1129 r1207  
    99import org.qcg.broker.schemas.resreqs.ComputingResourceParameterType; 
    1010import org.qcg.broker.schemas.resreqs.PhaseBehaviourType; 
    11 import org.qcg.broker.schemas.resreqs.ReferenceType; 
     11import org.qcg.broker.schemas.resreqs.StringParameterType; 
     12 
    1213import org.qcg.broker.schemas.resreqs.ResourceConsumptionType; 
    1314 
     
    3637        if(resConsumptionType.getReferenceHardware() != null){ 
    3738                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()); 
    4041                } 
    4142        } 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumptionProfile.java

    r896 r1207  
    22 
    33import java.util.LinkedList; 
    4 import java.util.List; 
    54 
    65public class ResourceConsumptionProfile { 
    76         
    87        protected LinkedList<ResourceConsumption> resourceConsumptionList; 
    9         protected int currentPhase; 
     8        protected long usefulWork; 
     9        private int currentPhase; 
    1010         
    1111        public ResourceConsumptionProfile() { 
     
    3737                this.currentPhase = currentPhase; 
    3838        } 
     39 
     40        public long getUsefulWork() { 
     41                return usefulWork; 
     42        } 
     43 
     44        public void setUsefulWork(long usefulWork) { 
     45                this.usefulWork = usefulWork; 
     46        } 
    3947} 
Note: See TracChangeset for help on using the changeset viewer.