- Timestamp:
- 09/15/14 17:00:03 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.