Changeset 1048
- Timestamp:
- 05/23/13 22:25:55 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gssim/trunk/src/gssim/schedframe/scheduling/queues/TaskQueue.java
r5 r1048 4 4 import grms.shared.constants.BrokerConstants; 5 5 import org.qcg.broker.schemas.resreqs.ParentType; 6 import org.qcg.broker.schemas.resreqs.Workflow; 6 7 import org.qcg.broker.schemas.resreqs.types.TaskStatesName; 7 8 //import org.qcg.broker.schemas.resreqs.types.WorkflowParentStatesType; … … 60 61 int previousTaskReadyCnt = 0; 61 62 Task task = this.get(i); 63 62 64 if(task.getStatus() != (int)BrokerConstants.TASK_STATUS_UNSUBMITTED) 63 65 continue; 64 try{65 parCnt = task.getDescription().getWorkflow().getParentCount();66 } catch(Exception e){67 parCnt = 0;68 //e.printStackTrace();66 //the following procedure supports only one nested structure 67 Workflow w = task.getDescription().getWorkflow(); 68 if (w == null){ 69 readyTasks.add(task); 70 continue; 69 71 } 70 if(parCnt == 0) 71 { 72 readyTasks.add(task); 72 if(w.getAnd() != null) { 73 parCnt = w.getAnd().getParentOpTypeItemCount(); 74 if(parCnt == 0) 75 { 76 readyTasks.add(task); 77 } 78 else 79 { 80 for(int j = 0; j < parCnt; j++){ 81 ParentType par = w.getAnd().getParentOpTypeItem(j).getParent(); 82 if(par.getTriggerState().compareTo(TaskStatesName.FINISHED) == 0){ 83 if(!checkTaskCompletion(jobRegistry, task.getJobId(), par.getContent())){ 84 break; 85 } 86 } 87 previousTaskReadyCnt++; 88 } 89 90 if(previousTaskReadyCnt == parCnt) 91 readyTasks.add(task); 92 } 93 } 94 else if(w.getOr() != null) { 95 parCnt = w.getOr().getParentOpTypeItemCount(); 96 if(parCnt == 0) 97 { 98 readyTasks.add(task); 99 } 100 else 101 { 102 for(int j = 0; j < parCnt; j++){ 103 ParentType par = w.getOr().getParentOpTypeItem(j).getParent(); 104 if(par.getTriggerState().compareTo(TaskStatesName.FINISHED) == 0){ 105 if(!checkTaskCompletion(jobRegistry, task.getJobId(), par.getContent())){ 106 continue; 107 } 108 } 109 previousTaskReadyCnt++; 110 } 111 112 if(previousTaskReadyCnt > 0) 113 readyTasks.add(task); 114 } 73 115 } 74 else 75 { 76 for(int j = 0; j < parCnt; j++){ 77 ParentType par = task.getDescription().getWorkflow().getParent(j); 78 if(par.getTriggerState().compareTo(TaskStatesName.FINISHED) == 0){ 79 if(!checkTaskCompletion(jobRegistry, task.getJobId(), par.getContent())){ 80 break; 116 117 else { 118 parCnt = w.getParentCount(); 119 if(parCnt == 0) 120 { 121 readyTasks.add(task); 122 } 123 else 124 { 125 for(int j = 0; j < parCnt; j++){ 126 ParentType par = w.getParent(j); 127 if(par.getTriggerState().compareTo(TaskStatesName.FINISHED) == 0){ 128 if(!checkTaskCompletion(jobRegistry, task.getJobId(), par.getContent())){ 129 continue; 130 } 81 131 } 132 previousTaskReadyCnt++; 82 133 } 83 previousTaskReadyCnt++; 134 135 if(previousTaskReadyCnt == parCnt) 136 readyTasks.add(task); 84 137 } 85 86 /*87 if(previousTaskReadyCnt == parCnt && task.getDescription().getWorkflow().getParentStates() == WorkflowParentStatesType.AND)88 readyTasks.add(task);89 else if(previousTaskReadyCnt > 0 && task.getDescription().getWorkflow().getParentStates() == WorkflowParentStatesType.OR)90 readyTasks.add(task);91 92 Because of schama changes above commented code was replaced by the following one.93 I strongly believe that this new solution is equivalent.94 95 */96 if(previousTaskReadyCnt == parCnt && task.getDescription().getWorkflow().getAnd() != null)97 readyTasks.add(task);98 else if(previousTaskReadyCnt > 0 && task.getDescription().getWorkflow().getOr() != null)99 readyTasks.add(task);100 138 } 139 101 140 } 102 141 return readyTasks;
Note: See TracChangeset
for help on using the changeset viewer.