Permalink
Browse files

Closes OOZIE-130 Incorporated more review feedback

  • Loading branch information...
1 parent dda5cf5 commit 40e499620fab4daa4fe70d2e29633a4cab498355 Chao Wang committed Sep 6, 2011
@@ -90,26 +90,32 @@ static float getJobProgress(WorkflowJobBean wf) {
LiteWorkflowApp wfApp = (LiteWorkflowApp) wfInstance.getApp();
int executionPathLengthEstimate = wfApp.getExecutionPathLengthEstimate();
+ float progress;
if (executionPathLengthEstimate == 0) { // noop wf
- return 1.0f;
+ progress = 1.0f;
}
- List<WorkflowAction> actions = wf.getActions();
- int doneActions = 0;
- for (WorkflowAction action : actions) {
- // Skip decision nodes, note start, kill, end, fork/join will not have action entry.
- if (action.getType().equals(DecisionActionExecutor.ACTION_TYPE)) {
- continue;
- }
- // Make progress if an action is in terminal state
- if (action.getStatus() == WorkflowAction.Status.OK
- || action.getStatus() == WorkflowAction.Status.DONE
- || action.getStatus() == WorkflowAction.Status.ERROR
- || action.getStatus() == WorkflowAction.Status.FAILED
- || action.getStatus() == WorkflowAction.Status.KILLED) {
- doneActions++;
+ else {
+ List<WorkflowAction> actions = wf.getActions();
+ int doneActions = 0;
+ for (WorkflowAction action : actions) {
+ // Skip decision nodes, note start, kill, end, fork/join will not have action entry.
+ if (action.getType().equals(DecisionActionExecutor.ACTION_TYPE)) {
+ // noop
+ }
+ else {
+ // Make progress if an action is in terminal state
+ if (action.getStatus() == WorkflowAction.Status.OK
+ || action.getStatus() == WorkflowAction.Status.ERROR
+ || action.getStatus() == WorkflowAction.Status.FAILED
+ || action.getStatus() == WorkflowAction.Status.KILLED) {
+ doneActions++;
+ }
+ }
}
+
+ progress = (doneActions * 1.0f) / executionPathLengthEstimate;
}
- return (doneActions * 1.0f) / executionPathLengthEstimate;
+ return progress;
}
}
@@ -142,21 +142,32 @@ static float getJobProgress(WorkflowJobBean wf) {
LiteWorkflowApp wfApp = (LiteWorkflowApp) wfInstance.getApp();
int executionPathLengthEstimate = wfApp.getExecutionPathLengthEstimate();
+ float progress;
if (executionPathLengthEstimate == 0) { // noop wf
- return 1.0f;
+ progress = 1.0f;
}
- List<WorkflowAction> actions = wf.getActions();
- int doneActions = 0;
- for (WorkflowAction action : actions) {
- // Skip decision nodes, note start, kill, end, fork/join will not have action entry.
- if (action.getType().equals(DecisionActionExecutor.ACTION_TYPE)) {
- continue;
- }
- if (action.getStatus() == WorkflowAction.Status.OK || action.getStatus() == WorkflowAction.Status.DONE) {
- doneActions++;
+ else {
+ List<WorkflowAction> actions = wf.getActions();
+ int doneActions = 0;
+ for (WorkflowAction action : actions) {
+ // Skip decision nodes, note start, kill, end, fork/join will not have action entry.
+ if (action.getType().equals(DecisionActionExecutor.ACTION_TYPE)) {
+ // noop
+ }
+ else {
+ // Make progress if an action is in terminal state
+ if (action.getStatus() == WorkflowAction.Status.OK
+ || action.getStatus() == WorkflowAction.Status.ERROR
+ || action.getStatus() == WorkflowAction.Status.FAILED
+ || action.getStatus() == WorkflowAction.Status.KILLED) {
+ doneActions++;
+ }
+ }
}
+
+ progress = (doneActions * 1.0f) / executionPathLengthEstimate;
}
- return (doneActions * 1.0f) / executionPathLengthEstimate;
+ return progress;
}
}

0 comments on commit 40e4996

Please sign in to comment.