> On 2012-01-23 22:44:03, Alejandro Abdelnur wrote: > > trunk/core/src/main/java/org/apache/oozie/workflow/lite/LiteWorkflowApp.java, > > line 117 > > <https://reviews.apache.org/r/3486/diff/1/?file=68840#file68840line117> > > > > this logic should be in the parser it self with the rest of the > > validation logic
moved > On 2012-01-23 22:44:03, Alejandro Abdelnur wrote: > > trunk/core/src/main/java/org/apache/oozie/workflow/lite/LiteWorkflowApp.java, > > line 118 > > <https://reviews.apache.org/r/3486/diff/1/?file=68840#file68840line118> > > > > The algorithm seems a bit too complex. > > > > How about the following approach: > > > > * as part of the current validation traversal all fork&join nodes would > > be harvested in 2 sets (forksSet and joinsSet). > > > > * after doing the current validation the 2 sets above will be populated. > > > > * first check is that the size of both sets is the same. > > > > * if the forksSet is > 0 then > > > > ** get a fork node > > ** follow the first path until a join or fork is reached > > *** if a join is reached remember the join node and remove it from the > > joinsSet. > > *** if a fork is reached start this algorithm recursively > > ** follow every subsequent path > > *** if a fork is reached start this algorithm recursively > > *** if a join is reached ensure it is the same join of the first path. > > Yes..It seems better in terms of code complexity. Good suggestion, thanks! - Virag ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/3486/#review4543 ----------------------------------------------------------- On 2012-01-25 23:00:15, Virag Kothari wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/3486/ > ----------------------------------------------------------- > > (Updated 2012-01-25 23:00:15) > > > Review request for oozie, Mohammad Islam and Angelo K. Huang. > > > Summary > ------- > > Validate fork and join at wf submission time > https://issues.apache.org/jira/browse/OOZIE-636 > > Brief description of algo: > > A modified dfs algorithm is used. Two stacks, one for dfs traversal and other > for maintaining fork join status, are kept. When a fork is encountered > during traversal, it is added to the forkjoin stack and number of paths > associated with the fork is also stored. When a node’s child is seen as a > join, the join is added to the forkJoin stack and the no. of paths to it is > updated. When the number of paths for fork and join are equal, then the > fork/join pair is removed from the forkJoin stack and join is pushed to the > dfsStack. > > Nodes other than fork and join are only pushed to the dfs stack. > If a action node is seen, only the node's "ok-to" transition is considered > > > While(!stack.isEmpty()){ > Node n = DfsStack.pop() > n.traversed = true; > If(n.type==fork){ > ForkJoinStack.push(new Element(n, n.paths) ); > } > List<Node> childs = getUnvisitedChildnodes(n) > For(Node n: childs){ > If (n.type==join){ > Boolean b=isForkJoinCleared(ForkJoinStack) > If(!b){ > Continue; > } > stack.push(n); > n.traversed = true; > } > } > > > This addresses bug OOZIE-636. > https://issues.apache.org/jira/browse/OOZIE-636 > > > Diffs > ----- > > trunk/core/src/main/java/org/apache/oozie/ErrorCode.java 1235973 > > trunk/core/src/main/java/org/apache/oozie/workflow/lite/LiteWorkflowAppParser.java > 1235973 > > trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java > 1235973 > > trunk/core/src/test/java/org/apache/oozie/workflow/lite/TestLiteWorkflowAppParser.java > 1235973 > trunk/core/src/test/resources/wf-schema-valid.xml 1235973 > > Diff: https://reviews.apache.org/r/3486/diff > > > Testing > ------- > > Test case to validate fork-join added > > > Thanks, > > Virag > >
