Changeset 1434 for DCWoRMS/branches/coolemall/src/schedframe
- Timestamp:
- 09/15/14 17:00:03 (11 years ago)
- 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 218 218 } 219 219 220 public AirflowProfile getAir FlowProfile() {220 public AirflowProfile getAirflowProfile() { 221 221 return airflowProfile; 222 222 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/units/ProcessingElements.java
r1423 r1434 227 227 else if(delta < 0) { 228 228 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); 233 233 delta++; 234 234 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceItem.java
r1423 r1434 17 17 protected Map<ResourceUnitName, ResourceUnit> usedResources; 18 18 protected Set<String> resourceNames; 19 protected Set<ComputingResource> compResource; 19 20 20 21 public ResourceItem(Map<ResourceUnitName, ResourceUnit> usedResources){ 21 22 this.usedResources = usedResources; 22 23 this.resourceNames = saveResourceNames(); 24 this.compResource = saveResources(); 23 25 } 24 26 … … 29 31 public Set<String> getResourceNames(){ 30 32 return resourceNames; 33 } 34 35 public Set<ComputingResource> getResources(){ 36 return compResource; 31 37 } 32 38 … … 57 63 return resourceNames; 58 64 } 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 } 59 92 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistryImpl.java
r1415 r1434 7 7 import java.util.Set; 8 8 9 import org.apache.commons.logging.Log;10 import org.apache.commons.logging.LogFactory;11 9 import org.qcg.broker.schemas.resreqs.ParentType; 12 10 import org.qcg.broker.schemas.resreqs.Workflow; 13 11 import org.qcg.broker.schemas.resreqs.types.TaskStatesName; 14 12 15 import dcworms.schedframe.scheduling.ExecTask;16 17 13 import qcg.shared.constants.BrokerConstants; 18 14 import schedframe.ExecutablesList; 15 import schedframe.resources.computing.ComputingResource; 19 16 import schedframe.scheduling.tasks.JobInterface; 20 17 import schedframe.scheduling.tasks.Task; 18 import dcworms.schedframe.scheduling.ExecTask; 21 19 22 20 public class JobRegistryImpl extends AbstractJobRegistry { 23 21 24 private static Log log = LogFactory.getLog(JobRegistryImpl.class);25 26 22 private String context; 27 23 private ComputingResource cr; 28 24 //TO DO - consider data structure 29 25 protected static final ExecutablesList executables = new ExecutablesList(); 26 30 27 //protected static final List<ExecTask> executables = Collections.synchronizedList(new ArrayList<ExecTask>());; 31 28 //protected static final List<ExecTaskInterface> executables = new CopyOnWriteArrayList<ExecTaskInterface>(); … … 34 31 this.context = context; 35 32 } 36 33 34 public JobRegistryImpl(ComputingResource cr) { 35 this.cr = cr; 36 } 37 38 public JobRegistryImpl() { 39 this(""); 40 } 41 37 42 public boolean addExecTask(ExecTask newTask) { 38 43 if(getTask(newTask.getJobId(), newTask.getId()) == null) { 39 synchronized (executables) 44 synchronized (executables) { 40 45 executables.add(newTask); 41 46 } … … 53 58 for (ExecTask task: executables) { 54 59 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)){ 58 63 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 68 89 return taskList; 69 90 }
Note: See TracChangeset
for help on using the changeset viewer.