Ignore:
Timestamp:
09/15/14 17:00:03 (11 years ago)
Author:
wojtekp
Message:
 
Location:
DCWoRMS/branches/coolemall/src/schedframe
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/EnergyExtension.java

    r1423 r1434  
    218218        } 
    219219 
    220         public AirflowProfile getAirFlowProfile() { 
     220        public AirflowProfile getAirflowProfile() { 
    221221                return airflowProfile; 
    222222        } 
  • DCWoRMS/branches/coolemall/src/schedframe/resources/units/ProcessingElements.java

    r1423 r1434  
    227227                else if(delta < 0) { 
    228228                        for(int i = this.resources.size() - 1; i >= 0 && delta < 0; i--){ 
    229                                 ComputingResource r = this.resources.get(i); 
    230                                 if(r.getStatus() == ResourceStatus.BUSY){ 
    231                                         if(new JobRegistryImpl(r.getFullName()).getRunningTasks().size() == 0){ 
    232                                                 r.setStatus(ResourceStatus.FREE); 
     229                                ComputingResource cr = this.resources.get(i); 
     230                                if(cr.getStatus() == ResourceStatus.BUSY){ 
     231                                        if(new JobRegistryImpl(cr).getRunningTasks().size() == 0){ 
     232                                                cr.setStatus(ResourceStatus.FREE); 
    233233                                                delta++;         
    234234                                        } 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceItem.java

    r1423 r1434  
    1717        protected Map<ResourceUnitName, ResourceUnit> usedResources; 
    1818        protected Set<String> resourceNames; 
     19        protected Set<ComputingResource> compResource; 
    1920 
    2021        public ResourceItem(Map<ResourceUnitName, ResourceUnit> usedResources){ 
    2122                this.usedResources = usedResources; 
    2223                this.resourceNames = saveResourceNames(); 
     24                this.compResource = saveResources(); 
    2325        } 
    2426         
     
    2931        public Set<String> getResourceNames(){ 
    3032                return resourceNames; 
     33        } 
     34         
     35        public Set<ComputingResource> getResources(){ 
     36                return compResource; 
    3137        } 
    3238         
     
    5763                return resourceNames; 
    5864        } 
     65         
     66        private Set<ComputingResource> saveResources(){ 
     67                Set<ComputingResource> compResources; 
     68                ProcessingElements pes = (ProcessingElements) usedResources.get(StandardResourceUnitName.PE); 
     69                compResources = new HashSet<ComputingResource>(pes.size(), 1); 
     70                for (ComputingResource resource: pes) { 
     71 
     72                        LinkedList<ComputingResource> toExamine = new LinkedList<ComputingResource>(); 
     73                        toExamine.push(resource); 
     74 
     75                        while (!toExamine.isEmpty()) { 
     76                                ComputingResource compResource = toExamine.pop(); 
     77                                List<ComputingResource> resources = compResource.getChildren(); 
     78                                if(resources.isEmpty()){ 
     79                                        if(!compResources.contains(compResource)){ 
     80                                                compResources.add(compResource); 
     81                                        } 
     82                                } else { 
     83                                        for (int i = 0; i < resources.size(); i++) { 
     84                                                ComputingResource resourceChild = resources.get(i); 
     85                                                toExamine.addLast(resourceChild); 
     86                                        } 
     87                                } 
     88                        } 
     89                } 
     90                return compResources; 
     91        } 
    5992} 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistryImpl.java

    r1415 r1434  
    77import java.util.Set; 
    88 
    9 import org.apache.commons.logging.Log; 
    10 import org.apache.commons.logging.LogFactory; 
    119import org.qcg.broker.schemas.resreqs.ParentType; 
    1210import org.qcg.broker.schemas.resreqs.Workflow; 
    1311import org.qcg.broker.schemas.resreqs.types.TaskStatesName; 
    1412 
    15 import dcworms.schedframe.scheduling.ExecTask; 
    16  
    1713import qcg.shared.constants.BrokerConstants; 
    1814import schedframe.ExecutablesList; 
     15import schedframe.resources.computing.ComputingResource; 
    1916import schedframe.scheduling.tasks.JobInterface; 
    2017import schedframe.scheduling.tasks.Task; 
     18import dcworms.schedframe.scheduling.ExecTask; 
    2119 
    2220public class JobRegistryImpl extends AbstractJobRegistry { 
    2321 
    24         private static Log log = LogFactory.getLog(JobRegistryImpl.class); 
    25  
    2622        private String context; 
    27  
     23        private ComputingResource cr; 
    2824        //TO DO - consider data structure 
    2925        protected static final ExecutablesList executables = new ExecutablesList(); 
     26 
    3027        //protected static final List<ExecTask> executables = Collections.synchronizedList(new ArrayList<ExecTask>());; 
    3128        //protected static final List<ExecTaskInterface> executables = new CopyOnWriteArrayList<ExecTaskInterface>(); 
     
    3431                this.context = context; 
    3532        } 
    36  
     33         
     34        public JobRegistryImpl(ComputingResource cr) { 
     35                this.cr = cr; 
     36        } 
     37 
     38        public JobRegistryImpl() { 
     39                this(""); 
     40        } 
     41         
    3742        public boolean addExecTask(ExecTask newTask) { 
    3843                if(getTask(newTask.getJobId(), newTask.getId()) == null) { 
    39                         synchronized (executables)  { 
     44                        synchronized (executables) { 
    4045                                executables.add(newTask); 
    4146                        } 
     
    5358                        for (ExecTask task: executables) { 
    5459                                if (task.getStatus() == status) { 
    55                                         Set<String> visitedResource = task.getAllocatedResources().getLast().getResourceNames(); 
    56                                         for(String res: visitedResource){ 
    57                                                 if(res.equals(context) || res.substring(0, res.lastIndexOf("/")).contains(context)){ 
     60                                        if(cr != null){ 
     61                                                Set<ComputingResource> visitedResource = task.getAllocatedResources().getLast().getResources(); 
     62                                                if(visitedResource.contains(cr)){ 
    5863                                                        taskList.add(task); 
    59                                                         break; 
    60                                                 } 
    61                                         } 
    62                                         if(task.getSchedulerName().equals(context)) { 
    63                                                 taskList.add(task); 
    64                                         } 
    65                                 } 
    66                         } 
    67                 } 
     64                                                } else { 
     65                                                        for(ComputingResource res: visitedResource){ 
     66                                                                if(cr.contains(res)){ 
     67                                                                        taskList.add(task); 
     68                                                                        break; 
     69                                                                } 
     70                                                        } 
     71                                                } 
     72                                        } else { 
     73                                                Set<String> visitedResource = task.getAllocatedResources().getLast().getResourceNames(); 
     74                                                for(String res: visitedResource){ 
     75                                                        if(res.equals(context) || res.substring(0, res.lastIndexOf("/")).contains(context)){ 
     76                                                                taskList.add(task); 
     77                                                                break; 
     78                                                        } 
     79                                                } 
     80 
     81                                                if(task.getSchedulerName().equals(context)) { 
     82                                                        taskList.add(task); 
     83                                                } 
     84                                        } 
     85                                } 
     86                        } 
     87                } 
     88 
    6889                return taskList; 
    6990        } 
Note: See TracChangeset for help on using the changeset viewer.